Created
June 4, 2012 00:27
-
-
Save dtchepak/2865610 to your computer and use it in GitHub Desktop.
Illegal instance declaration, flexible instances?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE MultiParamTypeClasses #-} | |
class Collection c a where | |
insert :: a -> c a -> c a | |
instance Collection [] a where | |
insert a b = (a:b) | |
{- | |
Illegal instance declaration for `Collection [] a' | |
(All instance types must be of the form (T a1 ... an) | |
where a1 ... an are *distinct type variables*, | |
and each type variable appears at most once in the instance head. | |
Use -XFlexibleInstances if you want to disable this.) | |
In the instance declaration for `Collection [] a' | |
-} | |
-- http://www.haskell.org/haskellwiki/List_instance |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment