Re: [Haskell-cafe] Re: Books for advanced Haskell

2010-03-08 Thread Yusaku Hashimoto
On Sun, Mar 7, 2010 at 10:53 PM, Stephen Tetley
stephen.tet...@gmail.com wrote:
 Hi All

 What is the state-of-the-practice in type-level programming?

 I know Günther started this thread about monads, but I seem to
 remember him having a long running problem with typeful database
 programming, and I wonder if some of his problems are really in the
 later area. Compared to monads, type-level programming seems much more
 a wild frontier - scattered docs, fewer definitive examples, no
 de-facto standard library.

So I want the book describes how to make type-level programming up to
the practice. I think this would cover how to provide simple interface
for types and contexts with full benefits, how to produce friendly
error message in type-errors, when to use UndecidableInstances, and
how to get rid of such itchy things.

-nwn
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Books for advanced Haskell

2010-03-07 Thread Heinrich Apfelmus
Dan Piponi wrote:
 Günther,
 
 A shining example are Dan Piponis blog posts.
 
 When you get stuck, post a comment saying where so that I can learn
 what people find difficult.

 On the other hand, I understand how intangible not-understanding can
 be, so it can be hard to point to where the problem is.

I'd wager that due to wildly different backgrounds, the difficulties are
also different for each person.

Lately, I've been dreaming about some kind of (online-) book that covers
the missing (Haskell) prerequisites in a modular fashion. I.e. when
writing a blog post, you no longer have to implicitly assume / guess
something about your readers' background, you can specify it explicitly,
something like this

module MyBlogPost where
import EverythingYouKnowAboutMonoids
import MonadsAsComputation
import IntuitionAboutDifferentialForms
import UnderstandingCurryHowards

The book itself would track internal dependencies in the same fashion.
Now, tracking each and every prerequisite is impossible, but some useful
approximation ought to be possible.


I remember a comment about people having trouble understanding monads on
#haskell that might be solved by such a book thing. Namely, the main
problem was that (a subset of) people simply lacked required Haskell
knowledge, like having a good grasp on the distinction between type and
type constructor, or being unfamiliar with Maybe.

Likewise, it appears that me that a substantial fraction of the comments
on RWH are actually about missing or just recently understood prerequisites.

Hence, I think that tracking prerequisites explicitly has potential.


Regards,
Heinrich Apfelmus

--
http://apfelmus.nfshost.com

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Books for advanced Haskell

2010-03-07 Thread Stephen Tetley
Hi All

What is the state-of-the-practice in type-level programming?

I know Günther started this thread about monads, but I seem to
remember him having a long running problem with typeful database
programming, and I wonder if some of his problems are really in the
later area. Compared to monads, type-level programming seems much more
a wild frontier - scattered docs, fewer definitive examples, no
de-facto standard library.

The HList paper provides an implementation of extensible records -
have people found it palatable in practice?

Roel van Dijk's Hackage rev-dependency page indicates only 1 package
depends on it, and HaskellDB appears, at least from a cursory look, to
support its own re-implementation of of HList.

Best wishes

Stephen
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Books for advanced Haskell

2010-03-05 Thread Günther Schmidt

Hi,

oh boy it took me a while to find this post again.



Perhaps not exactly. I build monads left and right, but that's because
I don't understand much else. :-) Before you get all hung up on them,
though, I recommend reading The Typeclassopedia,[1], which will
introduce you to all of the monad's friends and family.



When you say that you use monads to the left and right, do you mean 
using pre-defined monad instances, or do you construct your own, ie. 
define something to be an instance of a monad and then write codes using 
that instance?




Günther


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Books for advanced Haskell

2010-03-05 Thread Stephen Tetley
2010/3/5 Günther Schmidt gue.schm...@web.de:

 When you say that you use monads to the left and right, do you mean using
 pre-defined monad instances, or do you construct your own, ie. define
 something to be an instance of a monad and then write codes using that
 instance?

Hi Günther


One view of Monads (in the context of Haskell) is that they provide effects:

 - State Monad - state

 - Maybe monad - partiality (answer or failure)

 - Error monad - partiality with some answer type for the failure
(variation of Maybe)

 - Environment monad aka Reader - read only access to context

 - Writer monad - tracing - write only access to context

 - List monad - non-determinism

 - Resumption monad - interleaving for (simulating) concurrency


Because a monad (in the context of Haskell) is an implementation of
the Monad type class and the obligation to satisfy the monad laws,
there are quite few 'variations on a theme' monads  e.g.:

Jerzy Karczmarczuk's time travel State Monad
http://users.info.unicaen.fr/~karczma/arpap/revpearl.pdf

Ralf Hinze's - partial CPS monad Typed Quote/Antiquote
-- paper currently off-line unfortunately

The codensity monad - variation on the CPS monad
http://www.cs.nott.ac.uk/~gmh/wrapper2.pdf

Plus unique but currently rare monads, e.g:

Probability
http://web.engr.oregonstate.edu/~erwig/papers/PFP_JFP06.pdf


These latter monads still represent effects, and one should be able to
define them as transformers (I think, I haven't actually tried), but
they less common presumably because people have found less need for
the effects they provide.

There are also monads where I'd struggle to claim any analogous
'effect' (maybe they have one and I don't understand the presentation,
or maybe they don't actually have one) - generally these monads don't
seem to have escaped from the mathematical world to the Haskell world.

E.g. the monad of locales, power locales
http://www.cs.bham.ac.uk/~mhe/papers/pinjective.pdf


To work with monads in Haskell its not ignoble simple to decide what
effect or combination of effects you want and use the relevant monad
(for a single effect) or build a transformer (for multiple effects).

Best wishes

Stephen
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Books for advanced Haskell

2010-03-05 Thread Heinrich Apfelmus
Stephen Tetley wrote:

 To work with monads in Haskell its not ignoble simple to decide what
 effect or combination of effects you want and use the relevant monad
 (for a single effect) or build a transformer (for multiple effects).

... or use the free term algebra approach outlined in

  http://apfelmus.nfshost.com/articles/operational-monad.html

when the semantics of the effects are a bit tricky to fit into existing
transformers. My package operational

  http://projects.haskell.org/operational/

contains a bunch of examples.


Regards,
Heinrich Apfelmus

--
http://apfelmus.nfshost.com

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe