Re: [Haskell-cafe] [Q] multiparam class undecidable types

2012-05-10 Thread oleg
> 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

Re: [Haskell-cafe] [Q] multiparam class undecidable types

2012-05-09 Thread Matthias Fischmann
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

Re: [Haskell-cafe] [Q] multiparam class undecidable types

2012-05-08 Thread oleg
> | 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'

[Haskell-cafe] [Q] multiparam class undecidable types - how to get this example to typecheck?

2012-05-08 Thread Matthias Fischmann
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 |