[Haskell-beginners] haskell / prolog
dan portin
danportin at gmail.com
Tue Dec 21 07:09:26 CET 2010
Apparently the answer is to `:set FlexibleContexts` in GHCi in addition to
enabling the language extension in a source file. I was unaware it wasn't
enabled by default on interpreting the source.
On Mon, Dec 20, 2010 at 5:54 PM, dan portin <danportin at gmail.com> wrote:
> 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/1a8d8720/attachment.htm>
More information about the Beginners
mailing list