@@ -1,3 +1,4 @@
1+{-# OPTIONS_GHC -Wall #-}
1module SourceSyntax.Declaration where
2module SourceSyntax.Declaration where
3import Data.Binary
4import Data.Binary
@@ -17,21 +18,25 @@ data Declaration tipe var
17data Assoc = L | N | R
18data Assoc = L | N | R
18 deriving (Eq)
19 deriving (Eq)
20−data Derivation = Json | Binary | RecordConstructor
21+data Derivation = Json | JS | Binary | New
21 deriving (Eq, Show)
22 deriving (Eq, Show)
23instance Binary Derivation where
24instance Binary Derivation where
24 get = do n <- getWord8
25 get = do n <- getWord8
25 return $ case n of
26 return $ case n of
27− 1 -> Binary
29+ 2 -> Binary
28− 2 -> RecordConstructor
30+ 3 -> New
31+ _ -> error "Unable to decode Derivation. You may have corrupted binary files,\n\
32+ \so please report an issue at <https://github.com/evancz/Elm/issues>"
30 put derivation =
34 put derivation =
31− case derivation of
35+ putWord8 $ case derivation of
32− Json -> putWord8 0
36+ Json -> 0
33− Binary -> putWord8 1
37+ JS -> 1
34− RecordConstructor -> putWord8 2
38+ Binary -> 2
36instance Show Assoc where
41instance Show Assoc where
37 show assoc =
42 show assoc =