* [Caml-list] what does this mean?
@ 2002-04-16 17:28 Garry Hodgson
2002-04-16 18:06 ` Eric C. Cooper
[not found] ` <3CBC64F8.B677F621@recherche.enac.fr>
0 siblings, 2 replies; 6+ messages in thread
From: Garry Hodgson @ 2002-04-16 17:28 UTC (permalink / raw)
To: ocaml
i'm getting en error message i don't understand in the following code
fragment. foo.ml is:
let regions = Hashtbl.create 64
type location = { name:string; mutable nodes:string list }
type region = { name:string; coords:(int*int*int*int); countries:string
list }
let addRegion name0 coords0 ccs =
let r = { name=name0; coords=coords0; countries=ccs } in
Hashtbl.add regions name0 r
when i comp[ile, i get:
$ ocamlc foo.ml
File "foo.ml", line 9, characters 13-20:
This expression has type ('a, 'b) Hashtbl.t but is here used with type
(string, region) Hashtbl.t
The type constructor region would escape its scope
can someone explain what this means, and perhaps how to resolve it?
thanks
--
Garry Hodgson Let my inspiration flow
Senior Hacker in token rhyme suggesting rhythm
Software Innovation Services that will not forsake me
AT&T Labs 'til my tale is told and done.
garry@sage.att.com
-------------------
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] 6+ messages in thread
* Re: [Caml-list] what does this mean?
2002-04-16 17:28 [Caml-list] what does this mean? Garry Hodgson
@ 2002-04-16 18:06 ` Eric C. Cooper
2002-04-16 19:26 ` Garry Hodgson
[not found] ` <3CBC64F8.B677F621@recherche.enac.fr>
1 sibling, 1 reply; 6+ messages in thread
From: Eric C. Cooper @ 2002-04-16 18:06 UTC (permalink / raw)
To: ocaml
On Tue, Apr 16, 2002 at 01:28:23PM -0400, Garry Hodgson wrote:
>
> i'm getting en error message i don't understand in the following code
> fragment. foo.ml is:
>
> let regions = Hashtbl.create 64
>
> type region = { name:string; coords:(int*int*int*int); countries:string
> list }
>
> let addRegion name0 coords0 ccs =
> let r = { name=name0; coords=coords0; countries=ccs } in
> Hashtbl.add regions name0 r
>
> when i comp[ile, i get:
>
> $ ocamlc foo.ml
> File "foo.ml", line 9, characters 13-20:
> This expression has type ('a, 'b) Hashtbl.t but is here used with type
> (string, region) Hashtbl.t
> The type constructor region would escape its scope
>
> can someone explain what this means, and perhaps how to resolve it?
> thanks
The problem is that you create the regions hash table before defining
the region type. Just move the type definition to the top, before
creating any data structures that might use it.
--
Eric C. Cooper e c c @ c m u . e d u
-------------------
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] 6+ messages in thread
* Re: [Caml-list] what does this mean?
2002-04-16 18:06 ` Eric C. Cooper
@ 2002-04-16 19:26 ` Garry Hodgson
0 siblings, 0 replies; 6+ messages in thread
From: Garry Hodgson @ 2002-04-16 19:26 UTC (permalink / raw)
To: ocaml
"Eric C. Cooper" wrote:
>
> On Tue, Apr 16, 2002 at 01:28:23PM -0400, Garry Hodgson wrote:
> >
> > i'm getting en error message i don't understand in the following code
> > fragment. foo.ml is:
> >
> > let regions = Hashtbl.create 64
> >
> > type region = { name:string; coords:(int*int*int*int); countries:string
> > list }
> >
> > let addRegion name0 coords0 ccs =
> > let r = { name=name0; coords=coords0; countries=ccs } in
> > Hashtbl.add regions name0 r
> >
> > when i comp[ile, i get:
> >
> > $ ocamlc foo.ml
> > File "foo.ml", line 9, characters 13-20:
> > This expression has type ('a, 'b) Hashtbl.t but is here used with type
> > (string, region) Hashtbl.t
> > The type constructor region would escape its scope
> >
> > can someone explain what this means, and perhaps how to resolve it?
> > thanks
>
> The problem is that you create the regions hash table before defining
> the region type. Just move the type definition to the top, before
> creating any data structures that might use it.
that was it. my thanks, to you and the others who pointed this out in
email.
--
Garry Hodgson Let my inspiration flow
Senior Hacker in token rhyme suggesting rhythm
Software Innovation Services that will not forsake me
AT&T Labs 'til my tale is told and done.
garry@sage.att.com
-------------------
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] 6+ messages in thread
[parent not found: <3CBC64F8.B677F621@recherche.enac.fr>]
* [Caml-list] What does this mean?
@ 2004-04-13 4:26 skaller
2004-04-13 14:00 ` skaller
0 siblings, 1 reply; 6+ messages in thread
From: skaller @ 2004-04-13 4:26 UTC (permalink / raw)
To: caml-list
Can someone explain what this means ..
Invalid_argument("equal: abstract value")
The code is below. I am fairly sure the problem
occurs in 'assoc' trying to compare two terms
for equality.
This piece of code unravels a Felix expression term
into a three-address-code, the equality comparison
is used to eliminate common subexpressions.
let unravel syms e =
let sube = ref [] in
let get e =
try assoc e !sube
with Not_found ->
let n = !(syms.counter) in incr (syms.counter);
let name = "_tmp" ^ si n in
sube := (e,name) :: !sube;
name
in
let refer ((_,t) as e) =
`BEXPR_expr (get e,t),t
in
let idt t = t in
let e' =
let rec aux e =
match e with
| `BEXPR_apply ((`BEXPR_name _,_) as f, b),t
| `BEXPR_apply ((`BEXPR_closure _,_) as f, b),t ->
`BEXPR_apply (f, aux b),t
| `BEXPR_apply (f,b),t -> `BEXPR_apply(aux f, aux b),t
| `BEXPR_tuple ls,t -> `BEXPR_tuple (map aux ls),t
| (`BEXPR_name _,t) as x -> x
| x -> refer x
in
aux e
in !sube,e
--
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] 6+ messages in thread
end of thread, other threads:[~2004-04-13 14:00 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-16 17:28 [Caml-list] what does this mean? Garry Hodgson
2002-04-16 18:06 ` Eric C. Cooper
2002-04-16 19:26 ` Garry Hodgson
[not found] ` <3CBC64F8.B677F621@recherche.enac.fr>
[not found] ` <3CBC7B46.9EB83B57@sage.att.com>
2002-04-17 9:18 ` Nicolas barnier
2004-04-13 4:26 [Caml-list] What " skaller
2004-04-13 14:00 ` skaller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox