futhark-0.25.15: An optimising compiler for a functional, array-oriented language.
Safe HaskellSafe-Inferred
LanguageGHC2021

Futhark.IR.Syntax

Description

Definition of the Futhark core language IR

For actually constructing ASTs, see Futhark.Construct.

Types and values

The core language type system is much more restricted than the core language. This is a theme that repeats often. The only types that are supported in the core language are various primitive types PrimType which can be combined in arrays (ignore Mem and Acc for now). Types are represented as TypeBase, which is parameterised by the shape of the array and whether we keep uniqueness information. The Type alias, which is the most commonly used, uses Shape and NoUniqueness.

This means that the records, tuples, and sum types of the source language are represented merely as collections of primitives and arrays. This is implemented in Futhark.Internalise, but the specifics are not important for writing passes on the core language. What is important is that many constructs that conceptually return tuples instead return multiple values. This is not merely syntactic sugar for a tuple: each of those values are eventually bound to distinct variables. The prettyprinter for the IR will typically print such collections of values or types in curly braces.

The system of primitive types is interesting in itself. See Language.Futhark.Primitive.

Overall AST design

Internally, the Futhark compiler core intermediate representation resembles a traditional compiler for an imperative language more than it resembles, say, a Haskell or ML compiler. All functions are monomorphic (except for sizes), first-order, and defined at the top level. Notably, the IR does not use continuation-passing style (CPS) at any time. Instead it uses Administrative Normal Form (ANF), where all subexpressions SubExp are either constants PrimValue or variables VName. Variables are represented as a human-readable Name (which doesn't matter to the compiler) as well as a numeric tag, which is what the compiler actually looks at. All variable names when prettyprinted are of the form foo_123. Function names are just Names, though.

The body of a function (FunDef) is a Body, which consists of a sequence of statements (Stms) and a Result. Execution of a Body consists of executing all of the statements, then returning the values of the variables indicated by the result.

A statement (Stm) consists of a Pat alongside an expression Exp. A pattern is a sequence of name/type pairs.

For example, the source language expression let z = x + y - 1 in z would in the core language be represented (in prettyprinted form) as something like:

let {a_12} = x_10 + y_11
let {b_13} = a_12 - 1
in {b_13}

Representations

Most AST types (Stm, Exp, Prog, etc) are parameterised by a type parameter rep. The representation specifies how to fill out various polymorphic parts of the AST. For example, Exp has a constructor Op whose payload depends on rep, via the use of a type family called Op (a kind of type-level function) which is applied to the rep. The SOACS representation (Futhark.IR.SOACS) thus uses a rep called SOACS, and defines that Op SOACS is a SOAC, while the Kernels representation (Futhark.IR.Kernels) defines Op Kernels as some kind of kernel construct. Similarly, various other decorations (e.g. what information we store in a PatElem) are also type families.

The full list of possible decorations is defined as part of the type class RepTypes (although other type families are also used elsewhere in the compiler on an ad hoc basis).

Essentially, the rep type parameter functions as a kind of proxy, saving us from having to parameterise the AST type with all the different forms of decorations that we desire (it would easily become a type with a dozen type parameters).

Some AST elements (such as Pat) do not take a rep type parameter, but instead immediately the single type of decoration that they contain. We only use the more complicated machinery when needed.

Defining a new representation (or rep) thus requires you to define an empty datatype and implement a handful of type class instances for it. See the source of Futhark.IR.Seq for what is likely the simplest example.

Synopsis

Documentation

prettyString :: Pretty a => a -> String Source #

Prettyprint a value to a String, appropriately wrapped.

prettyText :: Pretty a => a -> Text Source #

Prettyprint a value to a Text, appropriately wrapped.

class Pretty a Source #

Overloaded conversion to Doc.

Laws:

  1. output should be pretty. :-)

Minimal complete definition

pretty

Instances

Instances details
Pretty Void

Finding a good example for printing something that does not exist is hard, so here is an example of printing a list full of nothing.

>>> pretty ([] :: [Void])
[]
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: Void -> Doc ann Source #

prettyList :: [Void] -> Doc ann Source #

Pretty Int16 
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: Int16 -> Doc ann Source #

prettyList :: [Int16] -> Doc ann Source #

Pretty Int32 
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: Int32 -> Doc ann Source #

prettyList :: [Int32] -> Doc ann Source #

Pretty Int64 
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: Int64 -> Doc ann Source #

prettyList :: [Int64] -> Doc ann Source #

Pretty Int8 
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: Int8 -> Doc ann Source #

prettyList :: [Int8] -> Doc ann Source #

Pretty Word16 
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: Word16 -> Doc ann Source #

prettyList :: [Word16] -> Doc ann Source #

Pretty Word32 
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: Word32 -> Doc ann Source #

prettyList :: [Word32] -> Doc ann Source #

Pretty Word64 
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: Word64 -> Doc ann Source #

prettyList :: [Word64] -> Doc ann Source #

Pretty Word8 
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: Word8 -> Doc ann Source #

prettyList :: [Word8] -> Doc ann Source #

Pretty CallGraph Source # 
Instance details

Defined in Futhark.Analysis.CallGraph

Methods

pretty :: CallGraph -> Doc ann Source #

prettyList :: [CallGraph] -> Doc ann Source #

Pretty ArrayTransform Source # 
Instance details

Defined in Futhark.Analysis.HORep.SOAC

Pretty Input Source # 
Instance details

Defined in Futhark.Analysis.HORep.SOAC

Methods

pretty :: Input -> Doc ann Source #

prettyList :: [Input] -> Doc ann Source #

Pretty MemAliases Source # 
Instance details

Defined in Futhark.Analysis.MemAlias

Pretty PyArg Source # 
Instance details

Defined in Futhark.CodeGen.Backends.GenericPython.AST

Methods

pretty :: PyArg -> Doc ann Source #

prettyList :: [PyArg] -> Doc ann Source #

Pretty PyClassDef Source # 
Instance details

Defined in Futhark.CodeGen.Backends.GenericPython.AST

Pretty PyExcept Source # 
Instance details

Defined in Futhark.CodeGen.Backends.GenericPython.AST

Methods

pretty :: PyExcept -> Doc ann Source #

prettyList :: [PyExcept] -> Doc ann Source #

Pretty PyExp Source # 
Instance details

Defined in Futhark.CodeGen.Backends.GenericPython.AST

Methods

pretty :: PyExp -> Doc ann Source #

prettyList :: [PyExp] -> Doc ann Source #

Pretty PyFunDef Source # 
Instance details

Defined in Futhark.CodeGen.Backends.GenericPython.AST

Methods

pretty :: PyFunDef -> Doc ann Source #

prettyList :: [PyFunDef] -> Doc ann Source #

Pretty PyIdx Source # 
Instance details

Defined in Futhark.CodeGen.Backends.GenericPython.AST

Methods

pretty :: PyIdx -> Doc ann Source #

prettyList :: [PyIdx] -> Doc ann Source #

Pretty PyProg Source # 
Instance details

Defined in Futhark.CodeGen.Backends.GenericPython.AST

Methods

pretty :: PyProg -> Doc ann Source #

prettyList :: [PyProg] -> Doc ann Source #

Pretty PyStmt Source # 
Instance details

Defined in Futhark.CodeGen.Backends.GenericPython.AST

Methods

pretty :: PyStmt -> Doc ann Source #

prettyList :: [PyStmt] -> Doc ann Source #

Pretty Arg Source # 
Instance details

Defined in Futhark.CodeGen.ImpCode

Methods

pretty :: Arg -> Doc ann Source #

prettyList :: [Arg] -> Doc ann Source #

Pretty ArrayContents Source # 
Instance details

Defined in Futhark.CodeGen.ImpCode

Pretty EntryPoint Source # 
Instance details

Defined in Futhark.CodeGen.ImpCode

Pretty ExternalValue Source # 
Instance details

Defined in Futhark.CodeGen.ImpCode

Pretty Param Source # 
Instance details

Defined in Futhark.CodeGen.ImpCode

Methods

pretty :: Param -> Doc ann Source #

prettyList :: [Param] -> Doc ann Source #

Pretty ValueDesc Source # 
Instance details

Defined in Futhark.CodeGen.ImpCode

Methods

pretty :: ValueDesc -> Doc ann Source #

prettyList :: [ValueDesc] -> Doc ann Source #

Pretty HostOp Source # 
Instance details

Defined in Futhark.CodeGen.ImpCode.GPU

Methods

pretty :: HostOp -> Doc ann Source #

prettyList :: [HostOp] -> Doc ann Source #

Pretty Kernel Source # 
Instance details

Defined in Futhark.CodeGen.ImpCode.GPU

Methods

pretty :: Kernel -> Doc ann Source #

prettyList :: [Kernel] -> Doc ann Source #

Pretty KernelConst Source # 
Instance details

Defined in Futhark.CodeGen.ImpCode.GPU

Pretty KernelOp Source # 
Instance details

Defined in Futhark.CodeGen.ImpCode.GPU

Methods

pretty :: KernelOp -> Doc ann Source #

prettyList :: [KernelOp] -> Doc ann Source #

Pretty KernelUse Source # 
Instance details

Defined in Futhark.CodeGen.ImpCode.GPU

Methods

pretty :: KernelUse -> Doc ann Source #

prettyList :: [KernelUse] -> Doc ann Source #

Pretty Multicore Source # 
Instance details

Defined in Futhark.CodeGen.ImpCode.Multicore

Methods

pretty :: Multicore -> Doc ann Source #

prettyList :: [Multicore] -> Doc ann Source #

Pretty ParallelTask Source # 
Instance details

Defined in Futhark.CodeGen.ImpCode.Multicore

Pretty SchedulerInfo Source # 
Instance details

Defined in Futhark.CodeGen.ImpCode.Multicore

Pretty Scheduling Source # 
Instance details

Defined in Futhark.CodeGen.ImpCode.Multicore

Pretty OpenCL Source # 
Instance details

Defined in Futhark.CodeGen.ImpCode.OpenCL

Methods

pretty :: OpenCL -> Doc ann Source #

prettyList :: [OpenCL] -> Doc ann Source #

Pretty Sequential Source # 
Instance details

Defined in Futhark.CodeGen.ImpCode.Sequential

Pretty DeviceInfo Source # 
Instance details

Defined in Futhark.CodeGen.OpenCL.Heuristics

Pretty AliasDec Source # 
Instance details

Defined in Futhark.IR.Aliases

Methods

pretty :: AliasDec -> Doc ann Source #

prettyList :: [AliasDec] -> Doc ann Source #

Pretty KernelGrid Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Pretty SegLevel Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Methods

pretty :: SegLevel -> Doc ann Source #

prettyList :: [SegLevel] -> Doc ann Source #

Pretty SegVirt Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Methods

pretty :: SegVirt -> Doc ann Source #

prettyList :: [SegVirt] -> Doc ann Source #

Pretty SizeOp Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Methods

pretty :: SizeOp -> Doc ann Source #

prettyList :: [SizeOp] -> Doc ann Source #

Pretty SizeClass Source # 
Instance details

Defined in Futhark.IR.GPU.Sizes

Methods

pretty :: SizeClass -> Doc ann Source #

prettyList :: [SizeClass] -> Doc ann Source #

Pretty MemBind Source # 
Instance details

Defined in Futhark.IR.Mem

Methods

pretty :: MemBind -> Doc ann Source #

prettyList :: [MemBind] -> Doc ann Source #

Pretty MemReturn Source # 
Instance details

Defined in Futhark.IR.Mem

Methods

pretty :: MemReturn -> Doc ann Source #

prettyList :: [MemReturn] -> Doc ann Source #

Pretty Names Source # 
Instance details

Defined in Futhark.IR.Prop.Names

Methods

pretty :: Names -> Doc ann Source #

prettyList :: [Names] -> Doc ann Source #

Pretty KernelResult Source # 
Instance details

Defined in Futhark.IR.SegOp

Pretty SegSpace Source # 
Instance details

Defined in Futhark.IR.SegOp

Methods

pretty :: SegSpace -> Doc ann Source #

prettyList :: [SegSpace] -> Doc ann Source #

Pretty BasicOp Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: BasicOp -> Doc ann Source #

prettyList :: [BasicOp] -> Doc ann Source #

Pretty EntryParam Source # 
Instance details

Defined in Futhark.IR.Pretty

Pretty EntryResult Source # 
Instance details

Defined in Futhark.IR.Pretty

Pretty SubExpRes Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: SubExpRes -> Doc ann Source #

prettyList :: [SubExpRes] -> Doc ann Source #

Pretty Attr Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Attr -> Doc ann Source #

prettyList :: [Attr] -> Doc ann Source #

Pretty Attrs Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Attrs -> Doc ann Source #

prettyList :: [Attrs] -> Doc ann Source #

Pretty Certs Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Certs -> Doc ann Source #

prettyList :: [Certs] -> Doc ann Source #

Pretty Commutativity Source # 
Instance details

Defined in Futhark.IR.Pretty

Pretty EntryPointType Source # 
Instance details

Defined in Futhark.IR.Pretty

Pretty ExtShape Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: ExtShape -> Doc ann Source #

prettyList :: [ExtShape] -> Doc ann Source #

