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)
13import Control.Monad (liftM)
15import qualified Elm.Internal.Version as Version
18 Module [String] Exports Imports [Declaration tipe var]
21type Exports = [String]
23type Imports = [(String, ImportMethod)]
24data ImportMethod = As String | Importing [String] | Hiding [String]
25 deriving (Eq, Ord, Show)
27instance Binary ImportMethod where
28 put (As s) = do put (0 :: Word8)
31 put (Importing ss) = do put (1 :: Word8)
34 put (Hiding ss) = do put (2 :: Word8)
37 get = do tag <- getWord8
40 1 -> liftM Importing get
42 _ -> error "Error reading valid ImportMethod type from serialized string"
44data MetadataModule t v = MetadataModule {
48 imports :: [(String, ImportMethod)],
50 types :: Map.Map String Type,
51 fixities :: [(Assoc, Int, String)],
54 foreignImports :: [(String, LExpr t v, String, Type)],
55 foreignExports :: [(String, String, Type)]
58type Interfaces = Map.Map String ModuleInterface
59type ADT = (String, [String], [(String,[Type])], [Derivation])
60type Alias = (String, [String], Type, [Derivation])
62data ModuleInterface = ModuleInterface {
63 iVersion :: Version.Version,
64 iTypes :: Map.Map String Type,
65 iImports :: [(String, ImportMethod)],
68 iFixities :: [(Assoc, Int, String)]
71metaToInterface metaModule =
73 { iVersion = Version.elmVersion
74 , iTypes = types metaModule
75 , iImports = imports metaModule
76 , iAdts = datatypes metaModule
77 , iAliases = aliases metaModule
78 , iFixities = fixities metaModule
81instance Binary ModuleInterface where
82 get = ModuleInterface <$> get <*> get <*> get <*> get <*> get <*> get
92instance Binary Assoc where
93 get = do n <- getWord8
98 _ -> error "Error reading valid associativity from serialized string"
100 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