[Haskell-beginners] haskell / prolog

dan portin danportin at gmail.com
Tue Dec 21 02:54:12 CET 2010


I recently discovered that class and instance declarations in Haskell are
Horn clauses. So I encoded the arithmetic operations from the first chapter
of *Art of Prolog* into Haskell, in the standar

fac(0,s(0)).
fac(s(N),F) :- fac(N,X), mult(s(N),X,F).

class Fac x y | x -> y
instance Fac Z (S Z)
instance (Fac n x, Mult (S n) x f) => Fac (S n) f

I don't understand, however, to make Haskell instantiate values for
variables in a proof. I.e., I don't understand what the Haskell equivalent
of

?- fac(X,Y)

would be for some value of X.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20101220/6aa06d7f/attachment-0001.htm>


More information about the Beginners mailing list