Pretty Ident Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Ident -> Doc ann Source #

prettyList :: [Ident] -> Doc ann Source #

Pretty OpaqueType Source # 
Instance details

Defined in Futhark.IR.Pretty

Pretty OpaqueTypes Source # 
Instance details

Defined in Futhark.IR.Pretty

Pretty Rank Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Rank -> Doc ann Source #

prettyList :: [Rank] -> Doc ann Source #

Pretty Shape Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Shape -> Doc ann Source #

prettyList :: [Shape] -> Doc ann Source #

Pretty Signedness Source # 
Instance details

Defined in Futhark.IR.Pretty

Pretty Space Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Space -> Doc ann Source #

prettyList :: [Space] -> Doc ann Source #

Pretty SubExp Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: SubExp -> Doc ann Source #

prettyList :: [SubExp] -> Doc ann Source #

Pretty ValueType Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: ValueType -> Doc ann Source #

prettyList :: [ValueType] -> Doc ann Source #

Pretty AccessSummary Source # 
Instance details

Defined in Futhark.Optimise.ArrayShortCircuiting.DataStructs

Pretty ArrayMemBound Source # 
Instance details

Defined in Futhark.Optimise.ArrayShortCircuiting.DataStructs

Pretty Coalesced Source # 
Instance details

Defined in Futhark.Optimise.ArrayShortCircuiting.DataStructs

Methods

pretty :: Coalesced -> Doc ann Source #

prettyList :: [Coalesced] -> Doc ann Source #

Pretty CoalescedKind Source # 
Instance details

Defined in Futhark.Optimise.ArrayShortCircuiting.DataStructs

Pretty CoalsEntry Source # 
Instance details

Defined in Futhark.Optimise.ArrayShortCircuiting.DataStructs

Pretty CoalsTab Source # 
Instance details

Defined in Futhark.Optimise.ArrayShortCircuiting.DataStructs

Methods

pretty :: CoalsTab -> Doc ann Source #

prettyList :: [CoalsTab] -> Doc ann Source #

Pretty MemRefs Source # 
Instance details

Defined in Futhark.Optimise.ArrayShortCircuiting.DataStructs

Methods

pretty :: MemRefs -> Doc ann Source #

prettyList :: [MemRefs] -> Doc ann Source #

Pretty VarWisdom Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Rep

Methods

pretty :: VarWisdom -> Doc ann Source #

prettyList :: [VarWisdom] -> Doc ann Source #

Pretty Exp Source # 
Instance details

Defined in Futhark.Script

Methods

pretty :: Exp -> Doc ann Source #

prettyList :: [Exp] -> Doc ann Source #

Pretty Func Source # 
Instance details

Defined in Futhark.Script

Methods

pretty :: Func -> Doc ann Source #

prettyList :: [Func] -> Doc ann Source #

Pretty ScriptValueType Source # 
Instance details

Defined in Futhark.Script

Pretty Name Source # 
Instance details

Defined in Language.Futhark.Core

Methods

pretty :: Name -> Doc ann Source #

prettyList :: [Name] -> Doc ann Source #

Pretty NoUniqueness Source # 
Instance details

Defined in Language.Futhark.Core

Pretty Uniqueness Source # 
Instance details

Defined in Language.Futhark.Core

Pretty VName Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: VName -> Doc ann Source #

prettyList :: [VName] -> Doc ann Source #

Pretty BinOp Source # 
Instance details

Defined in Language.Futhark.Primitive

Methods

pretty :: BinOp -> Doc ann Source #

prettyList :: [BinOp] -> Doc ann Source #

Pretty CmpOp Source # 
Instance details

Defined in Language.Futhark.Primitive

Methods

pretty :: CmpOp -> Doc ann Source #

prettyList :: [CmpOp] -> Doc ann Source #

Pretty ConvOp Source # 
Instance details

Defined in Language.Futhark.Primitive

Methods

pretty :: ConvOp -> Doc ann Source #

prettyList :: [ConvOp] -> Doc ann Source #

Pretty FloatType Source # 
Instance details

Defined in Language.Futhark.Primitive

Methods

pretty :: FloatType -> Doc ann Source #

prettyList :: [FloatType] -> Doc ann Source #

Pretty FloatValue Source # 
Instance details

Defined in Language.Futhark.Primitive

Pretty IntType Source # 
Instance details

Defined in Language.Futhark.Primitive

Methods

pretty :: IntType -> Doc ann Source #

prettyList :: [IntType] -> Doc ann Source #

Pretty IntValue Source # 
Instance details

Defined in Language.Futhark.Primitive

Methods

pretty :: IntValue -> Doc ann Source #

prettyList :: [IntValue] -> Doc ann Source #

Pretty PrimType Source # 
Instance details

Defined in Language.Futhark.Primitive

Methods

pretty :: PrimType -> Doc ann Source #

prettyList :: [PrimType] -> Doc ann Source #

Pretty PrimValue Source # 
Instance details

Defined in Language.Futhark.Primitive

Methods

pretty :: PrimValue -> Doc ann Source #

prettyList :: [PrimValue] -> Doc ann Source #

Pretty UnOp Source # 
Instance details

Defined in Language.Futhark.Primitive

Methods

pretty :: UnOp -> Doc ann Source #

prettyList :: [UnOp] -> Doc ann Source #

Pretty Env Source # 
Instance details

Defined in Language.Futhark.Semantic

Methods

pretty :: Env -> Doc ann Source #

prettyList :: [Env] -> Doc ann Source #

Pretty MTy Source # 
Instance details

Defined in Language.Futhark.Semantic

Methods

pretty :: MTy -> Doc ann Source #

prettyList :: [MTy] -> Doc ann Source #

Pretty Mod Source # 
Instance details

Defined in Language.Futhark.Semantic

Methods

pretty :: Mod -> Doc ann Source #

prettyList :: [Mod] -> Doc ann Source #

Pretty Namespace Source # 
Instance details

Defined in Language.Futhark.Semantic

Methods

pretty :: Namespace -> Doc ann Source #

prettyList :: [Namespace] -> Doc ann Source #

Pretty BinOp Source # 
Instance details

Defined in Language.Futhark.Syntax

Methods

pretty :: BinOp -> Doc ann Source #

prettyList :: [BinOp] -> Doc ann Source #

Pretty Diet Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: Diet -> Doc ann Source #

prettyList :: [Diet] -> Doc ann Source #

Pretty Liftedness Source # 
Instance details

Defined in Language.Futhark.Pretty

Pretty PatLit Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: PatLit -> Doc ann Source #

prettyList :: [PatLit] -> Doc ann Source #

Pretty PrimType Source # 
Instance details

Defined in Language.Futhark.Syntax

Methods

pretty :: PrimType -> Doc ann Source #

prettyList :: [PrimType] -> Doc ann Source #

Pretty PrimValue Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: PrimValue -> Doc ann Source #

prettyList :: [PrimValue] -> Doc ann Source #

Pretty Notes Source # 
Instance details

Defined in Language.Futhark.TypeChecker.Monad

Methods

pretty :: Notes -> Doc ann Source #

prettyList :: [Notes] -> Doc ann Source #

Pretty Checking Source # 
Instance details

Defined in Language.Futhark.TypeChecker.Terms.Monad

Methods

pretty :: Checking -> Doc ann Source #

prettyList :: [Checking] -> Doc ann Source #

Pretty BreadCrumbs Source # 
Instance details

Defined in Language.Futhark.TypeChecker.Unify

Pretty Usage Source # 
Instance details

Defined in Language.Futhark.TypeChecker.Unify

Methods

pretty :: Usage -> Doc ann Source #

prettyList :: [Usage] -> Doc ann Source #

Pretty Value Source # 
Instance details

Defined in Futhark.Test.Values

Methods

pretty :: Value -> Doc ann Source #

prettyList :: [Value] -> Doc ann Source #

Pretty ValueType Source # 
Instance details

Defined in Futhark.Test.Values

Methods

pretty :: ValueType -> Doc ann Source #

prettyList :: [ValueType] -> Doc ann Source #

Pretty Half Source # 
Instance details

Defined in Futhark.Util.Pretty

Methods

pretty :: Half -> Doc ann Source #

prettyList :: [Half] -> Doc ann Source #

Pretty Text

Automatically converts all newlines to line.

>>> pretty ("hello\nworld" :: Text)
hello
world

Note that line can be undone by group:

>>> group (pretty ("hello\nworld" :: Text))
hello world

Manually use hardline if you definitely want newlines.

Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: Text -> Doc ann Source #

prettyList :: [Text] -> Doc ann Source #

Pretty Text

(lazy Doc instance, identical to the strict version)

Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: Text -> Doc ann Source #

prettyList :: [Text] -> Doc ann Source #

Pretty Integer
>>> pretty (2^123 :: Integer)
10633823966279326983230456482242756608
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: Integer -> Doc ann Source #

prettyList :: [Integer] -> Doc ann Source #

Pretty Natural 
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: Natural -> Doc ann Source #

prettyList :: [Natural] -> Doc ann Source #

Pretty ()
>>> pretty ()
()

The argument is not used:

>>> pretty (error "Strict?" :: ())
()
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: () -> Doc ann Source #

prettyList :: [()] -> Doc ann Source #

Pretty Bool
>>> pretty True
True
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: Bool -> Doc ann Source #

prettyList :: [Bool] -> Doc ann Source #

Pretty Char

Instead of (pretty 'n'), consider using line as a more readable alternative.

>>> pretty 'f' <> pretty 'o' <> pretty 'o'
foo
>>> pretty ("string" :: String)
string
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: Char -> Doc ann Source #

prettyList :: [Char] -> Doc ann Source #

Pretty Double
>>> pretty (exp 1 :: Double)
2.71828182845904...
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: Double -> Doc ann Source #

prettyList :: [Double] -> Doc ann Source #

Pretty Float
>>> pretty (pi :: Float)
3.1415927
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: Float -> Doc ann Source #

prettyList :: [Float] -> Doc ann Source #

Pretty Int
>>> pretty (123 :: Int)
123
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: Int -> Doc ann Source #

prettyList :: [Int] -> Doc ann Source #

Pretty Word 
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: Word -> Doc ann Source #

prettyList :: [Word] -> Doc ann Source #

Pretty a => Pretty (Identity a)
>>> pretty (Identity 1)
1
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: Identity a -> Doc ann Source #

prettyList :: [Identity a] -> Doc ann Source #

Pretty a => Pretty (NonEmpty a) 
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: NonEmpty a -> Doc ann Source #

prettyList :: [NonEmpty a] -> Doc ann Source #

PrettyRep rep => Pretty (SOAC rep) Source # 
Instance details

Defined in Futhark.Analysis.HORep.SOAC

Methods

pretty :: SOAC rep -> Doc ann Source #

prettyList :: [SOAC rep] -> Doc ann Source #

Pretty v => Pretty (PrimExp v) Source # 
Instance details

Defined in Futhark.Analysis.PrimExp

Methods

pretty :: PrimExp v -> Doc ann Source #

prettyList :: [PrimExp v] -> Doc ann Source #

Pretty op => Pretty (Code op) Source # 
Instance details

Defined in Futhark.CodeGen.ImpCode

Methods

pretty :: Code op -> Doc ann Source #

prettyList :: [Code op] -> Doc ann Source #

Pretty op => Pretty (Constants op) Source # 
Instance details

Defined in Futhark.CodeGen.ImpCode

Methods

pretty :: Constants op -> Doc ann Source #

prettyList :: [Constants op] -> Doc ann Source #

Pretty op => Pretty (Definitions op) Source # 
Instance details

Defined in Futhark.CodeGen.ImpCode

Methods

pretty :: Definitions op -> Doc ann Source #

prettyList :: [Definitions op] -> Doc ann Source #

Pretty op => Pretty (FunctionT op) Source # 
Instance details

Defined in Futhark.CodeGen.ImpCode

Methods

pretty :: FunctionT op -> Doc ann Source #

prettyList :: [FunctionT op] -> Doc ann Source #

Pretty op => Pretty (Functions op) Source # 
Instance details

Defined in Futhark.CodeGen.ImpCode

Methods

pretty :: Functions op -> Doc ann Source #

prettyList :: [Functions op] -> Doc ann Source #

Pretty num => Pretty (LMAD num) Source # 
Instance details

Defined in Futhark.IR.Mem.LMAD

Methods

pretty :: LMAD num -> Doc ann Source #

prettyList :: [LMAD num] -> Doc ann Source #

PrettyRep rep => Pretty (Reduce rep) Source # 
Instance details

Defined in Futhark.IR.SOACS.SOAC

Methods

pretty :: Reduce rep -> Doc ann Source #

prettyList :: [Reduce rep] -> Doc ann Source #

PrettyRep rep => Pretty (SOAC rep) Source # 
Instance details

Defined in Futhark.IR.SOACS.SOAC

Methods

pretty :: SOAC rep -> Doc ann Source #

prettyList :: [SOAC rep] -> Doc ann Source #

PrettyRep rep => Pretty (Scan rep) Source # 
Instance details

Defined in Futhark.IR.SOACS.SOAC

Methods

pretty :: Scan rep -> Doc ann Source #

