Re: [polyml] run-time cost of single-constructor datatypes

2010-03-04 Thread Brian Huffman
On Thu, Mar 4, 2010 at 9:46 AM, David Matthews wrote: > In Poly/ML a single constructor is the identity function Thanks, that's exactly what I needed to know. > There's no difference in implementation between an abstype and a datatype. > "abstype" is a very old construction in Standard ML and p

Re: [polyml] run-time cost of single-constructor datatypes

2010-03-04 Thread David Matthews
Brian Huffman wrote: Hello all, In Haskell, when I declare the following type: data Foo = MkFoo (Int, Bool) the constructor "MkFoo" has a run-time cost: A pointer must be dereferenced whenever I pattern-match on MkFoo, and memory is allocated when I apply the MkFoo constructor. On the other h

[polyml] run-time cost of single-constructor datatypes

2010-03-04 Thread Brian Huffman
Hello all, In Haskell, when I declare the following type: data Foo = MkFoo (Int, Bool) the constructor "MkFoo" has a run-time cost: A pointer must be dereferenced whenever I pattern-match on MkFoo, and memory is allocated when I apply the MkFoo constructor. On the other hand, if I declare this