on fe7bbbd help sign in
elk/src/Docs/AST.hs
91 lines 1.4 kB history raw
1{-# OPTIONS_GHC -Wall #-}
2module Docs.AST
3 ( Centralized(..), Checked(..)
4 , Value(..), RawValue, GoodValue
5 , Alias(..), RawAlias, GoodAlias
6 , Union(..), RawUnion, GoodUnion
7 )
8 where
11import qualified Data.Map as Map
12import Data.Text (Text)
14import qualified Elm.Compiler.Type as Type
15import qualified Reporting.Annotation as A
19-- DOCS
22data Centralized =
23 Centralized
24 { comment :: Text
25 , values :: Map.Map Text (A.Located RawValue)
26 , aliases :: Map.Map Text (A.Located RawAlias)
27 , unions :: Map.Map Text (A.Located RawUnion)
28 }
31data Checked =
32 Checked
33 { _comment :: Text
34 , _values :: Map.Map Text GoodValue
35 , _aliases :: Map.Map Text GoodAlias
36 , _unions :: Map.Map Text GoodUnion
37 }
41-- VALUES
44data Value comment tipe =
45 Value
46 { valueComment :: comment
47 , valueType :: tipe
48 , valueAssocPrec :: Maybe (Text,Int)
49 }
52type RawValue = Value (Maybe Text) (Maybe Type.Type)
55type GoodValue = Value Text Type.Type
59-- ALIAS
62data Alias comment =
63 Alias
64 { aliasComment :: comment
65 , aliasArgs :: [Text]
66 , aliasType :: Type.Type
67 }
70type RawAlias = Alias (Maybe Text)
73type GoodAlias = Alias Text
77-- UNION
80data Union comment =
81 Union
82 { unionComment :: comment
83 , unionArgs :: [Text]
84 , unionCases :: [(Text, [Type.Type])]
85 }
88type RawUnion = Union (Maybe Text)
91type GoodUnion = Union Text