1
1
mirror of https://github.com/github/semantic.git synced 2024-12-21 05:41:54 +03:00
This commit is contained in:
joshvera 2018-06-22 14:24:59 -04:00
parent 13eecb41a5
commit 002cb36cb3
3 changed files with 6 additions and 6 deletions

View File

@ -148,7 +148,7 @@ instance Message1 [] where
-- oneMsg = decodeMessage (fieldNumber 1)
-- liftDotProto (_ :: Proxy [a]) = messageField (NestedRepeated (Named (Single (nameOf (Proxy @a))))) Nothing
liftDotProto (_ :: Proxy [a]) = [ Proto.DotProtoMessageField $ Proto.DotProtoField (fieldNumber 1) ty (Proto.Single "listContent") [] Nothing ]
where ty = (Proto.NestedRepeated (Proto.Named (Proto.Single (nameOf (Proxy @a)))))
where ty = Proto.NestedRepeated (Proto.Named (Proto.Single (nameOf (Proxy @a))))
-- Common

View File

@ -176,7 +176,7 @@ instance Evaluatable Power where
eval t = rvalBox =<< (traverse subtermValue t >>= go) where
go (Power a b) = liftNumeric2 liftedExponent a b
data Negate a = Negate { term :: a }
newtype Negate a = Negate { term :: a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
instance Eq1 Negate where liftEq = genericLiftEq
@ -240,7 +240,7 @@ instance Evaluatable And where
cond <- a
ifthenelse cond b (pure cond)
data Not a = Not { term :: a }
newtype Not a = Not { term :: a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
instance Eq1 Not where liftEq = genericLiftEq

View File

@ -83,9 +83,9 @@ instance (Show1 f, Show a) => Show (Term f a) where
showsPrec = showsPrec1
instance Message1 f => Message (Term f ()) where
encodeMessage num (Term (In _ f)) = Encode.embedded num (liftEncodeMessage encodeMessage (fromInteger 1) f)
decodeMessage num = termIn () . fromMaybe undefined <$> Decode.at (Decode.embedded (liftDecodeMessage decodeMessage (fromInteger 1))) num
dotProto _ = [ DotProtoMessageField (DotProtoField (fromInteger 1) (Prim (Named (Single "Syntax"))) (Single "syntax") [] Nothing) ]
encodeMessage num (Term (In _ f)) = Encode.embedded num (liftEncodeMessage encodeMessage 1 f)
decodeMessage num = termIn () . fromMaybe undefined <$> Decode.at (Decode.embedded (liftDecodeMessage decodeMessage 1)) num
dotProto _ = [ DotProtoMessageField (DotProtoField 1 (Prim (Named (Single "Syntax"))) (Single "syntax") [] Nothing) ]
instance Named (Term f a) where
nameOf _ = "Term"