[Haskell-cafe] Re: HList error with hFoldr

Denis Bueno dbueno at gmail.com
Sat Jan 26 14:40:54 EST 2008


On Sat, Jan 26, 2008 at 11:03 AM, Denis Bueno <dbueno at gmail.com> wrote:
>  Have I made some sort of simple error, or am I going about this the
>  wrong way altogether?

After some fooling around, I came up with something I think makes
sense.  Let me know if this is the right/wrong thing.  It seems to
work for the examples I've tried so far.

instance (Floating f, MetricSpace e f
         ,MetricSpace e' f, HZip l l (HCons (e', e') l')
         ,HFoldr ApplyDistSum Float l' f)
         => MetricSpace (HCons e l) f where
    c `dist` c' = sqrt $ hFoldr ApplyDistSum (0::Float) (hZip c c')

Thanks again for your help, oleg.

-- 
                              Denis


More information about the Haskell-Cafe mailing list