On Jan 28, 2008 12:45 AM,  <[EMAIL PROTECTED]> wrote:
> It seems strange that you need the types e and e' (perhaps this is a
> quirk or a bug of GHC 6.8). With GHC 6.6, I have derived the following
>
>
> instance (Floating f, MetricSpace e f, HFoldr ApplyDistSum Float l1 f,
>           HZip (HCons e l) (HCons e l) (HCons (e,e) l1))
>          => MetricSpace (HCons e l) f where
>     c `dist` c' = sqrt $ hFoldr ApplyDistSum (0::Float) (hZip c c')
>
> which matches my intuitive understanding, and also sufficient to run
> the given examples.

This also works in GHC 6.8.  Thanks!

> When I wrote `I derived with GHC' I meant it literally. First I wrote
> the instance without any constraints:
>
> instance ()
>          => MetricSpace (HCons e l) f where
>     c `dist` c' = sqrt $ hFoldr ApplyDistSum (0::Float) (hZip c c')
>
> GHC of course complained about many missing constraints. I started
> adding the constraints from the list of complaints, until GHC was
> satisfied. This is basically a cut-and-paste job from the Emacs buffer
> with GHC error messages to the buffer with the code.

Wow.  I will try this next time I post.  Thanks very much.

-- 
                              Denis
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to