If these are existential, then you can model it with a class hierarchy:

... | UnaryFuncApp of Unary<'a>

where

type Unary<'a>() = ... (* an abstract class *)

type ConcreteUnary<'a,'b>(v:Val<'b>, f:'b->'a) = inherit Unary<'a>() ...

and then the run-time type of each instance fixes the extra type variable. Depends on exactly how you intend to produce/consume/use the Val data, I suppose.

By on 4/1/2009 7:22 AM ()

I tried this out, but then started getting run-time errors (Unexpected concrete type) when 'a and 'b are different types in ConcreteUnary<'a,'b>. The type inference seems to be unhappy generalising over the free type 'b, and coerces it to be 'a. Providing a concrete instantiation where 'b is 'a works fine, but where they're different it breaks.

I can post more code if you'd find it useful to look at.

In the meantime I'm going to have to move some of my type checking from compile- to run-time.

Iain.

By on 4/6/2009 2:30 AM ()

As far as I know this is not possible.

I guess it's just not possible to give such a structure a concrete static type.

That's why the tuples are implemented the way they are (just take a look at them).

By on 4/1/2009 5:22 AM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper