[Haskell-beginners] Re: Ambigous Types with Haskell Functional Graph Library

Christian Maeder Christian.Maeder at dfki.de
Wed Aug 19 11:16:41 EDT 2009


The type constructor variable "gr" can be instantiated with
"Data.Graph.Inductive.Tree.Gr" via a type signature:

Prelude Data.Graph.Inductive.Example> ucycle 5 ::
 Data.Graph.Inductive.Tree.Gr () ()

1:()->[((),2)]
2:()->[((),3)]
3:()->[((),4)]
4:()->[((),5)]
5:()->[((),1)]

HTH Christian

Joe Schafer wrote:
> Hey all,
> 
> New to Haskell and I'm trying to use the FGL but I keep running into the
> same error.
> 
> If I load Data.Graph.Inductive.Example and use one of the example
> functions such as ucycle I get:
> 
>     Ambiguous type variable `gr' in the constraint:
>       `Graph gr' arising from a use of `ucycle' at <interactive>:1:0-7
>     Probable fix: add a type signature that fixes these type variable(s)
> 
> Here's the type of ucycle for reference.
> 
> ucycle :: Graph gr => Int -> gr () ()
> 
> I'm using GHC 6.10.1 and FGL 5.4.2.2
> 
> Thanks,
> Joe


More information about the Beginners mailing list