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 #-}
19module Language.PureScript.Sugar (desugar, module S) where
22import Control.Category ((>>>))
23#if __GLASGOW_HASKELL__ < 710
24import Control.Applicative
26import Control.Monad.Error.Class (MonadError())
27import Control.Monad.Writer.Class (MonadWriter())
28import Control.Monad.Supply.Class
30import Language.PureScript.AST
31import Language.PureScript.Errors
32import Language.PureScript.Externs
34import Language.PureScript.Sugar.BindingGroups as S
35import Language.PureScript.Sugar.CaseDeclarations as S
36import Language.PureScript.Sugar.DoNotation as S
37import Language.PureScript.Sugar.Names as S
38import Language.PureScript.Sugar.ObjectWildcards as S
39import Language.PureScript.Sugar.Operators as S
40import Language.PureScript.Sugar.TypeClasses as S
41import Language.PureScript.Sugar.TypeClasses.Deriving as S
42import Language.PureScript.Sugar.TypeDeclarations as S
45-- The desugaring pipeline proceeds as follows:
47-- * Remove signed literals in favour of `negate` applications
49-- * Desugar object literals with wildcards into lambdas
51-- * Desugar operator sections
53-- * Desugar do-notation using the @Prelude.Monad@ type class
55-- * Desugar top-level case declarations into explicit case expressions
57-- * Desugar type declarations into value declarations with explicit type annotations
59-- * Qualify any unqualified names and types
61-- * Rebracket user-defined binary operators
63-- * Introduce type synonyms for type class dictionaries
65-- * Group mutually recursive value and data declarations into binding groups.
67desugar :: (Applicative m, MonadSupply m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => [ExternsFile] -> [Module] -> m [Module]
69 map removeSignedLiterals
70 >>> mapM desugarObjectConstructors
71 >=> mapM desugarOperatorSections
72 >=> mapM desugarDoModule
73 >=> desugarCasesModule
74 >=> desugarTypeDeclarationsModule
75 >=> desugarImports externs
77 >=> mapM deriveInstances
78 >=> desugarTypeClasses externs
79 >=> 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