@@ -21,6 +21,7 @@ module Prelude
2121 , BoolLike, (&&), (||)
2222 , not
2323 , Semigroup, (<>), (++)
24+ , Unit(..), unit
2425 ) where
2526
2627 flip :: forall a b c. (a -> b -> c) -> b -> a -> c
@@ -79,6 +80,9 @@ module Prelude
7980 \ return JSON.stringify(s);\
8081 \}" :: String -> String
8182
83+ instance showUnit :: Show Unit where
84+ show (Unit {}) = "Unit {}"
85+
8286 instance showString :: Show String where
8387 show = showStringImpl
8488
@@ -207,6 +211,11 @@ module Prelude
207211 (%) = numMod
208212 negate = numNegate
209213
214+ data Unit = Unit {}
215+
216+ unit :: forall a. a -> Unit
217+ unit = const (Unit {})
218+
210219 infix 4 ==
211220 infix 4 /=
212221
@@ -228,6 +237,10 @@ module Prelude
228237 \ };\
229238 \}" :: forall a. a -> a -> Boolean
230239
240+ instance eqUnit :: Eq Unit where
241+ (==) (Unit {}) (Unit {}) = true
242+ (/=) (Unit {}) (Unit {}) = false
243+
231244 instance eqString :: Eq String where
232245 (==) = refEq
233246 (/=) = refIneq
@@ -297,6 +310,9 @@ module Prelude
297310 \ return n1 < n2 ? LT : n1 > n2 ? GT : EQ;\
298311 \ };\
299312 \}" :: forall a. a -> a -> Ordering
313+
314+ instance ordUnit :: Ord Unit where
315+ compare (Unit {}) (Unit {}) = EQ
300316
301317 instance ordBoolean :: Ord Boolean where
302318 compare false false = EQ
@@ -421,6 +437,9 @@ module Prelude
421437 \ };\
422438 \}" :: String -> String -> String
423439
440+ instance semigroupUnit :: Semigroup Unit where
441+ (<>) (Unit {}) (Unit {}) = Unit {}
442+
424443 instance semigroupString :: Semigroup String where
425444 (<>) = concatString
426445