diff options
Diffstat (limited to 'ddl/out/TypeInfo.purs')
-rw-r--r-- | ddl/out/TypeInfo.purs | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/ddl/out/TypeInfo.purs b/ddl/out/TypeInfo.purs new file mode 100644 index 0000000..d2d8351 --- /dev/null +++ b/ddl/out/TypeInfo.purs | |||
@@ -0,0 +1,79 @@ | |||
1 | -- generated file, do not modify! | ||
2 | -- 2015-12-21T12:00:19.854088000000Z | ||
3 | |||
4 | module TypeInfo where | ||
5 | import Prelude | ||
6 | import Data.Generic | ||
7 | import Data.Maybe (Maybe(..)) | ||
8 | import Data.StrMap (StrMap(..)) | ||
9 | import Data.Map (Map(..)) | ||
10 | import Data.List (List(..)) | ||
11 | import Linear | ||
12 | |||
13 | import Data.Argonaut.Combinators ((~>), (:=), (.?)) | ||
14 | import Data.Argonaut.Core (jsonEmptyObject) | ||
15 | import Data.Argonaut.Printer (printJson) | ||
16 | import Data.Argonaut.Encode (EncodeJson, encodeJson) | ||
17 | import Data.Argonaut.Decode (DecodeJson, decodeJson) | ||
18 | |||
19 | import IR | ||
20 | |||
21 | data TypeInfo | ||
22 | = TypeInfo | ||
23 | { startLine :: Int | ||
24 | , startColumn :: Int | ||
25 | , endLine :: Int | ||
26 | , endColumn :: Int | ||
27 | , text :: String | ||
28 | } | ||
29 | |||
30 | |||
31 | data MyEither | ||
32 | = MyLeft TypeInfo (Array TypeInfo) | ||
33 | | MyRight Pipeline (Array TypeInfo) | ||
34 | |||
35 | |||
36 | |||
37 | instance encodeJsonTypeInfo :: EncodeJson TypeInfo where | ||
38 | encodeJson v = case v of | ||
39 | TypeInfo r -> | ||
40 | "tag" := "TypeInfo" ~> | ||
41 | "startLine" := r.startLine ~> | ||
42 | "startColumn" := r.startColumn ~> | ||
43 | "endLine" := r.endLine ~> | ||
44 | "endColumn" := r.endColumn ~> | ||
45 | "text" := r.text ~> | ||
46 | jsonEmptyObject | ||
47 | |||
48 | instance decodeJsonTypeInfo :: DecodeJson TypeInfo where | ||
49 | decodeJson json = do | ||
50 | obj <- decodeJson json | ||
51 | tag <- obj .? "tag" | ||
52 | case tag of | ||
53 | "TypeInfo" -> do | ||
54 | startLine <- obj .? "startLine" | ||
55 | startColumn <- obj .? "startColumn" | ||
56 | endLine <- obj .? "endLine" | ||
57 | endColumn <- obj .? "endColumn" | ||
58 | text <- obj .? "text" | ||
59 | pure $ TypeInfo | ||
60 | { startLine:startLine | ||
61 | , startColumn:startColumn | ||
62 | , endLine:endLine | ||
63 | , endColumn:endColumn | ||
64 | , text:text | ||
65 | } | ||
66 | |||
67 | instance encodeJsonMyEither :: EncodeJson MyEither where | ||
68 | encodeJson v = case v of | ||
69 | MyLeft arg0 arg1 -> "tag" := "MyLeft" ~> "arg0" := arg0 ~> "arg1" := arg1 ~> jsonEmptyObject | ||
70 | MyRight arg0 arg1 -> "tag" := "MyRight" ~> "arg0" := arg0 ~> "arg1" := arg1 ~> jsonEmptyObject | ||
71 | |||
72 | instance decodeJsonMyEither :: DecodeJson MyEither where | ||
73 | decodeJson json = do | ||
74 | obj <- decodeJson json | ||
75 | tag <- obj .? "tag" | ||
76 | case tag of | ||
77 | "MyLeft" -> MyLeft <$> obj .? "arg0" <*> obj .? "arg1" | ||
78 | "MyRight" -> MyRight <$> obj .? "arg0" <*> obj .? "arg1" | ||
79 | |||