1module SourceSyntax.Module where
4import Data.List (intercalate)
5import qualified Data.Map as Map
6import Control.Applicative ((<$>), (<*>))
7import Control.Arrow (second)
9import SourceSyntax.Expression (LExpr)
10import SourceSyntax.Declaration
11import SourceSyntax.Type
12import System.FilePath (joinPath)
14import qualified Elm.Internal.Version as Version
17 Module [String] Exports Imports [Declaration tipe var]
20type Exports = [String]
22type Imports = [(String, ImportMethod)]
23data ImportMethod = As String | Importing [String] | Hiding [String]
24 deriving (Eq, Ord, Show)
26instance Binary ImportMethod where
28 let put' n info = putWord8 n >> put info in
31 Importing ss -> put' 1 ss
32 Hiding ss -> put' 2 ss
34 get = do tag <- getWord8
37 1 -> Importing <$> get
39 _ -> error "Error reading valid ImportMethod type from serialized string"
41data MetadataModule t v = MetadataModule {
45 imports :: [(String, ImportMethod)],
47 types :: Map.Map String Type,
48 fixities :: [(Assoc, Int, String)],
51 ports :: [(String, Type, Maybe (LExpr t v))]
54type Interfaces = Map.Map String ModuleInterface
55type ADT = (String, [String], [(String,[Type])], [Derivation])
56type Alias = (String, [String], Type, [Derivation])
58data ModuleInterface = ModuleInterface {
59 iVersion :: Version.Version,
60 iTypes :: Map.Map String Type,
61 iImports :: [(String, ImportMethod)],
64 iFixities :: [(Assoc, Int, String)]
67metaToInterface metaModule =
69 { iVersion = Version.elmVersion
70 , iTypes = types metaModule
71 , iImports = imports metaModule
72 , iAdts = datatypes metaModule
73 , iAliases = aliases metaModule
74 , iFixities = fixities metaModule
77instance Binary ModuleInterface where
78 get = ModuleInterface <$> get <*> get <*> get <*> get <*> get <*> get
88instance Binary Assoc where
89 get = do n <- getWord8
94 _ -> error "Error reading valid associativity from serialized string"
96 put assoc = putWord8 $ case assoc of { L -> 0 ; N -> 1 ; R -> 2 }
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