<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
Hi John,<br>
<br>
> In the class I wrote, c has kind * (e.g. [a]), but then I don't see<br>> how to write a suitable map function. For that, I would want c to<br>> have kind * -> *. Unfortunately then I don't know to write the<br>> others.<br>> <br>> Would I have to do something with c having kind (* -> *) ?<br>> <br>> class Chunkable2 c el where<br>> cLength :: c el -> Int<br>> cHead :: c el -> Maybe el<br>> cMap :: (el -> el') -> c el -> c el'<br><br>When c is (* -> *), why do you need el to be a parameter of the<br>
typeclass at all? I.e., would this work for your purposes:<br>
<br>
> class Chunkable3 c where<br>
> cLength :: c el -> Int<br>
> cHead :: c el -> Maybe el<br>
> cMap :: (a -> b) -> c a -> c b<br>
<br>
> instance Chunkable3 [] where<br>
> cLength = length<br>
> cMap = map<br>> cHead = ...<br><br>Using Functor as a superclass of Chunkable3 works too.<br>
<br>
Thanks,<br>
-Brian<br /><hr />check out the rest of the Windows Live™.
More than mail–Windows Live™ goes way beyond your inbox.
<a href='http://www.microsoft.com/windows/windowslive/' target='_new'>More than messages</a></body>
</html>