prettyList :: [Scan rep] -> Doc ann Source #

PrettyRep rep => Pretty (KernelBody rep) Source # 
Instance details

Defined in Futhark.IR.SegOp

Methods

pretty :: KernelBody rep -> Doc ann Source #

prettyList :: [KernelBody rep] -> Doc ann Source #

PrettyRep rep => Pretty (SegBinOp rep) Source # 
Instance details

Defined in Futhark.IR.SegOp

Methods

pretty :: SegBinOp rep -> Doc ann Source #

prettyList :: [SegBinOp rep] -> Doc ann Source #

PrettyRep rep => Pretty (Body rep) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Body rep -> Doc ann Source #

prettyList :: [Body rep] -> Doc ann Source #

PrettyRep rep => Pretty (Case (Body rep)) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Case (Body rep) -> Doc ann Source #

prettyList :: [Case (Body rep)] -> Doc ann Source #

PrettyRep rep => Pretty (Exp rep) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Exp rep -> Doc ann Source #

prettyList :: [Exp rep] -> Doc ann Source #

PrettyRep rep => Pretty (FunDef rep) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: FunDef rep -> Doc ann Source #

prettyList :: [FunDef rep] -> Doc ann Source #

PrettyRep rep => Pretty (Lambda rep) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Lambda rep -> Doc ann Source #

prettyList :: [Lambda rep] -> Doc ann Source #

Pretty t => Pretty (Pat t) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Pat t -> Doc ann Source #

prettyList :: [Pat t] -> Doc ann Source #

PrettyRep rep => Pretty (Prog rep) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Prog rep -> Doc ann Source #

prettyList :: [Prog rep] -> Doc ann Source #

PrettyRep rep => Pretty (Stm rep) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Stm rep -> Doc ann Source #

prettyList :: [Stm rep] -> Doc ann Source #

PrettyRep rep => Pretty (Stms rep) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Stms rep -> Doc ann Source #

prettyList :: [Stms rep] -> Doc ann Source #

Pretty d => Pretty (DimIndex d) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: DimIndex d -> Doc ann Source #

prettyList :: [DimIndex d] -> Doc ann Source #

Pretty a => Pretty (ErrorMsg a) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: ErrorMsg a -> Doc ann Source #

prettyList :: [ErrorMsg a] -> Doc ann Source #

Pretty a => Pretty (Ext a) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Ext a -> Doc ann Source #

prettyList :: [Ext a] -> Doc ann Source #

Pretty d => Pretty (FlatDimIndex d) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: FlatDimIndex d -> Doc ann Source #

prettyList :: [FlatDimIndex d] -> Doc ann Source #

Pretty a => Pretty (FlatSlice a) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: FlatSlice a -> Doc ann Source #

prettyList :: [FlatSlice a] -> Doc ann Source #

Pretty t => Pretty (Param t) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Param t -> Doc ann Source #

prettyList :: [Param t] -> Doc ann Source #

Pretty t => Pretty (PatElem t) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: PatElem t -> Doc ann Source #

prettyList :: [PatElem t] -> Doc ann Source #

Pretty a => Pretty (Slice a) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Slice a -> Doc ann Source #

prettyList :: [Slice a] -> Doc ann Source #

Pretty v => Pretty (Compound v) Source # 
Instance details

Defined in Futhark.Test.Values

Methods

pretty :: Compound v -> Doc ann Source #

prettyList :: [Compound v] -> Doc ann Source #

Pretty d => Pretty (Shape d) Source # 
Instance details

Defined in Language.Futhark.Interpreter.Values

Methods

pretty :: Shape d -> Doc ann Source #

prettyList :: [Shape d] -> Doc ann Source #

IsName vn => Pretty (QualName vn) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: QualName vn -> Doc ann Source #

prettyList :: [QualName vn] -> Doc ann Source #

Pretty (Shape Int64) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: Shape Int64 -> Doc ann Source #

prettyList :: [Shape Int64] -> Doc ann Source #

Pretty (Shape Size) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: Shape Size -> Doc ann Source #

prettyList :: [Shape Size] -> Doc ann Source #

Pretty (Shape ()) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: Shape () -> Doc ann Source #

prettyList :: [Shape ()] -> Doc ann Source #

Pretty (Shape Bool) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: Shape Bool -> Doc ann Source #

prettyList :: [Shape Bool] -> Doc ann Source #

IsName vn => Pretty (SizeBinder vn) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: SizeBinder vn -> Doc ann Source #

prettyList :: [SizeBinder vn] -> Doc ann Source #

Pretty d => Pretty (SizeExp d) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: SizeExp d -> Doc ann Source #

prettyList :: [SizeExp d] -> Doc ann Source #

Pretty (TypeArg Size) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: TypeArg Size -> Doc ann Source #

prettyList :: [TypeArg Size] -> Doc ann Source #

(Eq vn, IsName vn) => Pretty (TypeParamBase vn) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: TypeParamBase vn -> Doc ann Source #

prettyList :: [TypeParamBase vn] -> Doc ann Source #

Pretty (Match t) Source # 
Instance details

Defined in Language.Futhark.TypeChecker.Match

Methods

pretty :: Match t -> Doc ann Source #

prettyList :: [Match t] -> Doc ann Source #

Pretty t => Pretty (Subst t) Source # 
Instance details

Defined in Language.Futhark.TypeChecker.Types

Methods

pretty :: Subst t -> Doc ann Source #

prettyList :: [Subst t] -> Doc ann Source #

Pretty a => Pretty (Maybe a)

Ignore Nothings, print Just contents.

>>> pretty (Just True)
True
>>> braces (pretty (Nothing :: Maybe Bool))
{}
>>> pretty [Just 1, Nothing, Just 3, Nothing]
[1, 3]
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: Maybe a -> Doc ann Source #

prettyList :: [Maybe a] -> Doc ann Source #

Pretty a => Pretty [a]
>>> pretty [1,2,3]
[1, 2, 3]
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: [a] -> Doc ann Source #

prettyList :: [[a]] -> Doc ann Source #

(PrettyRep rep, Pretty (op rep)) => Pretty (HostOp op rep) Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Methods

pretty :: HostOp op rep -> Doc ann Source #

prettyList :: [HostOp op rep] -> Doc ann Source #

(PrettyRep rep, Pretty (op rep)) => Pretty (MCOp op rep) Source # 
Instance details

Defined in Futhark.IR.MC.Op

Methods

pretty :: MCOp op rep -> Doc ann Source #

prettyList :: [MCOp op rep] -> Doc ann Source #

Pretty (inner rep) => Pretty (MemOp inner rep) Source # 
Instance details

Defined in Futhark.IR.Mem

Methods

pretty :: MemOp inner rep -> Doc ann Source #

prettyList :: [MemOp inner rep] -> Doc ann Source #

Pretty (NoOp rep) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: NoOp rep -> Doc ann Source #

prettyList :: [NoOp rep] -> Doc ann Source #

(PrettyRep rep, Pretty lvl) => Pretty (SegOp lvl rep) Source # 
Instance details

Defined in Futhark.IR.SegOp

Methods

pretty :: SegOp lvl rep -> Doc ann Source #

prettyList :: [SegOp lvl rep] -> Doc ann Source #

Pretty u => Pretty (TypeBase ExtShape u) Source # 
Instance details

Defined in Futhark.IR.Pretty

Pretty u => Pretty (TypeBase Rank u) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: TypeBase Rank u -> Doc ann Source #

prettyList :: [TypeBase Rank u] -> Doc ann Source #

Pretty u => Pretty (TypeBase Shape u) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: TypeBase Shape u -> Doc ann Source #

prettyList :: [TypeBase Shape u] -> Doc ann Source #

(Eq vn, IsName vn, Annot f) => Pretty (AppExpBase f vn) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: AppExpBase f vn -> Doc ann Source #

prettyList :: [AppExpBase f vn] -> Doc ann Source #

IsName vn => Pretty (AttrAtom vn) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: AttrAtom vn -> Doc ann Source #

prettyList :: [AttrAtom vn] -> Doc ann Source #

IsName vn => Pretty (AttrInfo vn) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: AttrInfo vn -> Doc ann Source #

prettyList :: [AttrInfo vn] -> Doc ann Source #

(Eq vn, IsName vn, Annot f) => Pretty (CaseBase f vn) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: CaseBase f vn -> Doc ann Source #

prettyList :: [CaseBase f vn] -> Doc ann Source #

(Eq vn, IsName vn, Annot f) => Pretty (DecBase f vn) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: DecBase f vn -> Doc ann Source #

prettyList :: [DecBase f vn] -> Doc ann Source #

(Eq vn, IsName vn, Annot f) => Pretty (DimIndexBase f vn) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: DimIndexBase f vn -> Doc ann Source #

prettyList :: [DimIndexBase f vn] -> Doc ann Source #

(Eq vn, IsName vn, Annot f) => Pretty (ExpBase f vn) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: ExpBase f vn -> Doc ann Source #

prettyList :: [ExpBase f vn] -> Doc ann Source #

(Eq vn, IsName vn, Annot f) => Pretty (FieldBase f vn) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: FieldBase f vn -> Doc ann Source #

prettyList :: [FieldBase f vn] -> Doc ann Source #

(Eq vn, IsName vn, Annot f) => Pretty (LoopFormBase f vn) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: LoopFormBase f vn -> Doc ann Source #

prettyList :: [LoopFormBase f vn] -> Doc ann Source #

(Eq vn, IsName vn, Annot f) => Pretty (ModBindBase f vn) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: ModBindBase f vn -> Doc ann Source #

prettyList :: [ModBindBase f vn] -> Doc ann Source #

(Eq vn, IsName vn, Annot f) => Pretty (ModExpBase f vn) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: ModExpBase f vn -> Doc ann Source #

prettyList :: [ModExpBase f vn] -> Doc ann Source #

(Eq vn, IsName vn, Annot f) => Pretty (ModParamBase f vn) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: ModParamBase f vn -> Doc ann Source #

prettyList :: [ModParamBase f vn] -> Doc ann Source #

(Eq vn, IsName vn, Annot f) => Pretty (ModTypeBindBase f vn) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: ModTypeBindBase f vn -> Doc ann Source #

prettyList :: [ModTypeBindBase f vn] -> Doc ann Source #

(Eq vn, IsName vn, Annot f) => Pretty (ModTypeExpBase f vn) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: ModTypeExpBase f vn -> Doc ann Source #

prettyList :: [ModTypeExpBase f vn] -> Doc ann Source #

(Eq vn, IsName vn, Annot f) => Pretty (ProgBase f vn) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: ProgBase f vn -> Doc ann Source #

prettyList :: [ProgBase f vn] -> Doc ann Source #

(Pretty (Shape dim), Pretty u) => Pretty (RetTypeBase dim u) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: RetTypeBase dim u -> Doc ann Source #

prettyList :: [RetTypeBase dim u] -> Doc ann Source #

(Pretty (Shape dim), Pretty u) => Pretty (ScalarTypeBase dim u) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: ScalarTypeBase dim u -> Doc ann Source #

prettyList :: [ScalarTypeBase dim u] -> Doc ann Source #

(Eq vn, IsName vn, Annot f) => Pretty (SpecBase f vn) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: SpecBase f vn -> Doc ann Source #

prettyList :: [SpecBase f vn] -> Doc ann Source #

(Pretty d, IsName vn) => Pretty (TypeArgExp d vn) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: TypeArgExp d vn -> Doc ann Source #

prettyList :: [TypeArgExp d vn] -> Doc ann Source #

(Pretty (Shape dim), Pretty u) => Pretty (TypeBase dim u) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: TypeBase dim u -> Doc ann Source #

prettyList :: [TypeBase dim u] -> Doc ann Source #

(Eq vn, IsName vn, Annot f) => Pretty (TypeBindBase f vn) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: TypeBindBase f vn -> Doc ann Source #

prettyList :: [TypeBindBase f vn] -> Doc ann Source #

(IsName vn, Pretty d) => Pretty (TypeExp d vn) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: TypeExp d vn -> Doc ann Source #

prettyList :: [TypeExp d vn] -> Doc ann Source #

(Eq vn, IsName vn, Annot f) => Pretty (ValBindBase f vn) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: ValBindBase f vn -> Doc ann Source #

prettyList :: [ValBindBase f vn] -> Doc ann Source #

(Pretty a1, Pretty a2) => Pretty (a1, a2)
>>> pretty (123, "hello")
(123, hello)
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: (a1, a2) -> Doc ann Source #

prettyList :: [(a1, a2)] -> Doc ann Source #

Pretty a => Pretty (Const a b) 
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: Const a b -> Doc ann Source #

prettyList :: [Const a b] -> Doc ann Source #

Pretty v => Pretty (TPrimExp t v) Source # 
Instance details

Defined in Futhark.Analysis.PrimExp

Methods

pretty :: TPrimExp t v -> Doc ann Source #

prettyList :: [TPrimExp t v] -> Doc ann Source #

Pretty e => Pretty (Count u e) Source # 
Instance details

Defined in Futhark.IR.GPU.Sizes

Methods

pretty :: Count u e -> Doc ann Source #

prettyList :: [Count u e] -> Doc ann Source #

