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

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

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

Prettyprint name as string. Only use this for debugging.

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

Methods

pretty :: Diet -> Doc ann #

prettyList :: [Diet] -> Doc ann #

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 #

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 #

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

Methods

pretty :: SizeExp d -> Doc ann #

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

Pretty (TypeArg Size) Source # 
Instance details

Methods

pretty :: TypeArg Size -> Doc ann #

prettyList :: [TypeArg Size] -> 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 #

(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 (ModTypeBindBase f vn) Source # 
Instance details

Methods

pretty :: ModTypeBindBase f vn -> Doc ann #

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

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

Methods

pretty :: ModTypeExpBase f vn -> Doc ann #

prettyList :: [ModTypeExpBase 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 u) => Pretty (RetTypeBase dim u) Source # 
Instance details

Methods

pretty :: RetTypeBase dim u -> Doc ann #

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

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

Methods

pretty :: ScalarTypeBase dim u -> Doc ann #

prettyList :: [ScalarTypeBase dim u] -> 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 d, IsName vn) => Pretty (TypeArgExp d vn) Source # 
Instance details

Methods

pretty :: TypeArgExp d vn -> Doc ann #

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

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

Methods

pretty :: TypeBase dim u -> Doc ann #

prettyList :: [TypeBase dim u] -> 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 #

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

Methods

pretty :: TypeExp d vn -> Doc ann #

prettyList :: [TypeExp d 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 #

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

Methods

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

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

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

Methods

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

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