Example with multi-parameter type classes and dependent types that
ghc-6.2.1 compiles but ghc-6-2-branch doesn't
George Russell
ger at informatik.uni-bremen.de
Wed Aug 25 03:22:49 EDT 2004
With ghc-6.2.1
# ghc -c Folders.hs -fglasgow-exts -fallow-undecidable-instances
(compiles with warnings)
With ghc-6-2-branch, downloaded from the read-only repository yesterday:
# /local/home/ger/fptools.install/bin/ghc -c Folders.hs -fglasgow-exts -fallow-undecidable-instances
Folders.hs:31:
Could not deduce (HMV x graph node)
from the context (HMV NodeArcsHidden graph node)
arising from use of `modd' at Folders.hs:31
Probable fix:
Add (HMV x graph node) to the type signature(s) for `gn'
In a lambda abstraction: \ graph node -> modd arcsHidden graph node
In a lambda abstraction:
\ arcsHidden -> (\ graph node -> modd arcsHidden graph node)
In the first argument of `fmap', namely
`(\ arcsHidden -> (\ graph node -> modd arcsHidden graph node))'
-------------- next part --------------
module Folders(
) where
data Folder = Folder
newtype SB x = SB x
newtype SS x = SS x
instance Functor SS
data NodeArcsHidden = NodeArcsHidden
class HasSS hasS x | hasS -> x where
toSS :: hasS -> SS x
instance HasSS (SB x) x where
toSS (SB x) = (SS x)
class HMV option graph node where
modd :: option -> graph -> node value -> IO ()
instance HMV NodeArcsHidden graph node => HMV (Maybe NodeArcsHidden) graph node
gn ::
HMV NodeArcsHidden graph node
=> graph
-> SS (graph -> node Int -> IO ())
gn graph =
fmap
(\ arcsHidden ->
(\ graph node -> modd arcsHidden graph node))
(toSS (error "C" :: SB (Maybe NodeArcsHidden)))
More information about the Cvs-ghc
mailing list