Skip to content

Instantly share code, notes, and snippets.

@clayrat
Created March 5, 2019 11:21
Show Gist options
  • Select an option

  • Save clayrat/71b72606dbd93922acd985d1ae083dbd to your computer and use it in GitHub Desktop.

Select an option

Save clayrat/71b72606dbd93922acd985d1ae083dbd to your computer and use it in GitHub Desktop.
import Data.NEList -- from idris-tparsec
nelList : Iso (List a) (Maybe (NEList a))
nelList = MkIso fromList (maybe Nil NEList.toList) fromTo toFrom
where
fromTo : (y : Maybe (NEList a)) -> fromList (maybe [] NEList.toList y) = y
fromTo Nothing = Refl
fromTo (Just (MkNEList h t)) = Refl
toFrom : (x : List a) -> maybe [] NEList.toList (fromList x) = x
toFrom [] = Refl
toFrom (x::xs) = Refl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment