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 [def]
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"
46 , imports :: [(String, ImportMethod)]
48 , types :: Map.Map String Type
49 , fixities :: [(Assoc, Int, String)]
52 , sendPorts :: [(String, LExpr, Type)]
53 , recvPorts :: [(String, LExpr, Type)]
56type Interfaces = Map.Map String ModuleInterface
57type ADT = (String, [String], [(String,[Type])], [Derivation])
58type Alias = (String, [String], Type, [Derivation])
60data ModuleInterface = ModuleInterface {
61 iVersion :: Version.Version,
62 iTypes :: Map.Map String Type,
63 iImports :: [(String, ImportMethod)],
66 iFixities :: [(Assoc, Int, String)]
69metaToInterface metaModule =
71 { iVersion = Version.elmVersion
72 , iTypes = types metaModule
73 , iImports = imports metaModule
74 , iAdts = datatypes metaModule
75 , iAliases = aliases metaModule
76 , iFixities = fixities metaModule
79instance Binary ModuleInterface where
80 get = ModuleInterface <$> get <*> get <*> get <*> get <*> get <*> get
90instance Binary Assoc where
91 get = do n <- getWord8
96 _ -> error "Error reading valid associativity from serialized string"
98 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