summaryrefslogtreecommitdiff
path: root/ddl/out/TypeInfo.purs
diff options
context:
space:
mode:
Diffstat (limited to 'ddl/out/TypeInfo.purs')
-rw-r--r--ddl/out/TypeInfo.purs79
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
4module TypeInfo where
5import Prelude
6import Data.Generic
7import Data.Maybe (Maybe(..))
8import Data.StrMap (StrMap(..))
9import Data.Map (Map(..))
10import Data.List (List(..))
11import Linear
12
13import Data.Argonaut.Combinators ((~>), (:=), (.?))
14import Data.Argonaut.Core (jsonEmptyObject)
15import Data.Argonaut.Printer (printJson)
16import Data.Argonaut.Encode (EncodeJson, encodeJson)
17import Data.Argonaut.Decode (DecodeJson, decodeJson)
18
19import IR
20
21data TypeInfo
22 = TypeInfo
23 { startLine :: Int
24 , startColumn :: Int
25 , endLine :: Int
26 , endColumn :: Int
27 , text :: String
28 }
29
30
31data MyEither
32 = MyLeft TypeInfo (Array TypeInfo)
33 | MyRight Pipeline (Array TypeInfo)
34
35
36
37instance 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
48instance 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
67instance 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
72instance 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