I want to thank everybody for the kind
explanations of kind errors.
I think I now understand them (figured it out
through a LOT of trial and error). The problem
(as Carl and others noted) was I was testing
various ways of doing things using synonyms rather
than data types and didn't know that
Jacobson
Sent: Saturday, March 27, 2004 5:09 AM
To: Jon Fairbairn
Cc: [EMAIL PROTECTED]
Subject: Re: [Haskell-cafe] What are Kind errors and how do
you fix them?
Ok, I am still trying to understand kind errors and now have
a very simple class and types:
class MyClass a b where
Ok, I am still trying to understand kind errors
and now have a very simple class and types:
class MyClass a b where emptyVal::a b
type MyType a = [a]
type MyType2 = []
I can't figure out why some instance work and
others don't. e.g. this one works:
instance MyClass MyType2 a where
I dont understand what you are trying to do:
type ReverseType a string = (string -(string,a))
takes a string an returns a string and another value (looks like the
state monad with state=String.
data Reverse a string = Reverse (ReverseType a string)
this just declares a type
Erm... okay my mistake thats not the problem... although it is to
with state...
When decaring a monad the return type is included in the class
definition (it is a constructor class) This means the return value
MUST be the last parameter to the type, so you need:
type ReverseType a string =
On 2004-03-23 at 16:58EST S. Alexander Jacobson wrote:
Implementing Reverse from before, I am running
into this weird error:
type ReverseType a string = (string -(string,a))
data Reverse a string = Reverse (ReverseType a string)
instance Monad (Reverse a s) where
return x =
So if I want to use Monad, I have to have Reverse
only work with Strings and not some data type
that might be a String?
Is there a workaround that would allow me to
preserve flexibility around the target datatype?
Otherwise I'll rename Forward and Reverse to
toString and fromString, but the