[Haskell-cafe] Dependently typed fold in GHC/Haskell

Christiaan Baaij christiaan.baaij at gmail.com
Wed Nov 19 15:25:21 UTC 2014


On Nov 19, 2014, at 3:59 PM, Richard Eisenberg <eir at cis.upenn.edu> wrote:

> You were really close, but there was a big leap that you would have to take before this would work. The fundamental problem is that you tried to use the `P` type family only partially applied. GHC does not allow partially-applied type functions. It is a bug in GHC 7.8.3 that no clear error is reported when you try to do so -- it is better in previous and later versions. (Specifically, I'm looking at the use of `P` in the type signature for `p` within `gconcat`.)

On Nov 19, 2014, at 3:37 PM, Andres Löh <andres.loeh at gmail.com> wrote:

> Hi.
> 
> You cannot partially apply a type family, as you try in
> 
>>> type family P (a :: *) (m :: Nat) (l :: Nat) :: * where
>>>  P a m l = Vec a (Plus l m)

Thank you very much for not only pointing out my mistake, but also providing a solution! :-D
Finally I can convert some of my list code to fixed-size vector code.

Cheers,

Christiaan


More information about the Haskell-Cafe mailing list