[Haskell-cafe] Simple GADTs, type families and type classes combination with type error.

2011-07-22 Thread Serguey Zefirov
Why does GHC complains on the code below ? (I'll explain in a second a requirement to do just so) I get errors with ghc 6.12.1 and 7.0.2. - {-# LANGUAGE GADTs, TypeFamilies #-}

Re: [Haskell-cafe] Simple GADTs, type families and type classes combination with type error.

2011-07-22 Thread Felipe Almeida Lessa
On Fri, Jul 22, 2011 at 12:12 PM, Serguey Zefirov sergu...@gmail.com wrote: Why does GHC complains on the code below ? (I'll explain in a second a requirement to do just so) I don't why =(. But you can workaround by using class CPU cpu where data CPUFunc cpu Note that you don't need

Re: [Haskell-cafe] Simple GADTs, type families and type classes combination with type error.

2011-07-22 Thread Dan Doel
On Fri, Jul 22, 2011 at 11:12 AM, Serguey Zefirov sergu...@gmail.com wrote: - {-# LANGUAGE GADTs, TypeFamilies #-} class CPU cpu where        type CPUFunc cpu data Expr cpu

Re: [Haskell-cafe] Simple GADTs, type families and type classes combination with type error.

2011-07-22 Thread aditya siram
I just had a problem closely related to this on StackOverflow [1] which was explained beautifully by cammcann. The problem is that because type CPUFunc cpu is located inside the definition of the class CPU it creates the illusion that they are somehow tied together where CPUFunc is somehow in the

Re: [Haskell-cafe] Simple GADTs, type families and type classes combination with type error.

2011-07-22 Thread Serguey Zefirov
2011/7/22 Dan Doel dan.d...@gmail.com: On Fri, Jul 22, 2011 at 11:12 AM, Serguey Zefirov sergu...@gmail.com wrote: GHC cannot decide what instance of FuncVars to use. The signature of funcVars is:    funcVars :: FuncVars cpu = CPUFunc cpu - [String] This does not take any arguments that

Re: [Haskell-cafe] Simple GADTs, type families and type classes combination with type error.

2011-07-22 Thread Serguey Zefirov
2011/7/22 Felipe Almeida Lessa felipe.le...@gmail.com: On Fri, Jul 22, 2011 at 12:12 PM, Serguey Zefirov sergu...@gmail.com wrote: Why does GHC complains on the code below ? (I'll explain in a second a requirement to do just so) I don't why =(.  But you can workaround by using  class CPU

Re: [Haskell-cafe] Simple GADTs, type families and type classes combination with type error.

2011-07-22 Thread Dan Doel
On Fri, Jul 22, 2011 at 4:11 PM, Serguey Zefirov sergu...@gmail.com wrote: But cpu variable is the same in all places. If we don't dive into CPUFunc reduction (to Int or whatever) we can safely match funcVars argument and unify cpu. This is the case when we write generic functions over type