(Pretty (ShapeBase d), Pretty (TypeBase (ShapeBase d) u), Pretty d, Pretty u, Pretty ret) => Pretty (MemInfo d u ret) Source # 
Instance details

Defined in Futhark.IR.Mem

Methods

pretty :: MemInfo d u ret -> Doc ann Source #

prettyList :: [MemInfo d u ret] -> Doc ann Source #

(Eq vn, IsName vn, Annot f, Pretty t) => Pretty (PatBase f vn t) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: PatBase f vn t -> Doc ann Source #

prettyList :: [PatBase f vn t] -> Doc ann Source #

(Pretty a1, Pretty a2, Pretty a3) => Pretty (a1, a2, a3)
>>> pretty (123, "hello", False)
(123, hello, False)
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: (a1, a2, a3) -> Doc ann Source #

prettyList :: [(a1, a2, a3)] -> Doc ann Source #

IsName vn => Pretty (IdentBase f vn t) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: IdentBase f vn t -> Doc ann Source #

prettyList :: [IdentBase f vn t] -> Doc ann Source #

Types

data Uniqueness Source #

The uniqueness attribute of a type. This essentially indicates whether or not in-place modifications are acceptable. With respect to ordering, Unique is greater than Nonunique.

Constructors

Nonunique

May have references outside current function.

Unique

No references outside current function.

Instances

Instances details
Monoid Uniqueness Source # 
Instance details

Defined in Language.Futhark.Core

Semigroup Uniqueness Source # 
Instance details

Defined in Language.Futhark.Core

Show Uniqueness Source # 
Instance details

Defined in Language.Futhark.Core

DeclExtTyped DeclExtType Source # 
Instance details

Defined in Futhark.IR.Prop.Types

DeclTyped DeclType Source # 
Instance details

Defined in Futhark.IR.Prop.Types

ExtTyped DeclExtType Source # 
Instance details

Defined in Futhark.IR.Prop.Types

Typed DeclType Source # 
Instance details

Defined in Futhark.IR.Prop.Types

Methods

typeOf :: DeclType -> Type Source #

IsRetType FunReturns Source # 
Instance details

Defined in Futhark.IR.Mem

IsRetType DeclExtType Source # 
Instance details

Defined in Futhark.IR.RetType

ASTMappable ResRetType Source # 
Instance details

Defined in Language.Futhark.Traversals

Eq Uniqueness Source # 
Instance details

Defined in Language.Futhark.Core

Ord Uniqueness Source # 
Instance details

Defined in Language.Futhark.Core

Pretty Uniqueness Source # 
Instance details

Defined in Language.Futhark.Core

Simplifiable [FunReturns] Source # 
Instance details

Defined in Futhark.IR.Mem

ASTMappable (TypeBase Size Uniqueness) Source # 
Instance details

Defined in Language.Futhark.Traversals

Substitutable (RetTypeBase Size Uniqueness) Source # 
Instance details

Defined in Language.Futhark.TypeChecker.Types

Substitutable (TypeBase Size Uniqueness) Source # 
Instance details

Defined in Language.Futhark.TypeChecker.Types

FixExt ret => DeclExtTyped (MemInfo ExtSize Uniqueness ret) Source # 
Instance details

Defined in Futhark.IR.Mem

DeclTyped (MemInfo SubExp Uniqueness ret) Source # 
Instance details

Defined in Futhark.IR.Mem

FixExt ret => ExtTyped (MemInfo ExtSize Uniqueness ret) Source # 
Instance details

Defined in Futhark.IR.Mem

Typed (MemInfo SubExp Uniqueness ret) Source # 
Instance details

Defined in Futhark.IR.Mem

data NoUniqueness Source #

A fancier name for () - encodes no uniqueness information. Also has a different prettyprinting instance.

Constructors

NoUniqueness 

Instances

Instances details
Monoid NoUniqueness Source # 
Instance details

Defined in Language.Futhark.Core

Semigroup NoUniqueness Source # 
Instance details

Defined in Language.Futhark.Core

Show NoUniqueness Source # 
Instance details

Defined in Language.Futhark.Core

HasLetDecMem LetDecMem Source # 
Instance details

Defined in Futhark.IR.Mem

ExtTyped ExtType Source # 
Instance details

Defined in Futhark.IR.Prop.Types

Typed Type Source # 
Instance details

Defined in Futhark.IR.Prop.Types

Methods

typeOf :: Type -> Type Source #

IsBodyType BodyReturns Source # 
Instance details

Defined in Futhark.IR.Mem

IsBodyType ExtType Source # 
Instance details

Defined in Futhark.IR.RetType

ASTMappable StructType Source # 
Instance details

Defined in Language.Futhark.Traversals

Substitutable StructType Source # 
Instance details

Defined in Language.Futhark.TypeChecker.Types

Eq NoUniqueness Source # 
Instance details

Defined in Language.Futhark.Core

Ord NoUniqueness Source # 
Instance details

Defined in Language.Futhark.Core

Pretty NoUniqueness Source # 
Instance details

Defined in Language.Futhark.Core

Substitutable (Pat StructType) Source # 
Instance details

Defined in Language.Futhark.TypeChecker.Types

Substitutable (RetTypeBase Size NoUniqueness) Source # 
Instance details

Defined in Language.Futhark.TypeChecker.Types

FixExt ret => ExtTyped (MemInfo ExtSize NoUniqueness ret) Source # 
Instance details

Defined in Futhark.IR.Mem

Typed (MemInfo SubExp NoUniqueness ret) Source # 
Instance details

Defined in Futhark.IR.Mem

ASTMappable (PatBase Info VName StructType) Source # 
Instance details

Defined in Language.Futhark.Traversals

ASTMappable (IdentBase Info VName StructType) Source # 
Instance details

Defined in Language.Futhark.Traversals

newtype Rank Source #

The size of an array type as merely the number of dimensions, with no further information.

Constructors

Rank Int 

Instances

Instances details
Monoid Rank Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Semigroup Rank Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Show Rank Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

ArrayShape Rank Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Rename Rank Source # 
Instance details

Defined in Futhark.Transform.Rename

Substitute Rank Source # 
Instance details

Defined in Futhark.Transform.Substitute

Eq Rank Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

(==) :: Rank -> Rank -> Bool Source #

(/=) :: Rank -> Rank -> Bool Source #

Ord Rank Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Pretty Rank Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Rank -> Doc ann Source #

prettyList :: [Rank] -> Doc ann Source #

Pretty u => Pretty (TypeBase Rank u) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: TypeBase Rank u -> Doc ann Source #

prettyList :: [TypeBase Rank u] -> Doc ann Source #

class (Monoid a, Eq a, Ord a) => ArrayShape a where Source #

A class encompassing types containing array shape information.

Methods

shapeRank :: a -> Int Source #

Return the rank of an array with the given size.

subShapeOf :: a -> a -> Bool Source #

Check whether one shape if a subset of another shape.

data Space Source #

The memory space of a block. If DefaultSpace, this is the "default" space, whatever that is. The exact meaning of the SpaceId depends on the backend used. In GPU kernels, for example, this is used to distinguish between constant, global and shared memory spaces. In GPU-enabled host code, it is used to distinguish between host memory (DefaultSpace) and GPU space.

Constructors

DefaultSpace 
Space SpaceId 
ScalarSpace [SubExp] PrimType

A special kind of memory that is a statically sized array of some primitive type. Used for private memory on GPUs.

Instances

Instances details
Show Space Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

FreeIn Space Source # 
Instance details

Defined in Futhark.IR.Prop.Names

Methods

freeIn' :: Space -> FV Source #

Simplifiable Space Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Engine

Eq Space Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

(==) :: Space -> Space -> Bool Source #

(/=) :: Space -> Space -> Bool Source #

Ord Space Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Pretty Space Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Space -> Doc ann Source #

prettyList :: [Space] -> Doc ann Source #

data TypeBase shape u Source #

The type of a value. When comparing types for equality with ==, shapes must match.

Constructors

Prim PrimType 
Acc VName Shape [Type] u

Token, index space, element type, and uniqueness.

Array PrimType shape u 
Mem Space 

Instances

Instances details
Bifoldable TypeBase Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

bifold :: Monoid m => TypeBase m m -> m Source #

bifoldMap :: Monoid m => (a -> m) -> (b -> m) -> TypeBase a b -> m Source #

bifoldr :: (a -> c -> c) -> (b -> c -> c) -> c -> TypeBase a b -> c Source #

bifoldl :: (c -> a -> c) -> (c -> b -> c) -> c -> TypeBase a b -> c Source #

Bifunctor TypeBase Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

bimap :: (a -> b) -> (c -> d) -> TypeBase a c -> TypeBase b d Source #

first :: (a -> b) -> TypeBase a c -> TypeBase b c Source #

second :: (b -> c) -> TypeBase a b -> TypeBase a c Source #

Bitraversable TypeBase Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

bitraverse :: Applicative f => (a -> f c) -> (b -> f d) -> TypeBase a b -> f (TypeBase c d) Source #

DeclExtTyped DeclExtType Source # 
Instance details

Defined in Futhark.IR.Prop.Types

DeclTyped DeclType Source # 
Instance details

Defined in Futhark.IR.Prop.Types

ExtTyped DeclExtType Source # 
Instance details

Defined in Futhark.IR.Prop.Types

ExtTyped ExtType Source # 
Instance details

Defined in Futhark.IR.Prop.Types

Typed DeclType Source # 
Instance details

Defined in Futhark.IR.Prop.Types

Methods

typeOf :: DeclType -> Type Source #

Typed Type Source # 
Instance details

Defined in Futhark.IR.Prop.Types

Methods

typeOf :: Type -> Type Source #

IsBodyType ExtType Source # 
Instance details

Defined in Futhark.IR.RetType

IsRetType DeclExtType Source # 
Instance details

Defined in Futhark.IR.RetType

Foldable (TypeBase shape) Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

fold :: Monoid m => TypeBase shape m -> m Source #

foldMap :: Monoid m => (a -> m) -> TypeBase shape a -> m Source #

foldMap' :: Monoid m => (a -> m) -> TypeBase shape a -> m Source #

foldr :: (a -> b -> b) -> b -> TypeBase shape a -> b Source #

foldr' :: (a -> b -> b) -> b -> TypeBase shape a -> b Source #

foldl :: (b -> a -> b) -> b -> TypeBase shape a -> b Source #

foldl' :: (b -> a -> b) -> b -> TypeBase shape a -> b Source #

foldr1 :: (a -> a -> a) -> TypeBase shape a -> a Source #

foldl1 :: (a -> a -> a) -> TypeBase shape a -> a Source #

toList :: TypeBase shape a -> [a] Source #

null :: TypeBase shape a -> Bool Source #

length :: TypeBase shape a -> Int Source #

elem :: Eq a => a -> TypeBase shape a -> Bool Source #

maximum :: Ord a => TypeBase shape a -> a Source #

minimum :: Ord a => TypeBase shape a -> a Source #

sum :: Num a => TypeBase shape a -> a Source #

product :: Num a => TypeBase shape a -> a Source #

Traversable (TypeBase shape) Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

traverse :: Applicative f => (a -> f b) -> TypeBase shape a -> f (TypeBase shape b) Source #

sequenceA :: Applicative f => TypeBase shape (f a) -> f (TypeBase shape a) Source #

mapM :: Monad m => (a -> m b) -> TypeBase shape a -> m (TypeBase shape b) Source #

sequence :: Monad m => TypeBase shape (m a) -> m (TypeBase shape a) Source #

Functor (TypeBase shape) Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

fmap :: (a -> b) -> TypeBase shape a -> TypeBase shape b Source #

(<$) :: a -> TypeBase shape b -> TypeBase shape a Source #

(Show shape, Show u) => Show (TypeBase shape u) Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

showsPrec :: Int -> TypeBase shape u -> ShowS Source #

show :: TypeBase shape u -> String Source #

showList :: [TypeBase shape u] -> ShowS Source #

FreeIn shape => FreeIn (TypeBase shape u) Source # 
Instance details

Defined in Futhark.IR.Prop.Names

Methods

freeIn' :: TypeBase shape u -> FV Source #

(FixExt shape, ArrayShape shape) => FixExt (TypeBase shape u) Source # 
Instance details

Defined in Futhark.IR.Prop.Types

Methods

fixExt :: Int -> SubExp -> TypeBase shape u -> TypeBase shape u Source #

mapExt :: (Int -> Int) -> TypeBase shape u -> TypeBase shape u Source #

Simplifiable shape => Simplifiable (TypeBase shape u) Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Engine

Methods

simplify :: SimplifiableRep rep => TypeBase shape u -> SimpleM rep (TypeBase shape u) Source #

Rename shape => Rename (TypeBase shape u) Source # 
Instance details

Defined in Futhark.Transform.Rename

Methods

rename :: TypeBase shape u -> RenameM (TypeBase shape u) Source #

Substitute shape => Substitute (TypeBase shape u) Source # 
Instance details

Defined in Futhark.Transform.Substitute

Methods

substituteNames :: Map VName VName -> TypeBase shape u -> TypeBase shape u Source #

(Eq shape, Eq u) => Eq (TypeBase shape u) Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

(==) :: TypeBase shape u -> TypeBase shape u -> Bool Source #

