[Yhc] Trying to compile Fudgets with Yhc...

Dimitry Golubovsky golubovsky at gmail.com
Wed Jan 10 07:11:31 EST 2007


Hi,

I am trying to get some pieces of Fudgets work in Javascript, and
tried to compile some basic modules (stream processor primitives). My
goal is to be able to compile unmodified code in its current
(pre-cabalized) layout  (there are more than 300 modules in Fudgets,
so it is easy to break something if changing a lot)

I cannot compile EitherUtils.hs

http://www.golubovsky.org/repos/Fudgets/hsrc/utils/EitherUtils.hs

==========================
Compiling EitherUtils      (
../../../home/dima/ext/workdirs/Fudgets/hsrc/utils/EitherUtils.hs )
yhc: The class Prelude.Functor has no instance for the type Prelude.Maybe.
Possible sources for the problem are: 7:13-7:16
When type checking declarations at: 7:1-7:34
==========================

The line in question is:

plookup p = fmap snd . find (p.fst)

Commenting it out makes the module compilable, but plookup is indeed
used somewhere.

There was no needed instance in Prelude.hs. I added it  (from
Hugs, but I believe it is standard):

instance  Functor Maybe  where
    fmap _ Nothing       = Nothing
    fmap f (Just a)      = Just (f a)

and then recompiled everything under packages. The problem did not disappear.
I even replaced `import Maybe' with `import  Data.Maybe', it did not
help. I moved the instance definition to Data/Maybe.hs, again no help.

What could it be?

Thanks.

PS Fudgets were compilable by NHC98, weren't they?

-- 
Dimitry Golubovsky

Anywhere on the Web


More information about the Yhc mailing list