1-----------------------------------------------------------------------------
3-- Module : Language.PureScript.Sugar
4-- Copyright : (c) Phil Freeman 2013
7-- Maintainer : Phil Freeman <paf31@cantab.net>
8-- Stability : experimental
14-----------------------------------------------------------------------------
16{-# LANGUAGE FlexibleContexts #-}
18module Language.PureScript.Sugar (desugar, module S) where
24import Control.Category ((>>>))
25import Control.Monad.Error.Class (MonadError())
26import Control.Monad.Writer.Class (MonadWriter())
27import Control.Monad.Supply.Class
29import Language.PureScript.AST
30import Language.PureScript.Errors
31import Language.PureScript.Externs
33import Language.PureScript.Sugar.BindingGroups as S
34import Language.PureScript.Sugar.CaseDeclarations as S
35import Language.PureScript.Sugar.DoNotation as S
36import Language.PureScript.Sugar.Names as S
37import Language.PureScript.Sugar.ObjectWildcards as S
38import Language.PureScript.Sugar.Operators as S
39import Language.PureScript.Sugar.TypeClasses as S
40import Language.PureScript.Sugar.TypeClasses.Deriving as S
41import Language.PureScript.Sugar.TypeDeclarations as S
44-- The desugaring pipeline proceeds as follows:
46-- * Remove signed literals in favour of `negate` applications
48-- * Desugar object literals with wildcards into lambdas
50-- * Desugar operator sections
52-- * Desugar do-notation using the @Prelude.Monad@ type class
54-- * Desugar top-level case declarations into explicit case expressions
56-- * Desugar type declarations into value declarations with explicit type annotations
58-- * Qualify any unqualified names and types
60-- * Rebracket user-defined binary operators
62-- * Introduce type synonyms for type class dictionaries
64-- * Group mutually recursive value and data declarations into binding groups.
66desugar :: (Applicative m, MonadSupply m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => [ExternsFile] -> [Module] -> m [Module]
68 map removeSignedLiterals
69 >>> traverse desugarObjectConstructors
70 >=> traverse desugarOperatorSections
71 >=> traverse desugarDoModule
72 >=> desugarCasesModule
73 >=> desugarTypeDeclarationsModule
74 >=> desugarImports externs
76 >=> traverse deriveInstances
77 >=> desugarTypeClasses externs
78 >=> createBindingGroupsModule
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list