(/=) :: TypeBase shape u -> TypeBase shape u -> Bool Source #

(Ord shape, Ord u) => Ord (TypeBase shape u) Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

compare :: TypeBase shape u -> TypeBase shape u -> Ordering Source #

(<) :: TypeBase shape u -> TypeBase shape u -> Bool Source #

(<=) :: TypeBase shape u -> TypeBase shape u -> Bool Source #

(>) :: TypeBase shape u -> TypeBase shape u -> Bool Source #

(>=) :: TypeBase shape u -> TypeBase shape u -> Bool Source #

max :: TypeBase shape u -> TypeBase shape u -> TypeBase shape u Source #

min :: TypeBase shape u -> TypeBase shape u -> TypeBase shape u Source #

Pretty u => Pretty (TypeBase ExtShape u) Source # 
Instance details

Defined in Futhark.IR.Pretty

Pretty u => Pretty (TypeBase Rank u) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: TypeBase Rank u -> Doc ann Source #

prettyList :: [TypeBase Rank u] -> Doc ann Source #

Pretty u => Pretty (TypeBase Shape u) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: TypeBase Shape u -> Doc ann Source #

prettyList :: [TypeBase Shape u] -> Doc ann Source #

data Diet Source #

Information about which parts of a value/type are consumed. For example, we might say that a function taking three arguments of types ([int], *[int], [int]) has diet [Observe, Consume, Observe].

Constructors

Consume

Consumes this value.

Observe

Only observes value in this position, does not consume. A result may alias this.

ObservePrim

As Observe, but the result will not alias, because the parameter does not carry aliases.

Instances

Instances details
Show Diet Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Eq Diet Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

(==) :: Diet -> Diet -> Bool Source #

(/=) :: Diet -> Diet -> Bool Source #

Ord Diet Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Abstract syntax tree

data Ident Source #

An identifier consists of its name and the type of the value bound to the identifier.

Constructors

Ident 

Fields

Instances

Instances details
Show Ident Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

FreeIn Ident Source # 
Instance details

Defined in Futhark.IR.Prop.Names

Methods

freeIn' :: Ident -> FV Source #

Typed Ident Source # 
Instance details

Defined in Futhark.IR.Prop.Types

Methods

typeOf :: Ident -> Type Source #

Rename Ident Source # 
Instance details

Defined in Futhark.Transform.Rename

Substitute Ident Source # 
Instance details

Defined in Futhark.Transform.Substitute

Eq Ident Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

(==) :: Ident -> Ident -> Bool Source #

(/=) :: Ident -> Ident -> Bool Source #

Ord Ident Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Pretty Ident Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Ident -> Doc ann Source #

prettyList :: [Ident] -> Doc ann Source #

data SubExp Source #

A subexpression is either a scalar constant or a variable. One important property is that evaluation of a subexpression is guaranteed to complete in constant time.

Constructors

Constant PrimValue 
Var VName 

Instances

Instances details
Show SubExp Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

ToExp SubExp Source # 
Instance details

Defined in Futhark.CodeGen.ImpGen

Methods

toExp :: SubExp -> ImpM rep r op Exp Source #

toExp' :: PrimType -> SubExp -> Exp Source #

ToExp SubExp Source # 
Instance details

Defined in Futhark.Construct

Methods

toExp :: MonadBuilder m => SubExp -> m (Exp (Rep m)) Source #

HasLetDecMem LetDecMem Source # 
Instance details

Defined in Futhark.IR.Mem

FreeIn SubExp Source # 
Instance details

Defined in Futhark.IR.Prop.Names

Methods

freeIn' :: SubExp -> FV Source #

DeclExtTyped DeclExtType Source # 
Instance details

Defined in Futhark.IR.Prop.Types

DeclTyped DeclType Source # 
Instance details

Defined in Futhark.IR.Prop.Types

ExtTyped DeclExtType Source # 
Instance details

Defined in Futhark.IR.Prop.Types

ExtTyped ExtType Source # 
Instance details

Defined in Futhark.IR.Prop.Types

FixExt ExtSize Source # 
Instance details

Defined in Futhark.IR.Prop.Types

Typed DeclType Source # 
Instance details

Defined in Futhark.IR.Prop.Types

Methods

typeOf :: DeclType -> Type Source #

Typed Type Source # 
Instance details

Defined in Futhark.IR.Prop.Types

Methods

typeOf :: Type -> Type Source #

IsBodyType BodyReturns Source # 
Instance details

Defined in Futhark.IR.Mem

IsBodyType ExtType Source # 
Instance details

Defined in Futhark.IR.RetType

IsRetType FunReturns Source # 
Instance details

Defined in Futhark.IR.Mem

IsRetType DeclExtType Source # 
Instance details

Defined in Futhark.IR.RetType

Simplifiable ExtSize Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Engine

Simplifiable SubExp Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Engine

Rename ExtSize Source # 
Instance details

Defined in Futhark.Transform.Rename

Rename SubExp Source # 
Instance details

Defined in Futhark.Transform.Rename

Substitute SubExp Source # 
Instance details

Defined in Futhark.Transform.Substitute

Eq SubExp Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Ord SubExp Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

ToExp SubExp Source # 
Instance details

Defined in Futhark.CodeGen.Backends.SimpleRep

Methods

toExp :: SubExp -> SrcLoc -> Exp Source #

Pretty ExtShape Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: ExtShape -> Doc ann Source #

prettyList :: [ExtShape] -> Doc ann Source #

Pretty Shape Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Shape -> Doc ann Source #

prettyList :: [Shape] -> Doc ann Source #

Pretty SubExp Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: SubExp -> Doc ann Source #

prettyList :: [SubExp] -> Doc ann Source #

ArrayShape (ShapeBase ExtSize) Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

ArrayShape (ShapeBase SubExp) Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Simplifiable [FunReturns] Source # 
Instance details

Defined in Futhark.IR.Mem

Pretty u => Pretty (TypeBase ExtShape u) Source # 
Instance details

Defined in Futhark.IR.Pretty

Pretty u => Pretty (TypeBase Shape u) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: TypeBase Shape u -> Doc ann Source #

prettyList :: [TypeBase Shape u] -> Doc ann Source #

FixExt ret => DeclExtTyped (MemInfo ExtSize Uniqueness ret) Source # 
Instance details

Defined in Futhark.IR.Mem

DeclTyped (MemInfo SubExp Uniqueness ret) Source # 
Instance details

Defined in Futhark.IR.Mem

FixExt ret => ExtTyped (MemInfo ExtSize NoUniqueness ret) Source # 
Instance details

Defined in Futhark.IR.Mem

FixExt ret => ExtTyped (MemInfo ExtSize Uniqueness ret) Source # 
Instance details

Defined in Futhark.IR.Mem

FixExt ret => FixExt (MemInfo ExtSize u ret) Source # 
Instance details

Defined in Futhark.IR.Mem

Methods

fixExt :: Int -> SubExp -> MemInfo ExtSize u ret -> MemInfo ExtSize u ret Source #

mapExt :: (Int -> Int) -> MemInfo ExtSize u ret -> MemInfo ExtSize u ret Source #

Typed (MemInfo SubExp NoUniqueness ret) Source # 
Instance details

Defined in Futhark.IR.Mem

Typed (MemInfo SubExp Uniqueness ret) Source # 
Instance details

Defined in Futhark.IR.Mem

data PatElem dec Source #

An element of a pattern - consisting of a name and an addditional parametric decoration. This decoration is what is expected to contain the type of the resulting variable.

Constructors

PatElem 

Fields

Instances

Instances details
Foldable PatElem Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

fold :: Monoid m => PatElem m -> m Source #

foldMap :: Monoid m => (a -> m) -> PatElem a -> m Source #

foldMap' :: Monoid m => (a -> m) -> PatElem a -> m Source #

foldr :: (a -> b -> b) -> b -> PatElem a -> b Source #

foldr' :: (a -> b -> b) -> b -> PatElem a -> b Source #

foldl :: (b -> a -> b) -> b -> PatElem a -> b Source #

foldl' :: (b -> a -> b) -> b -> PatElem a -> b Source #

foldr1 :: (a -> a -> a) -> PatElem a -> a Source #

foldl1 :: (a -> a -> a) -> PatElem a -> a Source #

toList :: PatElem a -> [a] Source #

null :: PatElem a -> Bool Source #

length :: PatElem a -> Int Source #

elem :: Eq a => a -> PatElem a -> Bool Source #

maximum :: Ord a => PatElem a -> a Source #

minimum :: Ord a => PatElem a -> a Source #

sum :: Num a => PatElem a -> a Source #

product :: Num a => PatElem a -> a Source #

Traversable PatElem Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

traverse :: Applicative f => (a -> f b) -> PatElem a -> f (PatElem b) Source #

sequenceA :: Applicative f => PatElem (f a) -> f (PatElem a) Source #

mapM :: Monad m => (a -> m b) -> PatElem a -> m (PatElem b) Source #

sequence :: Monad m => PatElem (m a) -> m (PatElem a) Source #

Functor PatElem Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

fmap :: (a -> b) -> PatElem a -> PatElem b Source #

(<$) :: a -> PatElem b -> PatElem a Source #

Show dec => Show (PatElem dec) Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

showsPrec :: Int -> PatElem dec -> ShowS Source #

show :: PatElem dec -> String Source #

showList :: [PatElem dec] -> ShowS Source #

AliasesOf dec => AliasesOf (PatElem dec) Source # 
Instance details

Defined in Futhark.IR.Prop.Aliases

Methods

aliasesOf :: PatElem dec -> Names Source #

FreeIn dec => FreeIn (PatElem dec) Source # 
Instance details

Defined in Futhark.IR.Prop.Names

Methods

freeIn' :: PatElem dec -> FV Source #

Typed dec => Typed (PatElem dec) Source # 
Instance details

Defined in Futhark.IR.Prop.Types

Methods

typeOf :: PatElem dec -> Type Source #

Rename dec => Rename (PatElem dec) Source # 
Instance details

Defined in Futhark.Transform.Rename

Methods

rename :: PatElem dec -> RenameM (PatElem dec) Source #

Substitute dec => Substitute (PatElem dec) Source # 
Instance details

Defined in Futhark.Transform.Substitute

Eq dec => Eq (PatElem dec) Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

(==) :: PatElem dec -> PatElem dec -> Bool Source #

(/=) :: PatElem dec -> PatElem dec -> Bool Source #

Ord dec => Ord (PatElem dec) Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

compare :: PatElem dec -> PatElem dec -> Ordering Source #

(<) :: PatElem dec -> PatElem dec -> Bool Source #

(<=) :: PatElem dec -> PatElem dec -> Bool Source #

(>) :: PatElem dec -> PatElem dec -> Bool Source #

(>=) :: PatElem dec -> PatElem dec -> Bool Source #

max :: PatElem dec -> PatElem dec -> PatElem dec Source #

min :: PatElem dec -> PatElem dec -> PatElem dec Source #

Pretty t => Pretty (PatElem t) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: PatElem t -> Doc ann Source #

prettyList :: [PatElem t] -> Doc ann Source #

newtype Pat dec Source #

A pattern is conceptually just a list of names and their types.

Constructors

Pat 

Fields

Instances

Instances details
Foldable Pat Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

fold :: Monoid m => Pat m -> m Source #

foldMap :: Monoid m => (a -> m) -> Pat a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Pat a -> m Source #

foldr :: (a -> b -> b) -> b -> Pat a -> b Source #

foldr' :: (a -> b -> b) -> b -> Pat a -> b Source #

foldl :: (b -> a -> b) -> b -> Pat a -> b Source #

foldl' :: (b -> a -> b) -> b -> Pat a -> b Source #

foldr1 :: (a -> a -> a) -> Pat a -> a Source #

foldl1 :: (a -> a -> a) -> Pat a -> a Source #

toList :: Pat a -> [a] Source #

null :: Pat a -> Bool Source #

length :: Pat a -> Int Source #

elem :: Eq a => a -> Pat a -> Bool Source #

maximum :: Ord a => Pat a -> a Source #

minimum :: Ord a => Pat a -> a Source #

sum :: Num a => Pat a -> a Source #

product :: Num a => Pat a -> a Source #

Traversable Pat Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

traverse :: Applicative f => (a -> f b) -> Pat a -> f (Pat b) Source #

sequenceA :: Applicative f => Pat (f a) -> f (Pat a) Source #

mapM :: Monad m => (a -> m b) -> Pat a -> m (Pat b) Source #

sequence :: Monad m => Pat (m a) -> m (Pat a) Source #

Functor Pat Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

fmap :: (a -> b) -> Pat a -> Pat b Source #

(<$) :: a -> Pat b -> Pat a Source #

Monoid (Pat dec) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

mempty :: Pat dec Source #

mappend :: Pat dec -> Pat dec -> Pat dec Source #

mconcat :: [Pat dec] -> Pat dec Source #

Semigroup (Pat dec) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

(<>) :: Pat dec -> Pat dec -> Pat dec Source #

sconcat :: NonEmpty (Pat dec) -> Pat dec Source #

stimes :: Integral b => b -> Pat dec -> Pat dec Source #

Show dec => Show (Pat dec) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

showsPrec :: Int -> Pat dec -> ShowS Source #

