
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 } So, my question is: How can I solve this problem? Thanks in advance, Rodrigo.

On Tue, 3 Feb 2009 19:58:51 -0200
"rodrigo.bonifacio"
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

Actually, a list of list of literals is needed, since it's a Set Clause, and
a Clause is a [Literal].
On Tue, Feb 3, 2009 at 5:24 PM, Robin Green
On Tue, 3 Feb 2009 19:58:51 -0200 "rodrigo.bonifacio"
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 _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

On Tue, Feb 3, 2009 at 14:58, rodrigo.bonifacio
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 }
So, my question is: How can I solve this problem?
Assuming your list of clauses, you just need Data.Set.fromList: import qualified Data.Set as Set clauses :: [Clause] Set.fromList clauses :: Set Clause Denis
participants (4)
-
Andrew Wagner
-
Denis Bueno
-
Robin Green
-
rodrigo.bonifacio