mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-19 09:12:34 +03:00
18 lines
262 B
Idris
18 lines
262 B
Idris
module List
|
|
|
|
data List a = Nil | (::) a (List a)
|
|
|
|
infixr 5 ::
|
|
infixr 5 ++
|
|
|
|
interface Monoid ty where
|
|
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
|