futhark-0.22.1: 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

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

Prettyprint a value, wrapped to 80 characters.

prettyTuple :: Pretty a => [a] -> String 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

pprName :: v -> Doc Source #

Instances

Instances details
IsName Name Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pprName :: Name -> Doc Source #

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

Methods

pprName :: VName -> Doc Source #

prettyName :: IsName v => v -> String Source #

Prettyprint a name to a string.

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 Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

unAnnot :: NoInfo a -> Maybe a Source #

Orphan instances

Pretty Liftedness Source # 
Instance details

Pretty PatLit Source # 
Instance details

Methods

ppr :: PatLit -> Doc #

pprPrec :: Int -> PatLit -> Doc #

pprList :: [PatLit] -> Doc #

Pretty PrimValue Source # 
Instance details

Methods

ppr :: PrimValue -> Doc #

pprPrec :: Int -> PrimValue -> Doc #

pprList :: [PrimValue] -> Doc #

Pretty Size Source # 
Instance details

Methods

ppr :: Size -> Doc #

pprPrec :: Int -> Size -> Doc #

pprList :: [Size] -> Doc #

Pretty Value Source # 
Instance details

Methods

ppr :: Value -> Doc #

pprPrec :: Int -> Value -> Doc #

pprList :: [Value] -> Doc #

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

Methods

ppr :: AttrAtom vn -> Doc #

pprPrec :: Int -> AttrAtom vn -> Doc #

pprList :: [AttrAtom vn] -> Doc #

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

Methods

ppr :: AttrInfo vn -> Doc #

pprPrec :: Int -> AttrInfo vn -> Doc #

pprList :: [AttrInfo vn] -> Doc #

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

Methods

ppr :: QualName vn -> Doc #

pprPrec :: Int -> QualName vn -> Doc #

pprList :: [QualName vn] -> Doc #

Pretty (Shape Int64) Source # 
Instance details

Methods

ppr :: Shape Int64 -> Doc #

pprPrec :: Int -> Shape Int64 -> Doc #

pprList :: [Shape Int64] -> Doc #

Pretty (Shape Size) Source # 
Instance details

Methods

ppr :: Shape Size -> Doc #

pprPrec :: Int -> Shape Size -> Doc #

pprList :: [Shape Size] -> Doc #

Pretty (Shape ()) Source # 
Instance details

Methods

ppr :: Shape () -> Doc #

pprPrec :: Int -> Shape () -> Doc #

pprList :: [Shape ()] -> Doc #

Pretty (Shape Bool) Source # 
Instance details

Methods

ppr :: Shape Bool -> Doc #

pprPrec :: Int -> Shape Bool -> Doc #

pprList :: [Shape Bool] -> Doc #

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

Methods

ppr :: SizeBinder vn -> Doc #

pprPrec :: Int -> SizeBinder vn -> Doc #

pprList :: [SizeBinder vn] -> Doc #

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

Methods

ppr :: SizeExp vn -> Doc #

pprPrec :: Int -> SizeExp vn -> Doc #

pprList :: [SizeExp vn] -> Doc #

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

Methods

ppr :: TypeArg dim -> Doc #

pprPrec :: Int -> TypeArg dim -> Doc #

pprList :: [TypeArg dim] -> Doc #

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

Methods

ppr :: TypeArgExp vn -> Doc #

pprPrec :: Int -> TypeArgExp vn -> Doc #

pprList :: [TypeArgExp vn] -> Doc #

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

Methods

ppr :: TypeExp vn -> Doc #

pprPrec :: Int -> TypeExp vn -> Doc #

pprList :: [TypeExp vn] -> Doc #

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

Methods

ppr :: TypeParamBase vn -> Doc #

pprPrec :: Int -> TypeParamBase vn -> Doc #

pprList :: [TypeParamBase vn] -> Doc #

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

Methods

ppr :: AppExpBase f vn -> Doc #

pprPrec :: Int -> AppExpBase f vn -> Doc #

