> i think what i will do is to instantiate all table types individually:
> | instance Show c => Show (SimpleTable c) where
> | showsPrec p t = showParen (p > 10) $ showString "FastTable " .
> | shows (toLists t)
I was going to propose this solution, as we
Thanks Oleg,
that was very helpful. i can work with that. read the rest of this
if you are curious where your hints took me.
you are right, I need to make the functional dependency explicit:
| class Table t c | t -> c where
| toLists :: t -> [[c]]
| fromLists :: [[c]] -> t
|
| instanc
> | instance (Table a c, Show c) => Show a where
> I would have thought that there is on overlap: the instance in my code
> above defines how to show a table if the cell is showable;
No, the instance defines how to show values of any type; that type
must be an instance of Table. There is no `if'
Hi everybody,
I am torturing the ghc type inference extensions, and I think i
managed to break something, either in ghc or (more likely) in my
brain:
| {-# language FlexibleInstances, MultiParamTypeClasses, UndecidableInstances
#-}
|
| module Main
| where
|
| class Table table cell where
|