[redirected from haskell-list]
From: Matthias Fischmann <[EMAIL PROTECTED]>
Date: Sun, 1 Mar 1998 13:32:28 +0100 (MET)
Message-Id: <[EMAIL PROTECTED]>
Organization: MPII
To: [EMAIL PROTECTED]
Subject: type tags rejected
Hi all,
My problem is about tagging haskell expressions with the types I want
them to have. What is the compiler error "Can't for-all tye type
variable(s) `wef' in the inferred type `CONS ei f7t34 wef'" about? I
mean, when I get it, how can I get more information about what went
wrong? (I am thinking of something like a compiler switch that makes
ghc produce a file where every expression the input code is tagged
with the inferred type.)
Am I right in assuming that I can tag every expression in a module
except patterns?
I fear I have to beg your pardon for posting this clumsy and ugly
code, but whoever wants to have a look at it to locate my problem:
feel free to do so :-]. The errors are appended as comments and appear
in the marked lines (last case of definition of hom). You probably
should not pay too much attention to the other two cases and the data
involved in them. I am using ghc-2.10.
Thanks in advance for any hints,
Yours,
Matthias Fischmann
module Bug where import FiniteMap
data (Show sel, Eq sel) =>
B sel = FV String
| BV Int Int
| BO String (FiniteMap sel (B sel))
hom :: (Show sel, Eq sel, Show u, Eq u) =>
(z -> B sel -> u,
z -> B sel -> u,
z -> String -> FiniteMap sel u -> u,
z -> String -> sel -> z)
-> z -> B sel
-> u
hom (ffv, _, _, _) z (FV i) = ffv z (FV i)
hom (_, fbv, _, _) z (BV bp inx) = fbv z (BV bp inx)
hom fall@(_, _, fbo, abo) z (BO o fm) = fbo z o fm'
where
-- the next one is line 25: type tag is not correct for some reason
fm' :: (Show sel, Eq sel, Show u, Eq u) => FiniteMap sel u
fm' = mapFM adjust_and_apply fm
-- next line is 27: same problem.
adjust_and_apply :: (Show sel, Eq sel, Show u, Eq u) => sel -> B sel -> u
adjust_and_apply sel b = hom fall (abo z o sel) b
-- main.hs:25: A type signature is more polymorphic than the inferred type
-- Can't for-all the type variable(s) `taY3'
-- in the inferred type `FiniteMap taY3 taY9'
-- When checking signature for `fm''
-- In an equation for function `hom':
-- `hom (fall@(_, _, fbo, abo)) z (BO o fm)
-- = fbo z o fm'
-- where
-- adjust_and_apply ::
-- _forall_
-- [sel u]
-- (Show sel, Eq sel, Show u, Eq u)
-- =>
-- sel -> B sel -> u
-- adjust_and_apply sel b = hom fall (abo z o sel) b
-- fm' ::
-- _forall_
-- [sel u]
-- (Show sel, Eq sel, Show u, Eq u)
-- =>
-- FiniteMap sel u
-- fm' = mapFM adjust_and_apply fm'
-- main.hs:27: A type signature is more polymorphic than the inferred type
-- Can't for-all the type variable(s) `taWI', `taXP'
-- in the inferred type `taWI -> B taWI -> taXP'
-- When checking signature for `adjust_and_apply'
-- In an equation for function `hom':
-- `hom (fall@(_, _, fbo, abo)) z (BO o fm)
-- = fbo z o fm'
-- where
-- adjust_and_apply ::
-- _forall_
-- [sel u]
-- (Show sel, Eq sel, Show u, Eq u)
-- =>
-- sel -> B sel -> u
-- adjust_and_apply sel b = hom fall (abo z o sel) b
-- fm' ::
-- _forall_
-- [sel u]
-- (Show sel, Eq sel, Show u, Eq u)
-- =>
-- FiniteMap sel u
-- fm' = mapFM adjust_and_apply fm'
--
Max-Planck-Institut f|r Informatik, Saarbr|cken
http://www.mpi-sb.mpg.de/~fis/