
20 Dec
2007
20 Dec
'07
11:26 a.m.
david48 wrote:
class Gadget g where fInit :: g -> a -> g
data FString = FString !Int !String deriving Show
instance Gadget FString where
at this point fInit has this type: FString -> a -> FString
fInit (FString n _) s = FString n (take n s)
but your implementation has this type FString -> String -> FString These types are incompatible, your fInit implementation should be able to work with whatever type a the caller has choosen to provide. Maybe you should try one of class Gadget g where fInit :: g -> String -> g or class Gadget g a where fInit :: g -> a -> g instead. Tillmann