Maybe.agda 215 B

123456789101112
  1. module Data.Maybe where
  2. data Maybe (a : Set) : Set where
  3. nothing : Maybe a
  4. just : a -> Maybe a
  5. fmap : {A B : Set} -> (A -> B) -> Maybe A -> Maybe B
  6. fmap f nothing = nothing
  7. fmap f (just a) = just (f a )