<div dir="ltr"><div>Hi Alexander,</div><div><br></div><div>> Prelude> :t foldr</div><div>> foldr :: Foldable t => (a -> b -> b) -> b -> t a -> b</div><div>> For example:</div><div>> foldr :: (a -> b -> b) -> b -> [a] -> b</div><div>> foldr :: (a -> b -> b) -> b -> Maybe a -> b</div><div>> foldr :: (a -> b -> b) -> b -> Identity a -> b</div><div>> foldr :: (a -> b -> b) -> b -> (c, a) -> b</div><div>> and more</div><div>> </div><div>> It is easy to see a pattern here.  The order of the instances used could be the load order, so the ones from Prelude would come first.</div><div><br></div><div>interesting idea.</div><div>It's ":t" 's verbose representation mode.</div><div><br></div><div>The ghci represents true type (not lie) and</div><div>beginners may intuitively understand the relation between</div><div>Foldable type class and instances.</div><div><br></div><div>Beginners will be overcome FTP more easily.</div><div><br></div><div><br></div><div><br></div><div>> Prelude> :t ($)</div><div>> ($) :: <"unreadable blurb"></div><div>> For example:</div><div>> ($) :: (a -> b) -> a -> b</div><div>> ($) :: forall a (b :: #). (a -> b) -> a -> b</div><div>></div><div>> At least one of those lines should be understandable.</div><div><br></div><div>It's one of the options.</div><div>But I feel that Levity (or RuntimeRep) is more deep than the type class.</div><div>They may feel difficult to understand the difference of two patterns in ($).</div><div><br></div><div>(If it will be long, it's better to separate thread =) )</div><div><br></div><div>Regards,</div><div>Takenobu</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-02-16 16:28 GMT+09:00 Alexander Kjeldaas <span dir="ltr"><<a href="mailto:alexander.kjeldaas@gmail.com" target="_blank">alexander.kjeldaas@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Fri, Feb 5, 2016 at 2:16 PM, Takenobu Tani <span dir="ltr"><<a href="mailto:takenobu.hs@gmail.com" target="_blank">takenobu.hs@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi,</div><div><br></div><div>I'll worry about the learning curve of beginners.</div><div>Maybe, beginners will try following session in their 1st week.</div><div><br></div><div>  ghci> :t foldr</div><div>  ghci> :t ($)</div><div><br></div><div>They'll get following result.</div><div><br></div><div><br></div><div>Before ghc7.8:</div><div><br></div><div>  Prelude> :t foldr</div><div>  foldr :: (a -> b -> b) -> b -> [a] -> b</div><div><br></div><div>  Prelude> :t ($)</div><span><div>  ($) :: (a -> b) -> a -> b</div><div><br></div></span><div>  Beginners should only understand about following:</div><div><br></div><div>    * type variable (polymorphism)</div><div><br></div><div><br></div><div>After ghc8.0:</div><div><br></div><div>  Prelude> :t foldr</div><div>  foldr :: Foldable t => (a -> b -> b) -> b -> t a -> b</div><div><br></div></div></blockquote></span><div><br><div>If the output was the following it would be more understandable (and more encouraging!)<br><br>"""<br></div><span class="">Prelude> :t foldr<br><div>foldr :: Foldable t => (a -> b -> b) -> b -> t a -> b<br></div></span><div>For example:<br></div><span class=""><div>foldr :: (a -> b -> b) -> b -> [a] -> b<br></div></span><div>foldr :: (a -> b -> b) -> b -> Maybe a -> b<br></div><div>foldr :: (a -> b -> b) -> b -> Identity a -> b<br></div><div>foldr :: (a -> b -> b) -> b -> (c, a) -> b<br></div>and more<br>"""<br><br></div><div>It is easy to see a pattern here.  The order of the instances used could be the load order, so the ones from Prelude would come first.<br></div><span class=""><div><br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div></div><div>  Prelude> :t ($)</div><div>  ($)</div><div>    :: forall (w :: GHC.Types.Levity) a (b :: TYPE w).</div><span><div>       (a -> b) -> a -> b</div><div><br></div></span></div></blockquote><div><br></div></span><div>I'm not sure how this would work here, but when Levity is *, this should collapse into the old syntax, so:<br><br>"""<br></div><div>Prelude> :t ($)<br>($) :: <"unreadable blurb"><br></div><div>For example:<span class=""><br>($) :: (a -> b) -> a -> b<br></span></div><div>($) :: forall a (b :: #). (a -> b) -> a -> b</div><div>"""<br><br></div><div>At least one of those lines should be understandable.<span class="HOEnZb"><font color="#888888"><br></font></span></div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Alexander<br></div><br></font></span></div></div></div>
</blockquote></div><br></div>