Skip to content

Instantly share code, notes, and snippets.

@jchia
Created May 21, 2018 07:05
Show Gist options
  • Select an option

  • Save jchia/d6cfeae0df45d6a3afedd77aa6eac045 to your computer and use it in GitHub Desktop.

Select an option

Save jchia/d6cfeae0df45d6a3afedd77aa6eac045 to your computer and use it in GitHub Desktop.
class (Eq a, Hashable a, Show a, Typeable a) => Computable a where
toCCode :: a -> CCode
toCCodeMay :: a -> Maybe CCode
toCCodeMay = map Just toCCode
defValue :: a
isDefValue :: a -> Bool
isDefValue = (== defValue)
instance Computable Foo where
...
instance Computable Bool where
...
instance Computable Double where
...
instance Computable Nse where
...
instance Computable Nanos where
...
data Nl a where
Imported :: Computable a => Int -> Nl a
FooIsFull :: Nl Foo -> Nl Bool
FooTime :: Nl Foo -> Nl Nse
FooVal :: Nl Foo -> Nl Double
TimeMinus :: Nl Nse -> Nl Nse -> Nl Nanos
DurationMinus :: Nl Nanos -> Nl Nanos -> Nl Nanos
Minus :: Nl Double -> Nl Double -> Nl Double
AMinus :: Nl Double -> Nl Double -> Nl Double
Plus1 :: Double -> Nl Double -> Nl Double
Plus2 :: Nl Double -> Nl Double -> Nl Double
Exp :: Nl Double -> Nl Double
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment