0 | module Data.Linear.LList
2 | import Data.Linear.Bifunctor
3 | import Data.Linear.Interface
4 | import Data.Linear.Notation
5 | import Data.Linear.LNat
10 | data LList : Type -> Type where
12 | (::) : a -@ LList a -@ LList a
14 | %name LList
xs, ys, zs, ws
17 | length : Consumable a => LList a -@ LNat
19 | length (x :: xs) = consume x `seq` length xs
22 | Consumable a => Consumable (LList a) where
24 | consume (x :: xs) = x `seq` consume xs
27 | Duplicable a => Duplicable (LList a) where
28 | duplicate [] = [[], []]
29 | duplicate (x :: xs) = (::) <$> duplicate x <*> duplicate xs