1{-# OPTIONS_GHC -Wall #-}
2module SourceSyntax.Module where
5import qualified Data.Map as Map
6import Control.Applicative ((<$>), (<*>))
8import SourceSyntax.Expression (LExpr)
9import SourceSyntax.Declaration
10import SourceSyntax.Type
12import qualified Elm.Internal.Version as Version
15 Module [String] Exports Imports [def]
18type Exports = [String]
20type Imports = [(String, ImportMethod)]
21data ImportMethod = As String | Importing [String] | Hiding [String]
22 deriving (Eq, Ord, Show)
24instance Binary ImportMethod where
26 let put' n info = putWord8 n >> put info in
29 Importing ss -> put' 1 ss
30 Hiding ss -> put' 2 ss
32 get = do tag <- getWord8
35 1 -> Importing <$> get
37 _ -> error "Error reading valid ImportMethod type from serialized string"
44 , imports :: [(String, ImportMethod)]
46 , types :: Map.Map String Type
47 , fixities :: [(Assoc, Int, String)]
52type Interfaces = Map.Map String ModuleInterface
53type ADT = (String, [String], [(String,[Type])], [Derivation])
54type Alias = (String, [String], Type, [Derivation])
56data ModuleInterface = ModuleInterface {
57 iVersion :: Version.Version,
58 iTypes :: Map.Map String Type,
59 iImports :: [(String, ImportMethod)],
62 iFixities :: [(Assoc, Int, String)]
65metaToInterface :: MetadataModule -> ModuleInterface
66metaToInterface metaModule =
68 { iVersion = Version.elmVersion
69 , iTypes = types metaModule
70 , iImports = imports metaModule
71 , iAdts = datatypes metaModule
72 , iAliases = aliases metaModule
73 , iFixities = fixities metaModule
76instance Binary ModuleInterface where
77 get = ModuleInterface <$> get <*> get <*> get <*> get <*> get <*> get
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