[Haskell-cafe] question on types
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)
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe