[Haskell-beginners] How to tell haskell that 'a' is 'a' ?
Lai Boon Hui
laiboonh at gmail.com
Mon Nov 14 02:15:23 UTC 2016
Hi all,
skips :: [a] -> [[a]]
skips xs = go 1 [] where
go :: Int -> [[a]] -> [[a]] *-- Compiles if i remove this line*
go n acc
| n > (length xs) = acc
| n == 1 = xs : (go (n+1) acc)
| n < 1 = []
| otherwise = (everyN n xs) : (go (n+1) acc)
everyN :: Int -> [a] -> [a]
everyN n xs =
case (drop (n-1) xs) of
y:ys -> y : (everyN n ys)
[] -> []
How can i tell haskell compiler that a is the sub program if the same as a
in the main program?
--
Best Regards,
Boon Hui
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20161114/53a1ad11/attachment.html>
More information about the Beginners
mailing list