File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
lambda-buffers-codegen/src/LambdaBuffers/Codegen/LamVal Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 1- module LambdaBuffers.Codegen.LamVal.Eq (deriveEqImpl ) where
1+ module LambdaBuffers.Codegen.LamVal.Eq (deriveEqImpl , deriveNeqImpl ) where
22
33import Control.Exception qualified as Exception
44import Data.Map.Ordered qualified as OMap
@@ -95,6 +95,16 @@ eqListHelper lxs rxs tys =
9595deriveEqImpl :: PC. ModuleName -> PC. TyDefs -> PC. Ty -> Either P. InternalError ValueE
9696deriveEqImpl mn tydefs = deriveImpl mn tydefs eqSum eqProduct eqRecord
9797
98+ -- | Essentially, takes the 'deriveEqImpl' and sticks a not in front of it.
99+ deriveNeqImpl :: PC. ModuleName -> PC. TyDefs -> PC. Ty -> Either P. InternalError ValueE
100+ deriveNeqImpl mn tydefs =
101+ deriveImpl
102+ mn
103+ tydefs
104+ (\ qsum -> LamE (\ l -> LamE (\ r -> notE @ (eqSum qsum @ l @ r))))
105+ (\ qprod -> LamE (\ l -> LamE (\ r -> notE @ (eqProduct qprod @ l @ r))))
106+ (\ qrec -> LamE (\ l -> LamE (\ r -> notE @ (eqRecord qrec @ l @ r))))
107+
98108-- | Domain value references
99109
100110-- | `eq :: a -> a -> Bool`
@@ -112,3 +122,7 @@ trueE = RefE ([], "true")
112122-- | `and :: Bool -> Bool -> Bool`
113123andE :: ValueE
114124andE = RefE ([] , " and" )
125+
126+ -- | `not :: Bool -> Bool`
127+ notE :: ValueE
128+ notE = RefE ([] , " not" )
You can’t perform that action at this time.
0 commit comments