[Haskell-beginners] Is it possible to check list length at compile time?
Kelong Cong
kelongcong at gmail.com
Tue Mar 17 22:50:19 UTC 2015
Thanks for the suggestion guys, I think the sized vector is just what I
needed!
I know about tuples but I can't use the usual list functions like map,
splitAt etc, also there is no need to have more than one data type.
On 17 March 2015 at 18:35, Konstantine Rybnikov <k-bx at k-bx.com> wrote:
> Hi Kelong!
>
> Check out
> https://hackage.haskell.org/package/sized-vector-0.0.2.0/docs/Data-Vector-Sized.html
> for a vector which has its size stored in type itself.
>
> Cheers.
>
> On Tue, Mar 17, 2015 at 7:26 PM, Kelong Cong <kelongcong at gmail.com> wrote:
>
>> Hello,
>>
>> I have a function that takes a list as its parameter. The list must
>> always have the same length, for example 16. Instead of producing a
>> "Nothing" or bottom out when an invalid list is supplied, are there ways to
>> verify this at compile time? If not, are there alternative data types that
>> has this kind of functionality?
>>
>> Thanks,
>> Kelong
>>
>>
>> _______________________________________________
>> Beginners mailing list
>> Beginners at haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>>
>>
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20150317/16e7abc6/attachment-0001.html>
More information about the Beginners
mailing list