pprList :: [AppExpBase f vn] -> Doc #

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

Methods

ppr :: CaseBase f vn -> Doc #

pprPrec :: Int -> CaseBase f vn -> Doc #

pprList :: [CaseBase f vn] -> Doc #

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

Methods

ppr :: DecBase f vn -> Doc #

pprPrec :: Int -> DecBase f vn -> Doc #

pprList :: [DecBase f vn] -> Doc #

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

Methods

ppr :: DimIndexBase f vn -> Doc #

pprPrec :: Int -> DimIndexBase f vn -> Doc #

pprList :: [DimIndexBase f vn] -> Doc #

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

Methods

ppr :: ExpBase f vn -> Doc #

pprPrec :: Int -> ExpBase f vn -> Doc #

pprList :: [ExpBase f vn] -> Doc #

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

Methods

ppr :: FieldBase f vn -> Doc #

pprPrec :: Int -> FieldBase f vn -> Doc #

pprList :: [FieldBase f vn] -> Doc #

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

Methods

ppr :: IdentBase f vn -> Doc #

pprPrec :: Int -> IdentBase f vn -> Doc #

pprList :: [IdentBase f vn] -> Doc #

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

Methods

ppr :: LoopFormBase f vn -> Doc #

pprPrec :: Int -> LoopFormBase f vn -> Doc #

pprList :: [LoopFormBase f vn] -> Doc #

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

Methods

ppr :: ModBindBase f vn -> Doc #

pprPrec :: Int -> ModBindBase f vn -> Doc #

pprList :: [ModBindBase f vn] -> Doc #

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

Methods

ppr :: ModExpBase f vn -> Doc #

pprPrec :: Int -> ModExpBase f vn -> Doc #

pprList :: [ModExpBase f vn] -> Doc #

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

Methods

ppr :: ModParamBase f vn -> Doc #

pprPrec :: Int -> ModParamBase f vn -> Doc #

pprList :: [ModParamBase f vn] -> Doc #

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

Methods

ppr :: PatBase f vn -> Doc #

pprPrec :: Int -> PatBase f vn -> Doc #

pprList :: [PatBase f vn] -> Doc #

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

Methods

ppr :: ProgBase f vn -> Doc #

pprPrec :: Int -> ProgBase f vn -> Doc #

pprList :: [ProgBase f vn] -> Doc #

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

Methods

ppr :: RetTypeBase dim as -> Doc #

pprPrec :: Int -> RetTypeBase dim as -> Doc #

pprList :: [RetTypeBase dim as] -> Doc #

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

Methods

ppr :: ScalarTypeBase dim as -> Doc #

pprPrec :: Int -> ScalarTypeBase dim as -> Doc #

pprList :: [ScalarTypeBase dim as] -> Doc #

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

Methods

ppr :: SigBindBase f vn -> Doc #

pprPrec :: Int -> SigBindBase f vn -> Doc #

pprList :: [SigBindBase f vn] -> Doc #

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

Methods

ppr :: SigExpBase f vn -> Doc #

pprPrec :: Int -> SigExpBase f vn -> Doc #

pprList :: [SigExpBase f vn] -> Doc #

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

Methods

ppr :: SpecBase f vn -> Doc #

pprPrec :: Int -> SpecBase f vn -> Doc #

pprList :: [SpecBase f vn] -> Doc #

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

Methods

ppr :: TypeBase dim as -> Doc #

pprPrec :: Int -> TypeBase dim as -> Doc #

pprList :: [TypeBase dim as] -> Doc #

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

Methods

ppr :: TypeBindBase f vn -> Doc #

pprPrec :: Int -> TypeBindBase f vn -> Doc #

pprList :: [TypeBindBase f vn] -> Doc #

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

Methods

ppr :: ValBindBase f vn -> Doc #

pprPrec :: Int -> ValBindBase f vn -> Doc #

pprList :: [ValBindBase f vn] -> Doc #