I have thought of a few "functional patterns"
... there may be repeats in these as they were rattled off last night when I
was half asleep.
I must have missed some though ... anyone?
*) higher order functions (Abstraction)
*) Circular programming
*) Information hiding (combinators ... Monads)
*) Pipelining functions
*) Propogation of state (backwards)
*) Non-determinism
*) Intermediate representation (Pretty printer)
*) Exception monad (Can be viewed as null object in that we need not
constantly check for failure)
*) State monad
*) Iteration (flatten to list and process)
*) Functional dispatch (pattern match and carry out work in separate fns)
*) Memoise functions by using CAF arrays
*) Domain-specific processing (Little language)
*) Phantom types
*) Specialist data structure (Using Split lists rather than lists etc)
*) Null object (fail)
*) Unit object (return just))
*) Decoration [transform one structure into another]
(possibly use polymorphism to make strcutures the same but
parameterised)
*) (Concrete type-instantiation [Debugging])
*) abstract datatyping (monads)
*) Decouple pattern matching (arg1 then arg2 etc)[Chain of resonsibility]
*) Worker / wrapper pairing
*) Simulation (if haskell cannot do it then simulate this as little
language that can)
*) Return Maybe x rather than x and error as we can unwrap Maybe a into
a but not vice versa
*) Hints (strictify , dump state and continue)
*) Intermediate form (create syntax tree rather than string) chain of
responsibility
*) Non-trivial type synonyms
i.e. data Miles = Miles Int rather than
type Miles = Int
can remove later anyway
> -----Original Message-----
> From: Chris Angus [mailto:[EMAIL PROTECTED]]
> Sent: 11 September 2000 08:48
> To: 'Doug Ransom'; [EMAIL PROTECTED]
> Subject: RE: Patterns Catalog
>
>
> I've thought of this too.
> but I dont think there is anything out there
> which fits the bill.
> [I'd love someone to please correct me]
>
> btw for any folks out there who are thinking
> what the **** are patterns?
> http://www.enteract.com/~bradapp/docs/patterns-intro.html
>
> I think it would be a good thing to organise
> if anyone is willing to look ta this
> (If no-one is interested/ would rather do
> this) that person could be me as long as
> folk don't mind waiting a while for results.
>
> One obvious set of "patterns" could be thought of
> as the use of different monads.
>
> Unless anyone else wishes to be the contact point
> for this (Doug?) I suggest that if anyone has
> identified a functional pattern to email a brief
> set of details to (intially) me and I will either
> put hem together / forward them.
>
> For a starter we could have
>
> *) Using a monad to hide structure code in such
> a way as parameters are passed implicitly
>
> *) circular programming
>
>
>
>
> > -----Original Message-----
> > From: Doug Ransom [mailto:[EMAIL PROTECTED]]
> > Sent: 08 September 2000 21:04
> > To: [EMAIL PROTECTED]
> > Subject: Patterns Catalog
> >
> >
> > I have worked through "Haskell: The craft of functional
> programming".
> > Learning the language is one thing, applying FP is another.
> > The next thing
> > I would like to study would be a catalog of patterns for lazy
> > functional
> > programming. In the Object-oriented world, there are some
> catalogs of
> > useful program techniques. I would like to know if there is
> > anything like
> > that in the Haskell/Functional Programming world. It is not
> > clear to me
> > when and how to use higher-ordereredness outside of map,
> filter, some
> > partial applications and simple lambda expressions to be used
> > in the above.
> >
> >
> >
> > Is there a catalog of patterns or some other book useful in
> becoming a
> > skilled functional programmer?
> >
> >
> >
> >
> >
> >
> >
>