[Haskell-cafe] Nice clean code example?

Jeffrey Brown jeffbrown.the at gmail.com
Fri Jun 30 21:39:22 UTC 2017


Jake Brownson wrote a game of tic-tac-toe in 160 lines[1] that I thought
was beautiful. I forked it to make it a little more readable[2].

[1] https://gist.github.com/jbrownson/712ddafd1cb3388cd827
[2]
https://github.com/JeffreyBenjaminBrown/play/blob/master/_not_music/jbrownson_tictactoe/it_modified.hs

On Fri, Jun 30, 2017 at 1:46 PM, Bram Neijt <bneijt at gmail.com> wrote:

> I have no idea what you consider clean. I have some ugly code that
> shows off some Haskell features:
>
> https://github.com/BigDataRepublic/hanon/blob/master/src/Mapper.hs
>
> I think it shows off:
> - Introducing types to create a language
> - Explicit IO, allowing for clear contract exposure to the user of the
> library?
> - defaultHighlighters is a subset of defaultInputPaths through a
> simple map allowing for easily exposing constrained subsets of code
> (not data)??
>
> if I would force myself to continue, the number of question marks
> would just increase, so I'll stop here.
>
> Best of luck!
>
> Bram
>
>
>
> On Fri, Jun 30, 2017 at 9:08 PM, Francesco Ariis <fa-ml at ariis.it> wrote:
> > On Fri, Jun 30, 2017 at 08:33:29PM +0200, Han Joosten wrote:
> >> I'd like to showoff some nice Haskell code to a CTO with no experience
> with
> >> FP. I promised to send him a small piece of Haskell so he could get an
> >> idea. The code should be easy to read, without obscure looking operators
> >> (so sorry, no lens, arrows stuff like that), optionally even do
> something
> >> interesting.
> >> Who has the nicest example laying around?
> >
> > Some ideas:
> >
> > - a wrongly typed piece of code: then show him a) how ghc(i) pinpoints
> > the problem part and is very clear in its demands ("I wanted this, you
> > gave me this") and b) how malleable the type system is.
> >
> > - a declarative graph made with diagrams (with a graphical result
> > displayed)
> >
> > - parsec (even if you go with applicative style, the code is very
> readable)
> > _______________________________________________
> > Haskell-Cafe mailing list
> > To (un)subscribe, modify options or view archives go to:
> > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> > Only members subscribed via the mailman list are allowed to post.
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
>



-- 
Jeff Brown | Jeffrey Benjamin Brown
Website <https://msu.edu/~brown202/>   |   Facebook
<https://www.facebook.com/mejeff.younotjeff>   |   LinkedIn
<https://www.linkedin.com/in/jeffreybenjaminbrown>(spammy, so I often miss
messages here)   |   Github <https://github.com/jeffreybenjaminbrown>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20170630/69d134b7/attachment.html>


More information about the Haskell-Cafe mailing list