
25 Jan
2016
25 Jan
'16
2:42 a.m.
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