[Haskell-beginners] A simple function

David McBride toad3k at gmail.com
Thu Aug 30 15:14:34 CEST 2012


intercalate (a:b:_) (c:d:_) = [a,c,b,d]

On Thu, Aug 30, 2012 at 8:52 AM, Ezequiel Hernan Di Giorgi <
hernan.digiorgi at gmail.com> wrote:

> Hallo liebe Leute. Hola gente. I'm starting with Haskell and i have some
> problems:
>
> *intercalate :: [t] -> [t] -> [t]*
> *intercalate [a,b] [c,d] = [a,c,b,d]*
> *intercalate (_) (_) = error "JOJO u cant do this"*
>
>
> Are there any form to restrict the parmaters that only allow to call the
> function *intercalate* with two arrays of two elements, in compilation
> time? Cause i cant write* intercalete :: [t,t] -> [t,t]->[t,t,t,t]*.
>
> Sorry for my bad english. I'm Argentinean.
>
> Thanks!
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20120830/6e828791/attachment.htm>


More information about the Beginners mailing list