[Haskell-cafe] question on types

Daryoush Mehrtash dmehrtash at gmail.com
Wed Feb 18 13:59:24 EST 2009

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



On Wed, Feb 18, 2009 at 2:08 AM, Stephan Friedrichs <
deduktionstheorem at 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 at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090218/e9126f1d/attachment.htm

More information about the Haskell-Cafe mailing list