show :: Pat dec -> String Source #

showList :: [Pat dec] -> ShowS Source #

FreeIn dec => FreeIn (Pat dec) Source # 
Instance details

Defined in Futhark.IR.Prop.Names

Methods

freeIn' :: Pat dec -> FV Source #

Rename dec => Rename (Pat dec) Source # 
Instance details

Defined in Futhark.Transform.Rename

Methods

rename :: Pat dec -> RenameM (Pat dec) Source #

Substitute dec => Substitute (Pat dec) Source # 
Instance details

Defined in Futhark.Transform.Substitute

Methods

substituteNames :: Map VName VName -> Pat dec -> Pat dec Source #

Eq dec => Eq (Pat dec) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

(==) :: Pat dec -> Pat dec -> Bool Source #

(/=) :: Pat dec -> Pat dec -> Bool Source #

Ord dec => Ord (Pat dec) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

compare :: Pat dec -> Pat dec -> Ordering Source #

(<) :: Pat dec -> Pat dec -> Bool Source #

(<=) :: Pat dec -> Pat dec -> Bool Source #

(>) :: Pat dec -> Pat dec -> Bool Source #

(>=) :: Pat dec -> Pat dec -> Bool Source #

max :: Pat dec -> Pat dec -> Pat dec Source #

min :: Pat dec -> Pat dec -> Pat dec Source #

Pretty t => Pretty (Pat t) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Pat t -> Doc ann Source #

prettyList :: [Pat t] -> Doc ann Source #

data StmAux dec Source #

Auxilliary Information associated with a statement.

Constructors

StmAux 

Fields

Instances

Instances details
Semigroup dec => Semigroup (StmAux dec) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

(<>) :: StmAux dec -> StmAux dec -> StmAux dec Source #

sconcat :: NonEmpty (StmAux dec) -> StmAux dec Source #

stimes :: Integral b => b -> StmAux dec -> StmAux dec Source #

Show dec => Show (StmAux dec) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

showsPrec :: Int -> StmAux dec -> ShowS Source #

show :: StmAux dec -> String Source #

showList :: [StmAux dec] -> ShowS Source #

FreeIn dec => FreeIn (StmAux dec) Source # 
Instance details

Defined in Futhark.IR.Prop.Names

Methods

freeIn' :: StmAux dec -> FV Source #

Rename dec => Rename (StmAux dec) Source # 
Instance details

Defined in Futhark.Transform.Rename

Methods

rename :: StmAux dec -> RenameM (StmAux dec) Source #

Substitute dec => Substitute (StmAux dec) Source # 
Instance details

Defined in Futhark.Transform.Substitute

Eq dec => Eq (StmAux dec) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

(==) :: StmAux dec -> StmAux dec -> Bool Source #

(/=) :: StmAux dec -> StmAux dec -> Bool Source #

Ord dec => Ord (StmAux dec) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

compare :: StmAux dec -> StmAux dec -> Ordering Source #

(<) :: StmAux dec -> StmAux dec -> Bool Source #

(<=) :: StmAux dec -> StmAux dec -> Bool Source #

(>) :: StmAux dec -> StmAux dec -> Bool Source #

(>=) :: StmAux dec -> StmAux dec -> Bool Source #

max :: StmAux dec -> StmAux dec -> StmAux dec Source #

min :: StmAux dec -> StmAux dec -> StmAux dec Source #

data Stm rep Source #

A local variable binding.

Constructors

Let 

Fields

Instances

Instances details
Scoped rep (Stm rep) Source # 
Instance details

Defined in Futhark.IR.Prop.Scope

Methods

scopeOf :: Stm rep -> Scope rep Source #

Scoped rep (Stms rep) Source # 
Instance details

Defined in Futhark.IR.Prop.Scope

Methods

scopeOf :: Stms rep -> Scope rep Source #

RepTypes rep => Show (Stm rep) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

showsPrec :: Int -> Stm rep -> ShowS Source #

show :: Stm rep -> String Source #

showList :: [Stm rep] -> ShowS Source #

(FreeDec (ExpDec rep), FreeDec (BodyDec rep), FreeIn (FParamInfo rep), FreeIn (LParamInfo rep), FreeIn (LetDec rep), FreeIn (RetType rep), FreeIn (BranchType rep), FreeIn (Op rep)) => FreeIn (Stm rep) Source # 
Instance details

Defined in Futhark.IR.Prop.Names

Methods

freeIn' :: Stm rep -> FV Source #

FreeIn (Stm rep) => FreeIn (Stms rep) Source # 
Instance details

Defined in Futhark.IR.Prop.Names

Methods

freeIn' :: Stms rep -> FV Source #

Renameable rep => Rename (Stm rep) Source # 
Instance details

Defined in Futhark.Transform.Rename

Methods

rename :: Stm rep -> RenameM (Stm rep) Source #

Substitutable rep => Substitute (Stm rep) Source # 
Instance details

Defined in Futhark.Transform.Substitute

Methods

substituteNames :: Map VName VName -> Stm rep -> Stm rep Source #

Substitute (Stm rep) => Substitute (Stms rep) Source # 
Instance details

Defined in Futhark.Transform.Substitute

Methods

substituteNames :: Map VName VName -> Stms rep -> Stms rep Source #

RepTypes rep => Eq (Stm rep) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

(==) :: Stm rep -> Stm rep -> Bool Source #

(/=) :: Stm rep -> Stm rep -> Bool Source #

RepTypes rep => Ord (Stm rep) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

compare :: Stm rep -> Stm rep -> Ordering Source #

(<) :: Stm rep -> Stm rep -> Bool Source #

(<=) :: Stm rep -> Stm rep -> Bool Source #

(>) :: Stm rep -> Stm rep -> Bool Source #

(>=) :: Stm rep -> Stm rep -> Bool Source #

max :: Stm rep -> Stm rep -> Stm rep Source #

min :: Stm rep -> Stm rep -> Stm rep Source #

PrettyRep rep => Pretty (Stm rep) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Stm rep -> Doc ann Source #

prettyList :: [Stm rep] -> Doc ann Source #

PrettyRep rep => Pretty (Stms rep) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Stms rep -> Doc ann Source #

prettyList :: [Stms rep] -> Doc ann Source #

type Stms rep = Seq (Stm rep) Source #

A sequence of statements.

data SubExpRes Source #

A pairing of a subexpression and some certificates.

Constructors

SubExpRes 

Instances

Instances details
Show SubExpRes Source # 
Instance details

Defined in Futhark.IR.Syntax

FreeIn SubExpRes Source # 
Instance details

Defined in Futhark.IR.Prop.Names

Methods

freeIn' :: SubExpRes -> FV Source #

Simplifiable SubExpRes Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Engine

Rename SubExpRes Source # 
Instance details

Defined in Futhark.Transform.Rename

Substitute SubExpRes Source # 
Instance details

Defined in Futhark.Transform.Substitute

Eq SubExpRes Source # 
Instance details

Defined in Futhark.IR.Syntax

Ord SubExpRes Source # 
Instance details

Defined in Futhark.IR.Syntax

Pretty SubExpRes Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: SubExpRes -> Doc ann Source #

prettyList :: [SubExpRes] -> Doc ann Source #

type Result = [SubExpRes] Source #

The result of a body is a sequence of subexpressions.

data Body rep Source #

A body consists of a sequence of statements, terminating in a list of result values.

Constructors

Body 

Fields

Instances

Instances details
RepTypes rep => Show (Body rep) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

showsPrec :: Int -> Body rep -> ShowS Source #

show :: Body rep -> String Source #

showList :: [Body rep] -> ShowS Source #

(FreeDec (ExpDec rep), FreeDec (BodyDec rep), FreeIn (FParamInfo rep), FreeIn (LParamInfo rep), FreeIn (LetDec rep), FreeIn (RetType rep), FreeIn (BranchType rep), FreeIn (Op rep)) => FreeIn (Body rep) Source # 
Instance details

Defined in Futhark.IR.Prop.Names

Methods

freeIn' :: Body rep -> FV Source #

Renameable rep => Rename (Body rep) Source # 
Instance details

Defined in Futhark.Transform.Rename

Methods

rename :: Body rep -> RenameM (Body rep) Source #

Substitutable rep => Substitute (Body rep) Source # 
Instance details

Defined in Futhark.Transform.Substitute

Methods

substituteNames :: Map VName VName -> Body rep -> Body rep Source #

RepTypes rep => Eq (Body rep) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

(==) :: Body rep -> Body rep -> Bool Source #

(/=) :: Body rep -> Body rep -> Bool Source #

RepTypes rep => Ord (Body rep) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

compare :: Body rep -> Body rep -> Ordering Source #

(<) :: Body rep -> Body rep -> Bool Source #

(<=) :: Body rep -> Body rep -> Bool Source #

(>) :: Body rep -> Body rep -> Bool Source #

(>=) :: Body rep -> Body rep -> Bool Source #

max :: Body rep -> Body rep -> Body rep Source #

min :: Body rep -> Body rep -> Body rep Source #

PrettyRep rep => Pretty (Body rep) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Body rep -> Doc ann Source #

prettyList :: [Body rep] -> Doc ann Source #

PrettyRep rep => Pretty (Case (Body rep)) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Case (Body rep) -> Doc ann Source #

prettyList :: [Case (Body rep)] -> Doc ann Source #

data BasicOp Source #

A primitive operation that returns something of known size and does not itself contain any bindings.

Constructors

SubExp SubExp

A variable or constant.

Opaque OpaqueOp SubExp

Semantically and operationally just identity, but is invisible/impenetrable to optimisations (hopefully). This partially a hack to avoid optimisation (so, to work around compiler limitations), but is also used to implement tracing and other operations that are semantically invisible, but have some sort of effect (brrr).

ArrayLit [SubExp] Type

Array literals, e.g., [ [1+x, 3], [2, 1+4] ]. Second arg is the element type of the rows of the array.

UnOp UnOp SubExp

Unary operation.

BinOp BinOp SubExp SubExp

Binary operation.

CmpOp CmpOp SubExp SubExp

Comparison - result type is always boolean.

ConvOp ConvOp SubExp

Conversion "casting".

Assert SubExp (ErrorMsg SubExp) (SrcLoc, [SrcLoc])

Turn a boolean into a certificate, halting the program with the given error message if the boolean is false.

Index VName (Slice SubExp)

The certificates for bounds-checking are part of the Stm.

Update Safety VName (Slice SubExp) SubExp

An in-place update of the given array at the given position. Consumes the array. If Safe, perform a run-time bounds check and ignore the write if out of bounds (like Scatter).

FlatIndex VName (FlatSlice SubExp) 
FlatUpdate VName (FlatSlice SubExp) VName 
Concat Int (NonEmpty VName) SubExp
concat(0, [1] :| [[2, 3, 4], [5, 6]], 6) = [1, 2, 3, 4, 5, 6]

Concatenates the non-empty list of VName resulting in an array of length SubExp. The Int argument is used to specify the dimension along which the arrays are concatenated. For instance:

concat(1, [[1,2], [3, 4]] :| [[[5,6]], [[7, 8]]], 4) = [[1, 2, 5, 6], [3, 4, 7, 8]]
Manifest [Int] VName

Manifest an array with dimensions represented in the given order. The result will not alias anything.

Iota SubExp SubExp SubExp IntType

iota(n, x, s) = [x,x+s,..,x+(n-1)*s].

The IntType indicates the type of the array returned and the offset/stride arguments, but not the length argument.

Replicate Shape SubExp

replicate([3][2],1) = [[1,1], [1,1], [1,1]]. The result has no aliases. Copy a value by passing an empty shape.

Scratch PrimType [SubExp]

Create array of given type and shape, with undefined elements.

Reshape ReshapeKind Shape VName

1st arg is the new shape, 2nd arg is the input array.

Rearrange [Int] VName

Permute the dimensions of the input array. The list of integers is a list of dimensions (0-indexed), which must be a permutation of [0,n-1], where n is the number of dimensions in the input array.

UpdateAcc VName [SubExp] [SubExp]

Update an accumulator at the given index with the given value. Consumes the accumulator and produces a new one.

Instances

Instances details
Show BasicOp Source # 
Instance details

Defined in Futhark.IR.Syntax

Eq BasicOp Source # 
Instance details

Defined in Futhark.IR.Syntax

Ord BasicOp Source # 
Instance details

Defined in Futhark.IR.Syntax

Pretty BasicOp Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: BasicOp -> Doc ann Source #

prettyList :: [BasicOp] -> Doc ann Source #

data UnOp Source #

Various unary operators. It is a bit ad-hoc what is a unary operator and what is a built-in function. Perhaps these should all go away eventually.

Constructors

Not

E.g., ! True == False.

Complement IntType

E.g., ~(~1) = 1.

Abs IntType

abs(-2) = 2.

FAbs FloatType

fabs(-2.0) = 2.0.

SSignum IntType

Signed sign function: ssignum(-2) = -1.

USignum IntType

Unsigned sign function: usignum(2) = 1.

FSignum FloatType

Floating-point sign function.

Instances

Instances details
Show UnOp Source # 
Instance details

Defined in Language.Futhark.Primitive

