ddc-core-tetra-0.4.2.1: Disciplined Disciple Compiler intermediate language.

Safe HaskellNone
LanguageHaskell98

DDC.Core.Tetra.Convert

Description

Conversion of Disciple Core Tetra to Disciple Core Salt.

Synopsis

Documentation

saltOfTetraModule Source

Arguments

:: Show a 
=> Platform

Platform specification.

-> Config

Runtime configuration.

-> DataDefs Name

Data type definitions.

-> KindEnv Name

Kind environment.

-> TypeEnv Name

Type environment.

-> Module (AnTEC a Name) Name

Tetra module to convert.

-> Either (Error a) (Module a Name)

Salt module.

Convert a Core Tetra module to Core Salt.

The input module needs to be: well typed, fully named with no deBruijn indices, have all functions defined at top-level, have type annotations on every bound variable and constructor, be a-normalised, have saturated function applications, not have over-applied function applications, have all supers in prenex form, with type parameters before value parameters. If not then Error.

The output code contains: debruijn indices. These then need to be eliminated before it will pass the Salt fragment checks.

data Error a Source

Things that can go wrong during the conversion.

Constructors

ErrorCurry Error 
ErrorMainHasNoMain

The Main module has no main function.

ErrorMalformed

Found unexpected AST node, like LWithRegion.

Fields

errorMessage :: String
 
ErrorMistyped

The program is definately not well typed.

Fields

errorExp :: Exp (AnTEC a Name) Name
 
ErrorUnsupported

The program wasn't normalised, or we don't support the feature.

Fields

errorExp :: Exp (AnTEC a Name) Name
 
errorDor :: Doc
 
ErrorBotAnnot

The program has bottom (missing) type annotations.

ErrorUnexpectedSum

Found an unexpected type sum.

ErrorUnbound

Found an unbound variable.

Fields

errorBound :: Bound Name
 
ErrorInvalidBinder

An invalid name used in a binding position

Fields

errorName :: Name
 
ErrorInvalidBound

An invalid name used in a bound position

Fields

errorBound :: Bound Name
 
ErrorInvalidDaCon

An invalid data constructor name.

Fields

errorDaCon :: DaCon Name
 
ErrorInvalidAlt

An invalid name used for the constructor of an alternative.

Fields

errorAlt :: Alt (AnTEC a Name) Name
 
ErrorInvalidScrut

Something that we can't destruct in a case expression.

Fields

errorScrut :: Exp (AnTEC a Name) Name
 

Instances

Show a => Pretty (Error a) Source