simplified json representation of var and modified vector literals

This commit is contained in:
Paul Chiusano 2014-07-11 15:18:02 -04:00
parent 1b35e3c31d
commit 87f787fda7
2 changed files with 9 additions and 4 deletions

View File

@ -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

View File

@ -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