[Haskell-beginners] Check constructor's field numeric value at compile time

David Virebayre dav.vire+haskell at gmail.com
Mon Sep 8 14:31:54 UTC 2014


2014-09-03 5:07 GMT+02:00 Kim-Ee Yeoh <ky3 at atamo.com>:

>
> On Wed, Sep 3, 2014 at 2:32 AM, Dmitriy Matrosov <sgf.dma at gmail.com>
> wrote:
>
>> How can i write this constraints so they're checked at compile time, not
>> at runtime?
>
>
> Smart constructors won't check them at compile time but it does the next
> best thing, which is validate at the earliest possible moment.
>


In between compile time and runtime, you probably could use refinements
types; see LiquidHaskell (http://goto.ucsd.edu:8090/index.html,
https://github.com/ucsd-progsys/liquidhaskell/ )

David.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20140908/b9340c2e/attachment.html>


More information about the Beginners mailing list