[Haskell-cafe] Converting Lists to Sets

Robin Green greenrd at greenrd.org
Tue Feb 3 17:24:13 EST 2009


On Tue, 3 Feb 2009 19:58:51 -0200
"rodrigo.bonifacio" <rodrigo.bonifacio at uol.com.br> wrote:

> Hi all,
> 
> I'm trying to use the Funsat library. One of its data types is CNF:
> 
> data CNF = CNF {
>  numVars :: Int
>  numClauses :: Int
>  clauses :: Set Clause
> }
> 
> I have a list of clauses, but I'm getting an error when converting
> such a list to a Set. Using the fromList function, the ghc compiler
> reports that the fromList function is not applicable to literals. 
> 
> type Clause = [Lit] 
> 
> newtype Lit = L {
>  unLit :: Int
> }
> 

You don't provide your code or the exact error message, which makes
it harder to diagnose - but I'd guess you are mistakenly trying to apply
fromList to a *single* literal, rather than a *list* of literals.
-- 
Robin


More information about the Haskell-Cafe mailing list