futhark-0.15.5: An optimising compiler for a functional, array-oriented language.
Safe HaskellNone
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 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 #

IsName Name Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pprName :: Name -> Doc Source #

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 attribute.

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

Methods

ppr :: Value -> Doc

pprPrec :: Int -> Value -> Doc

pprList :: [Value] -> Doc

Pretty PrimValue Source # 
Instance details

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

Methods

ppr :: TypeParamBase vn -> Doc

pprPrec :: Int -> TypeParamBase vn -> Doc

pprList :: [TypeParamBase vn] -> Doc

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

Methods

ppr :: QualName vn -> Doc

pprPrec :: Int -> QualName vn -> Doc

pprList :: [QualName vn] -> 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

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

Methods

ppr :: DimExp vn -> Doc

pprPrec :: Int -> DimExp vn -> Doc

pprList :: [DimExp vn] -> Doc

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

Methods

ppr :: TypeArg dim -> Doc

pprPrec :: Int -> TypeArg dim -> Doc

pprList :: [TypeArg dim] -> Doc

Pretty (ShapeDecl Bool) Source # 
Instance details

Pretty (ShapeDecl Int32) Source # 
Instance details

Pretty (ShapeDecl ()) Source # 
Instance details

Methods

ppr :: ShapeDecl () -> Doc

pprPrec :: Int -> ShapeDecl () -> Doc

pprList :: [ShapeDecl ()] -> Doc

IsName vn => Pretty (ShapeDecl (DimDecl vn)) Source # 
Instance details

Methods

ppr :: ShapeDecl (DimDecl vn) -> Doc

pprPrec :: Int -> ShapeDecl (DimDecl vn) -> Doc

pprList :: [ShapeDecl (DimDecl vn)] -> Doc

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

Methods

ppr :: DimDecl vn -> Doc

pprPrec :: Int -> DimDecl vn -> Doc

pprList :: [DimDecl 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

(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 (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 (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 (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

(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

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

Methods

ppr :: PatternBase f vn -> Doc

pprPrec :: Int -> PatternBase f vn -> Doc

pprList :: [PatternBase 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 (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 (FieldBase f vn) Source # 
Instance details

Methods

ppr :: FieldBase f vn -> Doc

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

pprList :: [FieldBase 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 (DimIndexBase f vn) Source # 
Instance details

Methods

ppr :: DimIndexBase f vn -> Doc

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

pprList :: [DimIndexBase 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 (TypeDeclBase f vn) Source # 
Instance details

Methods

ppr :: TypeDeclBase f vn -> Doc

pprPrec :: Int -> TypeDeclBase f vn -> Doc

pprList :: [TypeDeclBase f vn] -> Doc

Pretty (ShapeDecl 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

Pretty (ShapeDecl 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