To "instance C D", GHCI responds that C "is applied to too many type arguments".
jeff@jeffLenovUbu:~$ ghci -XNullaryTypeClasses GHCi, version 7.8.4: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Prelude> class C Prelude> data D = DConstructor Prelude> instance C D <interactive>:4:10: ‘C’ is applied to too many type arguments In the instance declaration for ‘C D’ Prelude>
Solved it. The problem was that in the class declaration I should include a type variable. jeff@jeffLenovUbu:~/work/computer/dwt/haskell$ ghci -XNullaryTypeClasses GHCi, version 7.8.4: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Prelude> data D = DConstructor Prelude> class C a -- earlier I omitted the a; that seems to have been the problem Prelude> instance C D Prelude> On Sat, Jun 13, 2015 at 12:03 AM, Jeffrey Brown <jeffbrown.the@gmail.com> wrote:
jeff@jeffLenovUbu:~$ ghci -XNullaryTypeClasses GHCi, version 7.8.4: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Prelude> class C Prelude> data D = DConstructor Prelude> instance C D
<interactive>:4:10: ‘C’ is applied to too many type arguments In the instance declaration for ‘C D’ Prelude>
participants (1)
-
Jeffrey Brown