|
14 | 14 |
|
15 | 15 | {-# LANGUAGE DeriveDataTypeable #-} |
16 | 16 | {-# LANGUAGE ScopedTypeVariables #-} |
| 17 | +{-# LANGUAGE TemplateHaskell #-} |
17 | 18 | {-# LANGUAGE CPP #-} |
18 | 19 |
|
19 | 20 | module Language.PureScript.AST.Declarations where |
20 | 21 |
|
| 22 | +import Data.Aeson.TH |
| 23 | + |
21 | 24 | import qualified Data.Data as D |
22 | 25 | import qualified Data.Map as M |
23 | 26 |
|
@@ -147,10 +150,6 @@ data Declaration |
147 | 150 | -- |
148 | 151 | | ExternDataDeclaration ProperName Kind |
149 | 152 | -- | |
150 | | - -- A type class instance foreign import |
151 | | - -- |
152 | | - | ExternInstanceDeclaration Ident [Constraint] (Qualified ProperName) [Type] |
153 | | - -- | |
154 | 153 | -- A fixity declaration (fixity data, operator name) |
155 | 154 | -- |
156 | 155 | | FixityDeclaration Fixity String |
@@ -222,14 +221,6 @@ isExternDataDecl ExternDataDeclaration{} = True |
222 | 221 | isExternDataDecl (PositionedDeclaration _ _ d) = isExternDataDecl d |
223 | 222 | isExternDataDecl _ = False |
224 | 223 |
|
225 | | --- | |
226 | | --- Test if a declaration is a type class instance foreign import |
227 | | --- |
228 | | -isExternInstanceDecl :: Declaration -> Bool |
229 | | -isExternInstanceDecl ExternInstanceDeclaration{} = True |
230 | | -isExternInstanceDecl (PositionedDeclaration _ _ d) = isExternInstanceDecl d |
231 | | -isExternInstanceDecl _ = False |
232 | | - |
233 | 224 | -- | |
234 | 225 | -- Test if a declaration is a fixity declaration |
235 | 226 | -- |
@@ -442,3 +433,6 @@ data DoNotationElement |
442 | 433 | -- A do notation element with source position information |
443 | 434 | -- |
444 | 435 | | PositionedDoNotationElement SourceSpan [Comment] DoNotationElement deriving (Show, Read, D.Data, D.Typeable) |
| 436 | + |
| 437 | +$(deriveJSON (defaultOptions { sumEncoding = ObjectWithSingleField }) ''DeclarationRef) |
| 438 | +$(deriveJSON (defaultOptions { sumEncoding = ObjectWithSingleField }) ''ImportDeclarationType) |
0 commit comments