Thanks, this explanation is what I was looking for.   Wikipeidia has an
explanation on it also:

http://en.wikipedia.org/wiki/System_F#System

daryoush

On Wed, Feb 18, 2009 at 2:08 AM, Stephan Friedrichs <
deduktionstheo...@web.de> wrote:

> Daryoush Mehrtash wrote:
> > Is there a way to define a type with qualification on top of existing
> > type (e.g.  prime numbers)?   Say for example I want to define a
> > computation that takes a prime number and generates a string.   Is there
> > any way I can do that in Haskell?
>
> Haskell's type system is decidable, so you can't let the type system
> check arbitrary properties. It probably is possible in C++ by some
> template hack (C++ templates are Turing complete), but not in Haskell.
> But, as mentioned in the other responses, you can
>
>  - use a representation that makes it impossible to use wrong values
>   (-> Ketil's n-th prime representation)
>
>  - check values at runtime (-> Luke's repsonse)
>
> //Stephan
>
> --
>
> Früher hieß es ja: Ich denke, also bin ich.
> Heute weiß man: Es geht auch so.
>
>  - Dieter Nuhr
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to