Skip to content

Instantly share code, notes, and snippets.

@Peaker
Forked from dtchepak/test.hs
Created June 4, 2012 00:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Peaker/2865635 to your computer and use it in GitHub Desktop.
Save Peaker/2865635 to your computer and use it in GitHub Desktop.
Illegal instance declaration, flexible instances?
{-# LANGUAGE TypeFamilies #-}
class Collection c where
type Element c
insert :: Element c -> c -> c
instance Collection [a] where
type Element [a] = a
insert = (:)
@Peaker
Copy link
Author

Peaker commented Jun 4, 2012

{-# LANGUAGE MultiParamTypeClasses #-}
class Collection c where
type Element c
insert :: Element c -> c -> c

instance Collection [a] where
type Element [a] = a
insert = (:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment