Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
AwesomePrelude example
{-# LANGUAGE OverlappingInstances #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE GADTs #-}
module MyLang where
import Prelude (Integer(..), Show(..),String(..))
import qualified Prelude as P
import Generic.Data.Bool
import Generic.Data.Num
data MyLang a where
MLFalse :: MyLang Bool
MLTrue :: MyLang Bool
MLValue :: a -> MyLang a
instance BoolC MyLang where
false = MLFalse
true = MLTrue
bool t _ MLTrue = t
bool _ e MLFalse = e
instance Num MyLang Integer where
fromInteger = MLValue
(MLValue a) + (MLValue b) = MLValue (a P.+ b)
(MLValue a) - (MLValue b) = MLValue (a P.- b)
(MLValue a) * (MLValue b) = MLValue (a P.* b)
test :: MyLang Integer
test = if' true (3 + 4) (4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.