English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
obscur error message
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2010-01-26 (08:09)
From: Tiphaine Turpin <Tiphaine.Turpin@i...>
Subject: obscur error message

I'm puzzled about the type error returned with the following code (fix :
remove "fs"). Assuming value "mgu" and constructor "Var" are defined, is
it reasonable to report a type error about "subst" rather than the
unbound value "fs" ? I would expect the type-checker to first
successfully type the folded function, (with type (var_name * term) list
-> var_name * term -> (var_name * term) list) and then complain about
unbound value fs.


let genereal_unify subst eqs =
  List.fold_left (fun subst (x, t) -> mgu subst (Var x) t) subst fs eqs

File "prolog.ml", line 475, characters 42-47: (* i.e., second occurrence
of subst *))
Error: This expression has type 'a -> 'b but is here used with type
         (var_name * term) list