mirror of
https://github.com/github/semantic.git
synced 2024-12-19 12:51:52 +03:00
Create Term.Instances module
- This allows us to differentiate between ToJSON instances for SyntaxTerm
This commit is contained in:
parent
b20e4c195f
commit
73dd1ec8a8
11
src/Term/Instances.hs
Normal file
11
src/Term/Instances.hs
Normal file
@ -0,0 +1,11 @@
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
module Term.Instances where
|
||||
|
||||
import Prologue
|
||||
import Data.Record
|
||||
import Term
|
||||
import Data.Aeson
|
||||
|
||||
instance (ToJSON leaf, ToJSON (Record fields)) => ToJSON (SyntaxTerm leaf fields) where
|
||||
toJSON syntaxTerm = case runCofree syntaxTerm of
|
||||
(record :< syntax) -> object [ ("record", toJSON record), ("syntax", toJSON syntax) ]
|
Loading…
Reference in New Issue
Block a user