[Haskell-cafe] Nice clean code example?

Bram Neijt bneijt at gmail.com
Fri Jun 30 20:46:55 UTC 2017


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.


More information about the Haskell-Cafe mailing list