123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- ------------------------------------------------------------------------
- -- Small prelude
- ------------------------------------------------------------------------
- module Prelude where
- infixl 6 _+_
- infixr 5 _∷_ _++_
- infixr 3 _∨_
- infix 2 ¬_
- ------------------------------------------------------------------------
- -- Some "logic"
- data ⊥ : Set where
- ¬_ : Set -> Set
- ¬ a = a -> ⊥
- ------------------------------------------------------------------------
- -- Maybe and Dec
- data Maybe (a : Set) : Set where
- just : a -> Maybe a
- nothing : Maybe a
- data Dec (a : Set) : Set where
- yes : a -> Dec a
- no : ¬ a -> Dec a
- ------------------------------------------------------------------------
- -- Lists
- data [_] (a : Set) : Set where
- [] : [ a ]
- _∷_ : a -> [ a ] -> [ a ]
- _++_ : forall {a} -> [ a ] -> [ a ] -> [ a ]
- [] ++ ys = ys
- (x ∷ xs) ++ ys = x ∷ (xs ++ ys)
- ------------------------------------------------------------------------
- -- Natural numbers
- data ℕ : Set where
- zero : ℕ
- suc : ℕ -> ℕ
- _+_ : ℕ -> ℕ -> ℕ
- zero + n = n
- suc m + n = suc (m + n)
- {-# BUILTIN NATURAL ℕ #-}
- {-# BUILTIN NATPLUS _+_ #-}
- ------------------------------------------------------------------------
- -- Booleans
- data Bool : Set where
- true : Bool
- false : Bool
- _∨_ : Bool -> Bool -> Bool
- true ∨ _ = true
- false ∨ b = b
|