caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] type matching
@ 2004-09-17 14:53 Flávio Leonardo Cavalcanti de Moura
  2004-09-17 16:08 ` skaller
  0 siblings, 1 reply; 2+ messages in thread
From: Flávio Leonardo Cavalcanti de Moura @ 2004-09-17 14:53 UTC (permalink / raw)
  To: caml-list

Hi there, 

I am trying to build a normalisation function for lambda terms which
uses the leftmost strategy. Since the function is not working properly,
I decided to try it at the top level. So after loading some cmo and cma
bytecodes I got:

# let beta_normout l_upl = 
  let new_l_upl = ref l_upl in 
  let exp = ref (Common.first(List.hd !new_l_upl)) in 
    while (Common.pos_leftBR !exp <> [3]) do 
      new_l_upl := reduce_pure !exp 1 (Common.pos_leftBR !exp)
!new_l_upl;
      exp := (left_normal_lse !exp (Common.pos_leftBR !exp))
    done; 
    !new_l_upl;;
              val beta_normout :
  (Setypes.exlambda * int * int list * string) list ->
  (Setypes.exlambda * int * int list * string) list = <fun>

Then, when I try to run an example, I get:

# beta_normout [((A(L(DB 1),DB 2)),0,[],"")];;
Characters 14-41:
  beta_normout [((A(L(DB 1),DB 2)),0,[],"")];;
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
This expression has type exlambda * int * 'a list * string
but is here used with type Setypes.exlambda * int * int list * string

My dout is: shouldn't the type exlambda match with the type
Setypes.exlambda as well as 'a list with int list in the two last line
above?

Why Ocaml differ between the types Setypes.exlambda and exlambda?

I will be very happy if someone could help me.

best regards, 

Flavio.

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


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

* Re: [Caml-list] type matching
  2004-09-17 14:53 [Caml-list] type matching Flávio Leonardo Cavalcanti de Moura
@ 2004-09-17 16:08 ` skaller
  0 siblings, 0 replies; 2+ messages in thread
From: skaller @ 2004-09-17 16:08 UTC (permalink / raw)
  To: Flávio Leonardo Cavalcanti de Moura; +Cc: caml-list

On Sat, 2004-09-18 at 00:53, Flávio Leonardo Cavalcanti de Moura wrote:
> Hi there, 
> 
> I am trying to build a normalisation function for lambda terms which
> This expression has type exlambda * int * 'a list * string
> but is here used with type Setypes.exlambda * int * int list * string
> 
> My dout is: shouldn't the type exlambda match with the type
> Setypes.exlambda as well as 'a list with int list in the two last line
> above?
> 
> Why Ocaml differ between the types Setypes.exlambda and exlambda?

module type X = sig type t end
module Y = struct type t = int end

--> module Y : sig type t = int end


module Z : X = Y

--> module Z : X

let i : Y.t = 1

--> val x : Y.t = 1

let ni : Z.t = 1

--> This expression has type int but is here used with type Z.t

Y.t is just an alias for 'int'
However Z.t is an abstract type because X.t is.

-- 
John Skaller, mailto:skaller@users.sf.net
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language http://felix.sf.net



-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


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

end of thread, other threads:[~2004-09-17 16:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-17 14:53 [Caml-list] type matching Flávio Leonardo Cavalcanti de Moura
2004-09-17 16:08 ` skaller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).