[Haskell-cafe] Re: on finding abstractions ...

Heinrich Apfelmus apfelmus at quantentunnel.de
Tue Feb 16 11:48:43 EST 2010


Günther Schmidt wrote:
> I've got a problem, in short my haskell code sucks. While it does work
> and I do manage to use higher-orderish aspects quite extensively to make
> my code more concise it still is nowhere abstract, always concrete and
> thus always with lots of boilerplate.
> 
> Oh I have gotten better compared to when I started but on the
> abstraction slope I'm still stuck.
> 
> So fellows, what is the next stop on my road to enlightenment? I really
> think I need best to start from scratch. I think I'm sufficiently
> familiar now with most of Haskell's technicalities but how do I climb
> the ladder of abstraction?

As others said, there are already a few existing abstractions that you
can take advantage of, like applicative functors, functional references
(aka data-accessor) or monads; it pays to know them well.


Other than that, many abstractions will probably be some kind of domain
specific language. Since those are by definition specific to the problem
domain, it's hard to give general advice. I'd suggest to learn from
examples like

  Paul Hudak. The Design of a Pretty-printing Library.
  http://citeseer.ist.psu.edu/hughes95design.html

  Philip Wadler. A prettier printer.
  http://decenturl.com/homepages.inf.ed/wadler-98-prettier-printer

  Simon Peyton Jones, Jean-Marc Eber, Julian Seward.
  Composing contracts: an adventure in financial engineering.
  http://decenturl.com/research.microsoft/spj-financial-contracts



Regards,
Heinrich Apfelmus

--
http://apfelmus.nfshost.com



More information about the Haskell-Cafe mailing list