mirror of
https://github.com/unisonweb/unison.git
synced 2024-11-15 14:35:01 +03:00
simplified json representation of var and modified vector literals
This commit is contained in:
parent
1b35e3c31d
commit
87f787fda7
@ -14,7 +14,7 @@ import qualified Data.Aeson.Encode as JE
|
||||
import qualified Data.Set as S
|
||||
import qualified Data.Map as M
|
||||
import qualified Data.Text as Txt
|
||||
import qualified Data.Vector.Unboxed as V
|
||||
import qualified Data.Vector as V
|
||||
import Unison.Syntax.Var as V
|
||||
import qualified Unison.Syntax.Hash as H
|
||||
import qualified Unison.Syntax.Type as T
|
||||
@ -23,7 +23,7 @@ import qualified Unison.Syntax.Type as T
|
||||
data Literal
|
||||
= Number Double
|
||||
| String Txt.Text
|
||||
| Vector (V.Vector Double)
|
||||
| Vector (V.Vector Term)
|
||||
deriving (Eq,Ord,Show)
|
||||
|
||||
-- | Terms in the Unison language
|
||||
|
@ -7,7 +7,8 @@
|
||||
|
||||
module Unison.Syntax.Var where
|
||||
|
||||
import Data.Aeson.TH
|
||||
import Control.Applicative
|
||||
import Data.Aeson
|
||||
|
||||
newtype Var = I Int deriving (Eq,Ord)
|
||||
|
||||
@ -30,4 +31,8 @@ nest (I i) (I j) = I (i + j)
|
||||
bound1 :: Var
|
||||
bound1 = I 1
|
||||
|
||||
deriveJSON defaultOptions ''Var
|
||||
instance FromJSON Var where
|
||||
parseJSON j = I <$> parseJSON j
|
||||
|
||||
instance ToJSON Var where
|
||||
toJSON (I i) = toJSON i
|
||||
|
Loading…
Reference in New Issue
Block a user