Eq UnOp Source # 
Instance details

Defined in Language.Futhark.Primitive

Methods

(==) :: UnOp -> UnOp -> Bool Source #

(/=) :: UnOp -> UnOp -> Bool Source #

Ord UnOp Source # 
Instance details

Defined in Language.Futhark.Primitive

Pretty UnOp Source # 
Instance details

Defined in Language.Futhark.Primitive

Methods

pretty :: UnOp -> Doc ann Source #

prettyList :: [UnOp] -> Doc ann Source #

data BinOp Source #

Binary operators. These correspond closely to the binary operators in LLVM. Most are parametrised by their expected input and output types.

Constructors

Add IntType Overflow

Integer addition.

FAdd FloatType

Floating-point addition.

Sub IntType Overflow

Integer subtraction.

FSub FloatType

Floating-point subtraction.

Mul IntType Overflow

Integer multiplication.

FMul FloatType

Floating-point multiplication.

UDiv IntType Safety

Unsigned integer division. Rounds towards negativity infinity. Note: this is different from LLVM.

UDivUp IntType Safety

Unsigned integer division. Rounds towards positive infinity.

SDiv IntType Safety

Signed integer division. Rounds towards negativity infinity. Note: this is different from LLVM.

SDivUp IntType Safety

Signed integer division. Rounds towards positive infinity.

FDiv FloatType

Floating-point division.

FMod FloatType

Floating-point modulus.

UMod IntType Safety

Unsigned integer modulus; the countepart to UDiv.

SMod IntType Safety

Signed integer modulus; the countepart to SDiv.

SQuot IntType Safety

Signed integer division. Rounds towards zero. This corresponds to the sdiv instruction in LLVM and integer division in C.

SRem IntType Safety

Signed integer division. Rounds towards zero. This corresponds to the srem instruction in LLVM and integer modulo in C.

SMin IntType

Returns the smallest of two signed integers.

UMin IntType

Returns the smallest of two unsigned integers.

FMin FloatType

Returns the smallest of two floating-point numbers.

SMax IntType

Returns the greatest of two signed integers.

UMax IntType

Returns the greatest of two unsigned integers.

FMax FloatType

Returns the greatest of two floating-point numbers.

Shl IntType

Left-shift.

LShr IntType

Logical right-shift, zero-extended.

AShr IntType

Arithmetic right-shift, sign-extended.

And IntType

Bitwise and.

Or IntType

Bitwise or.

Xor IntType

Bitwise exclusive-or.

Pow IntType

Integer exponentiation.

FPow FloatType

Floating-point exponentiation.

LogAnd

Boolean and - not short-circuiting.

LogOr

Boolean or - not short-circuiting.

Instances

Instances details
Show BinOp Source # 
Instance details

Defined in Language.Futhark.Primitive

Eq BinOp Source # 
Instance details

Defined in Language.Futhark.Primitive

Methods

(==) :: BinOp -> BinOp -> Bool Source #

(/=) :: BinOp -> BinOp -> Bool Source #

Ord BinOp Source # 
Instance details

Defined in Language.Futhark.Primitive

Pretty BinOp Source # 
Instance details

Defined in Language.Futhark.Primitive

Methods

pretty :: BinOp -> Doc ann Source #

prettyList :: [BinOp] -> Doc ann Source #

data CmpOp Source #

Comparison operators are like BinOps, but they always return a boolean value. The somewhat ugly constructor names are straight out of LLVM.

Constructors

CmpEq PrimType

All types equality.

CmpUlt IntType

Unsigned less than.

CmpUle IntType

Unsigned less than or equal.

CmpSlt IntType

Signed less than.

CmpSle IntType

Signed less than or equal.

FCmpLt FloatType

Floating-point less than.

FCmpLe FloatType

Floating-point less than or equal.

CmpLlt

Boolean less than.

CmpLle

Boolean less than or equal.

Instances

Instances details
Show CmpOp Source # 
Instance details

Defined in Language.Futhark.Primitive

Eq CmpOp Source # 
Instance details

Defined in Language.Futhark.Primitive

Methods

(==) :: CmpOp -> CmpOp -> Bool Source #

(/=) :: CmpOp -> CmpOp -> Bool Source #

Ord CmpOp Source # 
Instance details

Defined in Language.Futhark.Primitive

Pretty CmpOp Source # 
Instance details

Defined in Language.Futhark.Primitive

Methods

pretty :: CmpOp -> Doc ann Source #

prettyList :: [CmpOp] -> Doc ann Source #

data ConvOp Source #

Conversion operators try to generalise the from t0 x to t1 instructions from LLVM.

Constructors

ZExt IntType IntType

Zero-extend the former integer type to the latter. If the new type is smaller, the result is a truncation.

SExt IntType IntType

Sign-extend the former integer type to the latter. If the new type is smaller, the result is a truncation.

FPConv FloatType FloatType

Convert value of the former floating-point type to the latter. If the new type is smaller, the result is a truncation.

FPToUI FloatType IntType

Convert a floating-point value to the nearest unsigned integer (rounding towards zero).

FPToSI FloatType IntType

Convert a floating-point value to the nearest signed integer (rounding towards zero).

UIToFP IntType FloatType

Convert an unsigned integer to a floating-point value.

SIToFP IntType FloatType

Convert a signed integer to a floating-point value.

IToB IntType

Convert an integer to a boolean value. Zero becomes false; anything else is true.

BToI IntType

Convert a boolean to an integer. True is converted to 1 and False to 0.

FToB FloatType

Convert a float to a boolean value. Zero becomes false; | anything else is true.

BToF FloatType

Convert a boolean to a float. True is converted to 1 and False to 0.

Instances

Instances details
Show ConvOp Source # 
Instance details

Defined in Language.Futhark.Primitive

Eq ConvOp Source # 
Instance details

Defined in Language.Futhark.Primitive

Ord ConvOp Source # 
Instance details

Defined in Language.Futhark.Primitive

Pretty ConvOp Source # 
Instance details

Defined in Language.Futhark.Primitive

Methods

pretty :: ConvOp -> Doc ann Source #

prettyList :: [ConvOp] -> Doc ann Source #

data OpaqueOp Source #

Apart from being Opaque, what else is going on here?

Constructors

OpaqueNil

No special operation.

OpaqueTrace Text

Print the argument, prefixed by this string.

data ReshapeKind Source #

Which kind of reshape is this?

Constructors

ReshapeCoerce

New shape is dynamically same as original.

ReshapeArbitrary

Any kind of reshaping.

type WithAccInput rep = (Shape, [VName], Maybe (Lambda rep, [SubExp])) Source #

The input to a WithAcc construct. Comprises the index space of the accumulator, the underlying arrays, and possibly a combining function.

data Exp rep Source #

The root Futhark expression type. The Op constructor contains a rep-specific operation. Do-loops, branches and function calls are special. Everything else is a simple BasicOp.

Constructors

BasicOp BasicOp

A simple (non-recursive) operation.

Apply Name [(SubExp, Diet)] [(RetType rep, RetAls)] (Safety, SrcLoc, [SrcLoc]) 
Match [SubExp] [Case (Body rep)] (Body rep) (MatchDec (BranchType rep))

A match statement picks a branch by comparing the given subexpressions (called the scrutinee) with the pattern in each of the cases. If none of the cases match, the /default body/ is picked.

Loop [(FParam rep, SubExp)] LoopForm (Body rep)

loop {a} = {v} (for i < n|while b) do b.

WithAcc [WithAccInput rep] (Lambda rep)

Create accumulators backed by the given arrays (which are consumed) and pass them to the lambda, which must return the updated accumulators and possibly some extra values. The accumulators are turned back into arrays. The Shape is the write index space. The corresponding arrays must all have this shape outermost. This construct is not part of BasicOp because we need the rep parameter.

Op (Op rep) 

Instances

Instances details
RepTypes rep => Show (Exp rep) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

showsPrec :: Int -> Exp rep -> ShowS Source #

show :: Exp rep -> String Source #

showList :: [Exp rep] -> ShowS Source #

(FreeDec (ExpDec rep), FreeDec (BodyDec rep), FreeIn (FParamInfo rep), FreeIn (LParamInfo rep), FreeIn (LetDec rep), FreeIn (RetType rep), FreeIn (BranchType rep), FreeIn (Op rep)) => FreeIn (Exp rep) Source # 
Instance details

Defined in Futhark.IR.Prop.Names

Methods

freeIn' :: Exp rep -> FV Source #

Renameable rep => Rename (Exp rep) Source # 
Instance details

Defined in Futhark.Transform.Rename

Methods

rename :: Exp rep -> RenameM (Exp rep) Source #

Substitutable rep => Substitute (Exp rep) Source # 
Instance details

Defined in Futhark.Transform.Substitute

Methods

substituteNames :: Map VName VName -> Exp rep -> Exp rep Source #

RepTypes rep => Eq (Exp rep) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

(==) :: Exp rep -> Exp rep -> Bool Source #

(/=) :: Exp rep -> Exp rep -> Bool Source #

RepTypes rep => Ord (Exp rep) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

compare :: Exp rep -> Exp rep -> Ordering Source #

(<) :: Exp rep -> Exp rep -> Bool Source #

(<=) :: Exp rep -> Exp rep -> Bool Source #

(>) :: Exp rep -> Exp rep -> Bool Source #

(>=) :: Exp rep -> Exp rep -> Bool Source #

max :: Exp rep -> Exp rep -> Exp rep Source #

min :: Exp rep -> Exp rep -> Exp rep Source #

PrettyRep rep => Pretty (Exp rep) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Exp rep -> Doc ann Source #

prettyList :: [Exp rep] -> Doc ann Source #

data Case body Source #

A non-default case in a Match statement. The number of elements in the pattern must match the number of scrutinees. A Nothing value indicates that we don't care about it (i.e. a wildcard).

Constructors

Case 

Fields

Instances

Instances details
Foldable Case Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

fold :: Monoid m => Case m -> m Source #

foldMap :: Monoid m => (a -> m) -> Case a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Case a -> m Source #

foldr :: (a -> b -> b) -> b -> Case a -> b Source #

foldr' :: (a -> b -> b) -> b -> Case a -> b Source #

foldl :: (b -> a -> b) -> b -> Case a -> b Source #

foldl' :: (b -> a -> b) -> b -> Case a -> b Source #

foldr1 :: (a -> a -> a) -> Case a -> a Source #

foldl1 :: (a -> a -> a) -> Case a -> a Source #

toList :: Case a -> [a] Source #

null :: Case a -> Bool Source #

length :: Case a -> Int Source #

elem :: Eq a => a -> Case a -> Bool Source #

maximum :: Ord a => Case a -> a Source #

minimum :: Ord a => Case a -> a Source #

sum :: Num a => Case a -> a Source #

product :: Num a => Case a -> a Source #

Traversable Case Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

traverse :: Applicative f => (a -> f b) -> Case a -> f (Case b) Source #

sequenceA :: Applicative f => Case (f a) -> f (Case a) Source #

mapM :: Monad m => (a -> m b) -> Case a -> m (Case b) Source #

sequence :: Monad m => Case (m a) -> m (Case a) Source #

Functor Case Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

fmap :: (a -> b) -> Case a -> Case b Source #

(<$) :: a -> Case b -> Case a Source #

Show body => Show (Case body) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

showsPrec :: Int -> Case body -> ShowS Source #

show :: Case body -> String Source #

showList :: [Case body] -> ShowS Source #

FreeIn body => FreeIn (Case body) Source # 
Instance details

Defined in Futhark.IR.Prop.Names

Methods

freeIn' :: Case body -> FV Source #

Eq body => Eq (Case body) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

(==) :: Case body -> Case body -> Bool Source #

(/=) :: Case body -> Case body -> Bool Source #

Ord body => Ord (Case body) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

compare :: Case body -> Case body -> Ordering Source #

(<) :: Case body -> Case body -> Bool Source #

(<=) :: Case body -> Case body -> Bool Source #

(>) :: Case body -> Case body -> Bool Source #

(>=) :: Case body -> Case body -> Bool Source #

max :: Case body -> Case body -> Case body Source #

min :: Case body -> Case body -> Case body Source #

PrettyRep rep => Pretty (Case (Body rep)) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Case (Body rep) -> Doc ann Source #

prettyList :: [Case (Body rep)] -> Doc ann Source #

data LoopForm Source #

For-loop or while-loop?

Constructors

ForLoop 

Fields

  • VName

    The loop iterator var

  • IntType

    The type of the loop iterator var

  • SubExp

    The number of iterations.

WhileLoop VName 

data MatchDec rt Source #

Data associated with a branch.

Constructors

MatchDec 

Fields

Instances

Instances details
Show rt => Show (MatchDec rt) Source # 
Instance details

Defined in Futhark.IR.Syntax

FreeIn a => FreeIn (MatchDec a) Source # 
Instance details

Defined in Futhark.IR.Prop.Names

Methods

freeIn' :: MatchDec a -> FV Source #

Eq rt => Eq (MatchDec rt) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

(==) :: MatchDec rt -> MatchDec rt -> Bool Source #

(/=) :: MatchDec rt -> MatchDec rt -> Bool Source #

