Skip to content

Instantly share code, notes, and snippets.

@Icelandjack Icelandjack/14661.md
Created Jan 27, 2018

Embed
What would you like to do?
GHC Trac 14661
class ListLike f where
  nil  :: f a
  cons :: a -> f a -> f a
  (·)  :: f a -> f a -> f a

newtype LL a = LL (forall ff. ListLike ff => ff a)

instance ListLike LL where
  nil :: LL a
  nil = LL nil
  
  cons :: a -> LL a -> LL a
  cons a (LL as) = LL (cons a as)
  
  (·) :: LL a -> LL a -> LL a
  LL as · LL bs = LL (as · bs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.