<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Hi,</p>
<p>Use ScopedTypeVariables and forall:</p>
<p>{-# LANGUAGE ScopedTypeVariables #-}<br>
<br>
skips :: forall a. [a] -> [[a]]<br>
skips xs = go 1 [] where<br>
go :: Int -> [[a]] -> [[a]]<br>
<b> ...</b><br>
</p>
Sylvain<br>
<br>
<div class="moz-cite-prefix">On 14/11/2016 03:15, Lai Boon Hui
wrote:<br>
</div>
<blockquote
cite="mid:CAJdQggn8_8Wa7uvr2+0CWazZdeK+MGLKRh1PnUWOWOmNe+S8jw@mail.gmail.com"
type="cite">
<div dir="ltr">Hi all,
<div><br>
</div>
<div>
<div>
<div>skips :: [a] -> [[a]]</div>
<div>skips xs = go 1 [] where</div>
<div> go :: Int -> [[a]] -> [[a]] <b>-- Compiles if
i remove this line</b></div>
<div> go n acc</div>
<div> | n > (length xs) = acc</div>
<div> | n == 1 = xs : (go (n+1) acc)</div>
<div> | n < 1 = []</div>
<div> | otherwise = (everyN n xs) : (go (n+1) acc)</div>
<div><br>
</div>
<div>everyN :: Int -> [a] -> [a]</div>
<div>everyN n xs =</div>
<div> case (drop (n-1) xs) of</div>
<div> y:ys -> y : (everyN n ys)</div>
<div> [] -> []</div>
</div>
<div><br>
</div>
<div>How can i tell haskell compiler that a is the sub program
if the same as a in the main program?</div>
<div><br>
</div>
<div><br>
</div>
-- <br>
<div class="gmail_signature">
<div dir="ltr">Best Regards,
<div>Boon Hui</div>
</div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Beginners mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Beginners@haskell.org">Beginners@haskell.org</a>
<a class="moz-txt-link-freetext" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a>
</pre>
</blockquote>
<br>
</body>
</html>