Nice clean code example?

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? (and yes, I need it by yesterday ;-) ) Thanks!

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)

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
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.

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/jbrownso...
On Fri, Jun 30, 2017 at 1:46 PM, Bram Neijt
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
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

I wrote this specifically to be easy to read despite using some cool features (green threads, STM, etc.): https://github.com/wyager/Neks Will
On Jul 1, 2017, at 1:33 AM, 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?
(and yes, I need it by yesterday ;-) )
Thanks! _______________________________________________ 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.

Thanks everyone for the awsome examples. I really enjoy the deversity of
them. This tops my expectations 8-)
2017-07-01 3:43 GMT+02:00 Will Yager
I wrote this specifically to be easy to read despite using some cool features (green threads, STM, etc.):
https://github.com/wyager/Neks
Will
On Jul 1, 2017, at 1:33 AM, 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?
(and yes, I need it by yesterday ;-) )
Thanks!
_______________________________________________ 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.

This online book shows clear working examples in a variety of contexts :
http://book.realworldhaskell.org/read
Visitor is literally 2 clicks away from code examples in areas of interest
to them.
On 1 July 2017 at 13:08, Han Joosten
Thanks everyone for the awsome examples. I really enjoy the deversity of them. This tops my expectations 8-)
2017-07-01 3:43 GMT+02:00 Will Yager
: I wrote this specifically to be easy to read despite using some cool features (green threads, STM, etc.):
https://github.com/wyager/Neks
Will
On Jul 1, 2017, at 1:33 AM, 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?
(and yes, I need it by yesterday ;-) )
Thanks!
_______________________________________________ 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.
participants (6)
-
Bram Neijt
-
Francesco Ariis
-
Han Joosten
-
Imants Cekusins
-
Jeffrey Brown
-
Will Yager