Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
* Perplexing type error.
@ 1996-06-12  9:31 Michael Jones
  1996-06-12 18:42 ` Pierre Weis
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Jones @ 1996-06-12  9:31 UTC (permalink / raw)
  To: caml-list


Tres petit(e) abstract en Francais:
Il y a une "type error" que je ne comprende pas.  


While tweaking a preterm parser for type expressions in a proof assistant 
written in caml, I came across the following perplexing type error.  At first, 
it looked like a type inference problem so I specified the types in the 
generic function definitions and got a new error:

#Toplevel input:
>  and parse_pretypepred src = P_APPLY Pred (parse_preterm) src
>                                            ^^^^^^^^^^^^^
This expression has type lexcode list -> preterm * lexcode list,
but is used with type lexcode list -> preterm * lexcode list.
# _

So.  Any ideas why this is an error and how I can fix it?  I'm stumped.  The 
line with the error in it is part of a larger mutualy recursive function.  I 
am using caml-light-0.71 on a sun workstation and didn't see anything similar 
in the known bugs file.  

Some more detail about the line of code:  P_APPLY is a parser combinater that 
takes a function (Pred in this case) and applies it to the parser result.   
Pred is a type constructor for making pretypes out of preterms.  parse_preterm 
is the parser and src is the output of the lex. analyzer.  

regards,
mike.






^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Perplexing type error.
  1996-06-12  9:31 Perplexing type error Michael Jones
@ 1996-06-12 18:42 ` Pierre Weis
  0 siblings, 0 replies; 2+ messages in thread
From: Pierre Weis @ 1996-06-12 18:42 UTC (permalink / raw)
  To: Michael Jones; +Cc: caml-list


> Tres petit(e) abstract en Francais:
> Il y a une "type error" que je ne comprende pas.  

Le proble`me est bien connu et re'fe'rence' dans la FAQ. Regardez dans
http://pauillac.inria.fr/caml/FAQ/FAQ_EXPERT-fra.html, la premie`re
question sur le typage, qui s'intitule 
 <<Un type est incompatible avec lui-même ?>>
et doit re'pondre a` votre question. J'en extrais la conclusion:

La solution: quitter la session et tout recharger dans une nouvelle
session. Si le phénomène apparaît lors de la compilation d'un fichier,
il faut recompiler tous les fichiers dont il dépend. 

J'espe`re que ca marchera pour vous.

> While [...]
>
> This expression has type lexcode list -> preterm * lexcode list,
> but is used with type lexcode list -> preterm * lexcode list.
[...]

This is a well-known pitfall of ML, it is referenced in the Caml
FAQ. Have a look at
http://pauillac.inria.fr/caml/FAQ/FAQ_EXPERT-eng.html, the first
question about type checking is 
<<Error message: a type is not compatible with itself ?>>
it should answer to your question. The conclusion given here is:

Solution: quit your interactive system and reload your files in a new
session. If it appears when compiling a file, you have to recompile
all the files that your file depends upon.

Hope this helps,

Pierre Weis

INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis







^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1996-06-12 18:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-06-12  9:31 Perplexing type error Michael Jones
1996-06-12 18:42 ` Pierre Weis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox