on fbff9ce help sign in
elk/src/Docs/AST.hs
79 lines 1.1 kB history raw
1{-# OPTIONS_GHC -Wall #-}
2module Docs.AST
3 ( Docs(..), Centralized, Checked
4 , Entry(..), Raw, Good
5 , Union(..)
6 , Alias(..)
7 , Value(..), RawValue, GoodValue
8 )
9 where
12import qualified Data.Map as Map
13import Data.Text (Text)
15import qualified AST.Declaration as Decl
16import qualified Elm.Compiler.Type as Type
17import qualified Reporting.Annotation as A
21-- DOCS
24data Docs unions aliases values =
25 Docs
26 { _overview :: Text
27 , _unions :: Map.Map Text unions
28 , _aliases :: Map.Map Text aliases
29 , _values :: Map.Map Text values
30 }
33type Centralized =
34 Docs (Raw Union) (Raw Alias) (Raw RawValue)
37type Checked =
38 Docs (Good Union) (Good Alias) (Good GoodValue)
42-- ENTRY
45data Entry comment details =
46 Entry
47 { _comment :: !comment
48 , _details :: !details
49 }
52type Raw a =
53 A.Located (Entry (Maybe Text) a)
56type Good a =
57 Entry Text a
61-- INFO
64data Alias =
65 Alias [Text] Type.Type
68data Union =
69 Union [Text] [(Text, [Type.Type])]
72data Value tipe
73 = Value tipe
74 | Infix tipe Decl.Assoc Int
77type RawValue = Value (Maybe Type.Type)
79type GoodValue = Value Type.Type