futhark-0.25.27: An optimising compiler for a functional, array-oriented language.

Safe Haskell | Safe-Inferred
Language | GHC2021

Language.Futhark.Pretty

Contents

- Orphan instances

Description

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

Synopsis

- prettyString :: Pretty a => a -> String
- prettyTuple :: Pretty a => [a] -> Text
- leadingOperator :: Name -> BinOp
- class IsName v where
  - prettyName :: v -> Doc a
  - toName :: v -> Name
- prettyNameString :: IsName v => v -> String
- class Annot f where
  - unAnnot :: f a -> Maybe a

# 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 Methods prettyName :: Name -> Doc a Source # toName :: Name -> Name 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 prettyName :: VName -> Doc a Source # toName :: VName -> Name Source #

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 Source # prettyList :: [Diet] -> Doc ann Source #
Pretty Liftedness Source # |
Instance details Methods pretty :: Liftedness -> Doc ann Source # prettyList :: [Liftedness] -> Doc ann Source #
Pretty PatLit Source # |
Instance details Methods pretty :: PatLit -> Doc ann Source # prettyList :: [PatLit] -> Doc ann Source #
Pretty PrimValue Source # |
Instance details Methods pretty :: PrimValue -> Doc ann Source # prettyList :: [PrimValue] -> Doc ann Source #
IsName vn => Pretty (QualName vn) Source # |
Instance details Methods pretty :: QualName vn -> Doc ann Source # prettyList :: [QualName vn] -> Doc ann Source #
Pretty (Shape Int64) Source # |
Instance details Methods pretty :: Shape Int64 -> Doc ann Source # prettyList :: [Shape Int64] -> Doc ann Source #
Pretty (Shape Size) Source # |
Instance details Methods pretty :: Shape Size -> Doc ann Source # prettyList :: [Shape Size] -> Doc ann Source #
Pretty (Shape ()) Source # |
Instance details Methods pretty :: Shape () -> Doc ann Source # prettyList :: [Shape ()] -> Doc ann Source #
Pretty (Shape Bool) Source # |
Instance details Methods pretty :: Shape Bool -> Doc ann Source # prettyList :: [Shape Bool] -> Doc ann Source #
IsName vn => Pretty (SizeBinder vn) Source # |
Instance details Methods pretty :: SizeBinder vn -> Doc ann Source # prettyList :: [SizeBinder vn] -> Doc ann Source #
Pretty d => Pretty (SizeExp d) Source # |
Instance details Methods pretty :: SizeExp d -> Doc ann Source # prettyList :: [SizeExp d] -> Doc ann Source #
Pretty (TypeArg Size) Source # |
Instance details Methods pretty :: TypeArg Size -> Doc ann Source # prettyList :: [TypeArg Size] -> Doc ann Source #
(Eq vn, IsName vn) => Pretty (TypeParamBase vn) Source # |
Instance details Methods pretty :: TypeParamBase vn -> Doc ann Source # prettyList :: [TypeParamBase vn] -> Doc ann Source #
(Eq vn, IsName vn, Annot f) => Pretty (AppExpBase f vn) Source # |
Instance details Methods pretty :: AppExpBase f vn -> Doc ann Source # prettyList :: [AppExpBase f vn] -> Doc ann Source #
IsName vn => Pretty (AttrAtom vn) Source # |
Instance details Methods pretty :: AttrAtom vn -> Doc ann Source # prettyList :: [AttrAtom vn] -> Doc ann Source #
IsName vn => Pretty (AttrInfo vn) Source # |
Instance details 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 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 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 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 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 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 Methods pretty :: LoopFormBase f vn -> Doc ann Source # prettyList :: [LoopFormBase f vn] -> Doc ann Source #
(Eq vn, IsName vn, Annot f) => Pretty (LoopInitBase f vn) Source # |
Instance details Methods pretty :: LoopInitBase f vn -> Doc ann Source # prettyList :: [LoopInitBase f vn] -> Doc ann Source #
(Eq vn, IsName vn, Annot f) => Pretty (ModBindBase f vn) Source # |
Instance details 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 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 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 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 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 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 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 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 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 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 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 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 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 Methods pretty :: ValBindBase f vn -> Doc ann Source # prettyList :: [ValBindBase f vn] -> Doc ann Source #
(Eq vn, IsName vn, Annot f, Pretty t) => Pretty (PatBase f vn t) Source # |
Instance details Methods pretty :: PatBase f vn t -> Doc ann Source # prettyList :: [PatBase f vn t] -> Doc ann Source #
IsName vn => Pretty (IdentBase f vn t) Source # |
Instance details Methods pretty :: IdentBase f vn t -> Doc ann Source # prettyList :: [IdentBase f vn t] -> Doc ann Source #