mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-24 12:14:26 +03:00
15 lines
348 B
Idris
15 lines
348 B
Idris
|
record Pack (a : Type) where
|
||
|
constructor MkPack
|
||
|
nested : a
|
||
|
nat : Nat
|
||
|
|
||
|
proj : List (Pack Bool) -> List (Bool, Nat)
|
||
|
proj [] = []
|
||
|
proj (x :: xs) = MkPair x.nested (nat x) :: proj xs
|
||
|
|
||
|
ununpack : List (Pack (Pack a)) -> List a
|
||
|
ununpack = map (.nested.nested)
|
||
|
|
||
|
deepNats : List (Pack (Pack a)) -> List Nat
|
||
|
deepNats = map ((.nat) . (.nested))
|