Idris2/tests/idris2/docs004/List.idr
pinselimo 2dbb824a93
[ doc ] Add constructor docstrings (#2789)
Co-authored-by: Guillaume Allais <guillaume.allais@ens-lyon.org>
2023-02-19 10:15:39 +00:00

20 lines
345 B
Idris

module List
data List a = Nil | (::) a (List a)
infixr 5 ::
infixr 5 ++
interface Monoid ty where
||| Users can hand-craft their own monoid implementations
constructor MkMonoid
neutral : ty
(++) : ty -> ty -> ty
Monoid (List a) where
neutral = []
xs ++ ys = case xs of
[] => ys
(x :: xs) => let ih = xs ++ ys in x :: ih