Ord rt => Ord (MatchDec rt) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

compare :: MatchDec rt -> MatchDec rt -> Ordering Source #

(<) :: MatchDec rt -> MatchDec rt -> Bool Source #

(<=) :: MatchDec rt -> MatchDec rt -> Bool Source #

(>) :: MatchDec rt -> MatchDec rt -> Bool Source #

(>=) :: MatchDec rt -> MatchDec rt -> Bool Source #

max :: MatchDec rt -> MatchDec rt -> MatchDec rt Source #

min :: MatchDec rt -> MatchDec rt -> MatchDec rt Source #

data MatchSort Source #

What kind of branch is this? This has no semantic meaning, but provides hints to simplifications.

Constructors

MatchNormal

An ordinary branch.

MatchFallback

A branch where the "true" case is what we are actually interested in, and the "false" case is only present as a fallback for when the true case cannot be safely evaluated. The compiler is permitted to optimise away the branch if the true case contains only safe statements.

MatchEquiv

Both of these branches are semantically equivalent, and it is fine to eliminate one if it turns out to have problems (e.g. contain things we cannot generate code for).

data Safety Source #

Whether something is safe or unsafe (mostly function calls, and in the context of whether operations are dynamically checked). When we inline an Unsafe function, we remove all safety checks in its body. The Ord instance picks Unsafe as being less than Safe.

For operations like integer division, a safe division will not explode the computer in case of division by zero, but instead return some unspecified value. This always involves a run-time check, so generally the unsafe variant is what the compiler will insert, but guarded by an explicit assertion elsewhere. Safe operations are useful when the optimiser wants to move e.g. a division to a location where the divisor may be zero, but where the result will only be used when it is non-zero (so it doesn't matter what result is provided with a zero divisor, as long as the program keeps running).

Constructors

Unsafe 
Safe 

Instances

Instances details
Show Safety Source # 
Instance details

Defined in Language.Futhark.Primitive

Eq Safety Source # 
Instance details

Defined in Language.Futhark.Primitive

Ord Safety Source # 
Instance details

Defined in Language.Futhark.Primitive

data Lambda rep Source #

Anonymous function for use in a SOAC.

Constructors

Lambda 

Fields

Instances

Instances details
Scoped rep (Lambda rep) Source # 
Instance details

Defined in Futhark.IR.Prop.Scope

Methods

scopeOf :: Lambda rep -> Scope rep Source #

RepTypes rep => Show (Lambda rep) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

showsPrec :: Int -> Lambda rep -> ShowS Source #

show :: Lambda rep -> String Source #

showList :: [Lambda rep] -> ShowS Source #

(FreeDec (ExpDec rep), FreeDec (BodyDec rep), FreeIn (FParamInfo rep), FreeIn (LParamInfo rep), FreeIn (LetDec rep), FreeIn (RetType rep), FreeIn (BranchType rep), FreeIn (Op rep)) => FreeIn (Lambda rep) Source # 
Instance details

Defined in Futhark.IR.Prop.Names

Methods

freeIn' :: Lambda rep -> FV Source #

Renameable rep => Rename (Lambda rep) Source # 
Instance details

Defined in Futhark.Transform.Rename

Methods

rename :: Lambda rep -> RenameM (Lambda rep) Source #

Substitutable rep => Substitute (Lambda rep) Source # 
Instance details

Defined in Futhark.Transform.Substitute

RepTypes rep => Eq (Lambda rep) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

(==) :: Lambda rep -> Lambda rep -> Bool Source #

(/=) :: Lambda rep -> Lambda rep -> Bool Source #

RepTypes rep => Ord (Lambda rep) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

compare :: Lambda rep -> Lambda rep -> Ordering Source #

(<) :: Lambda rep -> Lambda rep -> Bool Source #

(<=) :: Lambda rep -> Lambda rep -> Bool Source #

(>) :: Lambda rep -> Lambda rep -> Bool Source #

(>=) :: Lambda rep -> Lambda rep -> Bool Source #

max :: Lambda rep -> Lambda rep -> Lambda rep Source #

min :: Lambda rep -> Lambda rep -> Lambda rep Source #

PrettyRep rep => Pretty (Lambda rep) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Lambda rep -> Doc ann Source #

prettyList :: [Lambda rep] -> Doc ann Source #

data RetAls Source #

Information about the possible aliases of a function result.

Constructors

RetAls 

Fields

  • paramAls :: [Int]

    Which of the parameters may be aliased, numbered from zero.

  • otherAls :: [Int]

    Which of the other results may be aliased, numbered from zero. This must be a reflexive relation.

Instances

Instances details
Monoid RetAls Source # 
Instance details

Defined in Futhark.IR.Syntax

Semigroup RetAls Source # 
Instance details

Defined in Futhark.IR.Syntax

Show RetAls Source # 
Instance details

Defined in Futhark.IR.Syntax

Eq RetAls Source # 
Instance details

Defined in Futhark.IR.Syntax

Ord RetAls Source # 
Instance details

Defined in Futhark.IR.Syntax

Definitions

data Param dec Source #

A function or lambda parameter.

Constructors

Param 

Fields

Instances

Instances details
Foldable Param Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

fold :: Monoid m => Param m -> m Source #

foldMap :: Monoid m => (a -> m) -> Param a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Param a -> m Source #

foldr :: (a -> b -> b) -> b -> Param a -> b Source #

foldr' :: (a -> b -> b) -> b -> Param a -> b Source #

foldl :: (b -> a -> b) -> b -> Param a -> b Source #

foldl' :: (b -> a -> b) -> b -> Param a -> b Source #

foldr1 :: (a -> a -> a) -> Param a -> a Source #

foldl1 :: (a -> a -> a) -> Param a -> a Source #

toList :: Param a -> [a] Source #

null :: Param a -> Bool Source #

length :: Param a -> Int Source #

elem :: Eq a => a -> Param a -> Bool Source #

maximum :: Ord a => Param a -> a Source #

minimum :: Ord a => Param a -> a Source #

sum :: Num a => Param a -> a Source #

product :: Num a => Param a -> a Source #

Traversable Param Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

traverse :: Applicative f => (a -> f b) -> Param a -> f (Param b) Source #

sequenceA :: Applicative f => Param (f a) -> f (Param a) Source #

mapM :: Monad m => (a -> m b) -> Param a -> m (Param b) Source #

sequence :: Monad m => Param (m a) -> m (Param a) Source #

Functor Param Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

fmap :: (a -> b) -> Param a -> Param b Source #

(<$) :: a -> Param b -> Param a Source #

Show dec => Show (Param dec) Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

showsPrec :: Int -> Param dec -> ShowS Source #

show :: Param dec -> String Source #

showList :: [Param dec] -> ShowS Source #

FreeIn dec => FreeIn (Param dec) Source # 
Instance details

Defined in Futhark.IR.Prop.Names

Methods

freeIn' :: Param dec -> FV Source #

DeclTyped dec => DeclTyped (Param dec) Source # 
Instance details

Defined in Futhark.IR.Prop.Types

Methods

declTypeOf :: Param dec -> DeclType Source #

Typed dec => Typed (Param dec) Source # 
Instance details

Defined in Futhark.IR.Prop.Types

Methods

typeOf :: Param dec -> Type Source #

Rename dec => Rename (Param dec) Source # 
Instance details

Defined in Futhark.Transform.Rename

Methods

rename :: Param dec -> RenameM (Param dec) Source #

Substitute dec => Substitute (Param dec) Source # 
Instance details

Defined in Futhark.Transform.Substitute

Methods

substituteNames :: Map VName VName -> Param dec -> Param dec Source #

Eq dec => Eq (Param dec) Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

(==) :: Param dec -> Param dec -> Bool Source #

(/=) :: Param dec -> Param dec -> Bool Source #

Ord dec => Ord (Param dec) Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

compare :: Param dec -> Param dec -> Ordering Source #

(<) :: Param dec -> Param dec -> Bool Source #

(<=) :: Param dec -> Param dec -> Bool Source #

(>) :: Param dec -> Param dec -> Bool Source #

(>=) :: Param dec -> Param dec -> Bool Source #

max :: Param dec -> Param dec -> Param dec Source #

min :: Param dec -> Param dec -> Param dec Source #

Pretty t => Pretty (Param t) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Param t -> Doc ann Source #

prettyList :: [Param t] -> Doc ann Source #

type FParam rep = Param (FParamInfo rep) Source #

A function and loop parameter.

type LParam rep = Param (LParamInfo rep) Source #

A lambda parameter.

data FunDef rep Source #

Function definitions.

Constructors

FunDef 

Fields

Instances

Instances details
Scoped rep (FunDef rep) Source # 
Instance details

Defined in Futhark.IR.Prop.Scope

Methods

scopeOf :: FunDef rep -> Scope rep Source #

RepTypes rep => Show (FunDef rep) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

showsPrec :: Int -> FunDef rep -> ShowS Source #

show :: FunDef rep -> String Source #

showList :: [FunDef rep] -> ShowS Source #

(FreeDec (ExpDec rep), FreeDec (BodyDec rep), FreeIn (FParamInfo rep), FreeIn (LParamInfo rep), FreeIn (LetDec rep), FreeIn (RetType rep), FreeIn (BranchType rep), FreeIn (Op rep)) => FreeIn (FunDef rep) Source # 
Instance details

Defined in Futhark.IR.Prop.Names

Methods

freeIn' :: FunDef rep -> FV Source #

Renameable rep => Rename (FunDef rep) Source # 
Instance details

Defined in Futhark.Transform.Rename

Methods

rename :: FunDef rep -> RenameM (FunDef rep) Source #

RepTypes rep => Eq (FunDef rep) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

(==) :: FunDef rep -> FunDef rep -> Bool Source #

(/=) :: FunDef rep -> FunDef rep -> Bool Source #

RepTypes rep => Ord (FunDef rep) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

compare :: FunDef rep -> FunDef rep -> Ordering Source #

(<) :: FunDef rep -> FunDef rep -> Bool Source #

(<=) :: FunDef rep -> FunDef rep -> Bool Source #

(>) :: FunDef rep -> FunDef rep -> Bool Source #

(>=) :: FunDef rep -> FunDef rep -> Bool Source #

max :: FunDef rep -> FunDef rep -> FunDef rep Source #

min :: FunDef rep -> FunDef rep -> FunDef rep Source #

PrettyRep rep => Pretty (FunDef rep) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: FunDef rep -> Doc ann Source #

prettyList :: [FunDef rep] -> Doc ann Source #

data EntryParam Source #

An entry point parameter, comprising its name and original type.

type EntryPoint = (Name, [EntryParam], [EntryResult]) Source #

Information about the inputs and outputs (return value) of an entry point.

data Prog rep Source #

An entire Futhark program.

Constructors

Prog 

Fields

  • progTypes :: OpaqueTypes

    The opaque types used in entry points. This information is used to generate extra API functions for construction and deconstruction of values of these types.

  • progConsts :: Stms rep

    Top-level constants that are computed at program startup, and which are in scope inside all functions.

  • progFuns :: [FunDef rep]

    The functions comprising the program. All functions are also available in scope in the definitions of the constants, so be careful not to introduce circular dependencies (not currently checked).

Instances

Instances details
RepTypes rep => Show (Prog rep) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

showsPrec :: Int -> Prog rep -> ShowS Source #

show :: Prog rep -> String Source #

showList :: [Prog rep] -> ShowS Source #

RepTypes rep => Eq (Prog rep) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

(==) :: Prog rep -> Prog rep -> Bool Source #

(/=) :: Prog rep -> Prog rep -> Bool Source #

RepTypes rep => Ord (Prog rep) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

compare :: Prog rep -> Prog rep -> Ordering Source #

(<) :: Prog rep -> Prog rep -> Bool Source #

(<=) :: Prog rep -> Prog rep -> Bool Source #

(>) :: Prog rep -> Prog rep -> Bool Source #

(>=) :: Prog rep -> Prog rep -> Bool Source #

max :: Prog rep -> Prog rep -> Prog rep Source #

min :: Prog rep -> Prog rep -> Prog rep Source #

PrettyRep rep => Pretty (Prog rep) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Prog rep -> Doc ann Source #

prettyList :: [Prog rep] -> Doc ann Source #

Utils

oneStm :: Stm rep -> Stms rep Source #

A single statement.

stmsFromList :: [Stm rep] -> Stms rep Source #

Convert a statement list to a statement sequence.

stmsToList :: Stms rep -> [Stm rep] Source #

Convert a statement sequence to a statement list.

stmsHead :: Stms rep -> Maybe (Stm rep, Stms rep) Source #

The first statement in the sequence, if any.

stmsLast :: Stms lore -> Maybe (Stms lore, Stm lore) Source #

The last statement in the sequence, if any.

subExpRes :: SubExp -> SubExpRes Source #

Construct a SubExpRes with no certificates.

subExpsRes :: [SubExp] -> Result Source #

Construct a Result from subexpressions.

varRes :: VName -> SubExpRes Source #

Construct a SubExpRes from a variable name.

varsRes :: [VName] -> Result Source #

Construct a Result from variable names.

subExpResVName :: SubExpRes -> Maybe VName Source #

The VName of a SubExpRes, if it exists.