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

Language.Futhark.Pretty

Description

Futhark prettyprinter. This module defines Pretty instances for the AST defined in Language.Futhark.Syntax.

Synopsis

Documentation

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

Prettyprint a value to a String, appropriately wrapped.

prettyTuple :: Pretty a => [a] -> Text Source #

Prettyprint a list enclosed in curly braces.

leadingOperator :: Name -> BinOp Source #

Given an operator name, return the operator that determines its syntactical properties.

class IsName v where Source #

A class for types that are variable names in the Futhark source language. This is used instead of a mere Pretty instance because in the compiler frontend we want to print VNames differently depending on whether the FUTHARK_COMPILER_DEBUGGING environment variable is set, yet in the backend we want to always print VNames with the tag. To avoid erroneously using the Pretty instance for VNames, we in fact only define it inside the modules for the core language (as an orphan instance).

Methods

prettyName :: v -> Doc a Source #

toName :: v -> Name Source #

Instances

Instances details
IsName Name Source # 
Instance details

Defined in Language.Futhark.Pretty

IsName VName Source #

Depending on the environment variable FUTHARK_COMPILER_DEBUGGING, VNames are printed as either the name with an internal tag, or just the base name.

Instance details

Defined in Language.Futhark.Pretty

class Annot f where Source #

Class for type constructors that represent annotations. Used in the prettyprinter to either print the original AST, or the computed decoration.

Methods

unAnnot :: f a -> Maybe a Source #

Extract value, if any.

Instances

Instances details
Annot Info Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

unAnnot :: Info a -> Maybe a Source #

Annot (NoInfo :: Type -> Type) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

unAnnot :: NoInfo a -> Maybe a Source #

Orphan instances

Pretty Liftedness Source # 
Instance details

Methods

pretty :: Liftedness -> Doc ann #

prettyList :: [Liftedness] -> Doc ann #

Pretty PatLit Source # 
Instance details

Methods

pretty :: PatLit -> Doc ann #

prettyList :: [PatLit] -> Doc ann #

Pretty PrimValue Source # 
Instance details

Methods

pretty :: PrimValue -> Doc ann #

prettyList :: [PrimValue] -> Doc ann #

Pretty Size Source # 
Instance details

Methods

pretty :: Size -> Doc ann #

prettyList :: [Size] -> Doc ann #

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

Methods

pretty :: QualName vn -> Doc ann #

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

Pretty (Shape Int64) Source # 
Instance details

Methods

pretty :: Shape Int64 -> Doc ann #

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

Pretty (Shape Size) Source # 
Instance details

Methods

pretty :: Shape Size -> Doc ann #

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

Pretty (Shape ()) Source # 
Instance details

Methods

pretty :: Shape () -> Doc ann #

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

Pretty (Shape Bool) Source # 
Instance details

Methods

pretty :: Shape Bool -> Doc ann #

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

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

Methods

pretty :: SizeBinder vn -> Doc ann #

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

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

Methods

pretty :: SizeExp vn -> Doc ann #

prettyList :: [SizeExp vn] -> Doc ann #

Pretty (Shape dim) => Pretty (TypeArg dim) Source # 
Instance details

Methods

pretty :: TypeArg dim -> Doc ann #

prettyList :: [TypeArg dim] -> Doc ann #

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

Methods

pretty :: TypeArgExp vn -> Doc ann #

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

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

Methods

pretty :: TypeExp vn -> Doc ann #

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

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

Methods

pretty :: TypeParamBase vn -> Doc ann #

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

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

Methods

pretty :: AppExpBase f vn -> Doc ann #

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

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

Methods

pretty :: AttrAtom vn -> Doc ann #

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

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

Methods

pretty :: AttrInfo vn -> Doc ann #

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

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

Methods

pretty :: CaseBase f vn -> Doc ann #

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

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

Methods

pretty :: DecBase f vn -> Doc ann #

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

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

Methods

pretty :: DimIndexBase f vn -> Doc ann #

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

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

Methods

pretty :: ExpBase f vn -> Doc ann #

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

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

Methods

pretty :: FieldBase f vn -> Doc ann #

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

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

Methods

pretty :: IdentBase f vn -> Doc ann #

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

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

Methods

pretty :: LoopFormBase f vn -> Doc ann #

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

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

Methods

pretty :: ModBindBase f vn -> Doc ann #

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

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

Methods

pretty :: ModExpBase f vn -> Doc ann #

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

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

Methods

pretty :: ModParamBase f vn -> Doc ann #

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

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

Methods

pretty :: PatBase f vn -> Doc ann #

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

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

Methods

pretty :: ProgBase f vn -> Doc ann #

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

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

Methods

pretty :: RetTypeBase dim as -> Doc ann #

prettyList :: [RetTypeBase dim as] -> Doc ann #

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

Methods

pretty :: ScalarTypeBase dim as -> Doc ann #

prettyList :: [ScalarTypeBase dim as] -> Doc ann #

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

Methods

pretty :: SigBindBase f vn -> Doc ann #

prettyList :: [SigBindBase f vn] -> Doc ann #

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

Methods

pretty :: SigExpBase f vn -> Doc ann #

prettyList :: [SigExpBase f vn] -> Doc ann #

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

Methods

pretty :: SpecBase f vn -> Doc ann #

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

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

Methods

pretty :: TypeBase dim as -> Doc ann #

prettyList :: [TypeBase dim as] -> Doc ann #

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

Methods

pretty :: TypeBindBase f vn -> Doc ann #

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

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

Methods

pretty :: ValBindBase f vn -> Doc ann #

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