
Ah. I had a suspicion it had to do with extensions. Got to study up on it.
Thanks
On Jan 25, 2016 12:42 AM, "Imants Cekusins"
Hello Daniel,
it works with these tweaks:
-- begin
{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances, FlexibleContexts #-} module TupInst where
data Tuple3 a b c = Tuple3 a b c deriving (Show)
data Tuple2 a b = Tuple2 a b deriving (Show)
class Indexable idx a where first :: idx -> a
instance Indexable (Tuple2 a b) a where first (Tuple2 a0 b0) = a0
instance Indexable (Tuple3 a b c) a where first (Tuple3 a0 b0 c0) = a0
-- end
call it in ghci like this:
first $ Tuple3 (1::Int) 'a' False::Int _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners