https://wiki.haskell.org/api.php?action=feedcontributions&user=Ysangkok&feedformat=atomHaskellWiki - User contributions [en]2020-02-29T10:58:14ZUser contributionsMediaWiki 1.27.4https://wiki.haskell.org/index.php?title=MonadFail_Proposal&diff=63040MonadFail Proposal2019-09-25T01:17:43Z<p>Ysangkok: /* Adapting old code */ ghc 7.16 is ghc 8.8</p>
<hr />
<div>'''Note:''' this proposal page has been moved to [https://prime.haskell.org/wiki/Libraries/Proposals/MonadFail the Haskell Prime Wiki]; the article below is unmaintained.<br />
<br />
<br />
== <code>MonadFail</code> proposal (MFP) ==<br />
<br />
A couple of years ago, we proposed to make <code>Applicative</code> a superclass of <code>Monad</code> which successfully killed the single most ugly thing in Haskell as of GHC 7.10.<br />
<br />
Now, it's time to tackle the other major issue with <code>Monad</code> <code>fail</code> being a part of it.<br />
<br />
You can contact me as usual via IRC/Freenode as ''quchen'', or by email to ''dluposchainsky at the email service of Google''. This file was posted on the ghc-devs@ and [http://permalink.gmane.org/gmane.comp.lang.haskell.libraries/24910 libraries@ mailing lists], as well as on [http://www.reddit.com/r/haskell/comments/397k1a/monadfail_proposal_mfp_moving_fail_out_of_monad/ Reddit].<br />
<br />
This proposal was first posted on [https://github.com/quchen/articles/blob/master/monad_fail.md quchen's articles Github repo].<br />
<br />
=== Overview ===<br />
<br />
* '''The problem''' - reason for the proposal<br />
* '''MonadFail class''' - the solution<br />
* '''Discussion''' - explaining our design choices<br />
* '''Adapting old code''' - how to prepare current code to transition smoothly<br />
* '''Estimating the breakage''' - how much stuff we will break<br />
* '''Transitional strategy''' - how to break as little as possible while transitioning<br />
* '''Current status'''<br />
<br />
=== The problem ===<br />
<br />
Currently, the <code><-</code> symbol is unconditionally desugared as follows:<br />
<br />
<syntaxhighlight lang="haskell"><br />
do pat <- computation >>> let f pat = more<br />
more >>> f _ = fail "..."<br />
>>> in computation >>= f<br />
</syntaxhighlight><br />
<br />
The problem with this is that <code>fail</code> cannot (!) be sensibly implemented for many monads, for example <code>Either</code>, <code>State</code>, <code>IO</code>, and <code>Reader</code>. In those cases it defaults to <code>error</code> As a consequence, in current Haskell, you can not use <code>Monad</code> polymorphic code safely, because although it claims to work for all <code>Monad</code> , it might just crash on you. This kind of implicit non-totality baked into the class is ''terrible''.<br />
<br />
The goal of this proposal is adding the <code>fail</code> only when necessary and reflecting that in the type signature of the <code>do</code> block, so that it can be used safely, and more importantly, is guaranteed not to be used if the type signature does not say so.<br />
<br />
=== <code>MonadFail</code> class ===<br />
<br />
To fix this, introduce a new typeclass:<br />
<br />
<syntaxhighlight lang="haskell"><br />
class Monad m => MonadFail m where<br />
fail :: String -> m a<br />
</syntaxhighlight><br />
<br />
Desugaring can now be changed to produce this constraint when necessary. For this, we have to decide when a pattern match can not fail; if this is the case, we can omit inserting the <code>fail</code> call.<br />
<br />
The most trivial examples of unfailable patterns are of course those that match anywhere unconditionally,<br />
<br />
<syntaxhighlight lang="haskell"><br />
do x <- action >>> let f x = more<br />
more >>> in action >>= f<br />
</syntaxhighlight><br />
<br />
In particular, the programmer can assert any pattern be unfailable by making it irrefutable using a prefix tilde:<br />
<br />
<syntaxhighlight lang="haskell"><br />
do ~pat <- action >>> let f ~pat = more<br />
more >>> in action >>= f<br />
</syntaxhighlight><br />
<br />
A class of patterns that are conditionally failable are <code>newtype</code> , and single constructor <code>data</code> types, which are unfailable by themselves, but may fail if matching on their fields is done with failable patterns.<br />
<br />
<syntaxhighlight lang="haskell"><br />
data Newtype a = Newtype a<br />
<br />
-- "x" cannot fail<br />
do Newtype x <- action >>> let f (Newtype x) = more<br />
more >>> in action >>= f<br />
<br />
-- "Just x" can fail<br />
do Newtype (Just x) <- action >>> let f (Newtype (Just x)) = more<br />
more >>> f _ = fail "..."<br />
>>> in action >>= f<br />
</syntaxhighlight><br />
<br />
<code>ViewPatterns</code> are as failable as the pattern the view is matched against. Patterns like <code>(Just -> Just x)</code> should generate a <code>MonadFail</code> constraint even when it's "obvious" from the view's implementation that the pattern will always match. From an implementor's perspective, this means that only types (and their constructors) have to be looked at, not arbitrary values (like functions), which is impossible to do statically in general.<br />
<br />
<syntaxhighlight lang="haskell"><br />
do (view -> pat) <- action >>> let f (view -> pat) = more<br />
more >>> f _ = fail "..."<br />
>>> in action >>= f<br />
<br />
do (view -> ~pat) <- action >>> let f (view -> ~pat) = more<br />
more >>> in action >>= f<br />
</syntaxhighlight><br />
<br />
[Edward Kmett: `(view -> pat)` should be unfailing iff pat is unfailing.]<br />
<br />
A similar issue arises for <code>PatternSynonyms</code> which we cannot inspect during compilation sufficiently. A pattern synonym will therefore always be considered failable.<br />
<br />
<syntaxhighlight lang="haskell"><br />
do PatternSynonym x <- action >>> let f PatternSynonym x = more<br />
more >>> f _ = fail "..."<br />
>>> in action >>= f<br />
</syntaxhighlight><br />
<br />
[Edward Kmett: We have the contents of the pattern synonym available to us at the definition site. With some work we should be able to expose it enough that the compiler can see through it:<br />
<br />
<syntaxhighlight lang="haskell"><br />
pattern Foo a b = Bar a 0 b<br />
pattern Baz a b c <- Quux a b c<br />
</syntaxhighlight><br />
<br />
Both of those tell us the "real" desugaring as just another pattern we could recurse into.]<br />
<br />
=== Discussion ===<br />
<br />
* What laws should <code>fail</code> follow?<br />
** '''Left zero''': <code>∀ s f. fail s >>= f ≡ fail s</code>.<br />
** '''Right zero''': <code>∀ v s. v >> fail s ≡ fail s</code>.<br />
* What is the relationship to <code>MonadPlus</code>?<br />
** As the laws above indicate, <code>fail</code> is a close relative of <code>mzero</code>. We could suggest a default definition of <code>fail _ = mzero</code>, which shows the intended usage and effect of the <code>MonadFail</code> class.<br />
** However, we should not remove <code>fail</code> and use only <code>mzero</code> instead. <br />
*** Not all types with <code>Monad</code> instances have <code>MonadPlus</code> instances.<br />
*** Some types do use the <code>String</code> argument to <code>fail</code>. For example, a parser might fail with a message involving positional information. <code>Binary</code> uses <code>fail</code> as their only interface to fail a decoding step.<br />
*** Some types have different definitions for <code>mzero</code> and <code>fail</code>. Although <code>STM</code> is <code>MonadPlus</code> it uses the default <code>fail = error</code>. It should therefore not get a <code>MonadFail</code> instance.<br />
* Rename <code>fail</code>?<br />
** '''No.''' Old code might use <code>fail</code> explicitly and we should avoid breaking it. The Report talks about <code>fail</code> and we have a solid migration strategy that does not require a renaming.<br />
* Remove the <code>String</code> argument?<br />
** '''No.''' The <code>String</code> might help error reporting and debugging. <code>String</code> may be ugly, but it's the de facto standard for simple text in GHC. No high performance string operations are to be expected with <code>fail</code> so this breaking change would in no way be justified. Also note that explicit <code>fail</code> calls would break if we removed the argument.<br />
* How sensitive would existing code be to subtle changes in the strictness behaviour of <code>do</code> notation pattern matching?<br />
** '''It doesn't.''' The implementation does not affect strictness at all, only the desugaring step. Care must be taken when fixing warnings by making patterns irrefutable using <code>~</code> as that ''does'' affect strictness. (Cf. difference between lazy/strict State)<br />
* Do we need a class constraint (e.g. <code>Monad</code>) on <code>MonadFail</code>?<br />
** '''Yes.''' The intended use of <code>fail</code> is for desugaring <code>do</code>-notation, not generally for any <code>String -> m a</code> function. Given that goal, we would rather keep the constraints simple as <code>MonadFail m =></code> rather than the somewhat redundant <code>(Monad m, MonadFail m) =></code>.<br />
* Can we relax the class constraint from <code>Monad</code> to <code>Applicative</code>?<br />
** We don't necessarily have to choose now. Since <code>Applicative</code> is a superclass of <code>Monad</code>, it is possible to change the superclass for <code>MonadFail</code> to <code>Applicative</code> later. This will naturally require a migration period, and the name will, of course, become misleading.<br />
** For the sake of discussion, let's use the following definition:<syntaxhighlight lang="haskell">class Applicative f => ApplicativeFail f where fail :: String -> f a</syntaxhighlight><br />
** '''Pros'''<br />
*** <code>ApplicativeDo</code> is coming, and <code>fail</code> may be useful to combine pattern matching and <code>Applicative</code> code.<br />
*** If the <code>Monad</code> constraint is kept, that would force <code>Applicative</code> code with pattern matching to be <code>Monad</code> code.<br />
** '''Cons'''<br />
*** The constraints for <code>Monad</code> code using <code>fail</code> become <code>(Monad m, ApplicativeFail m) =></code> instead of the simpler <code>MonadFail m =></code>. If we expect the common use of <code>fail</code> to be in <code>Monad</code> — not <code>Applicative</code> — <code>do</code>-notation, this leaves us with more verbose constraints.<br />
** Here are alternative definitions (with names open to debate) that would allow us to keep the constraints simple:<br />
*** <syntaxhighlight lang="haskell">class Applicative f => ApplicativeFail f where failA :: String -> f a</syntaxhighlight><br />
*** <syntaxhighlight lang="haskell">class ApplicativeFail m => MonadFail m where fail :: String -> m a; fail = failA</syntaxhighlight><br />
*** Since we do not have much experience using <code>ApplicativeDo</code>, it is not yet clear that this large of a change is useful.<br />
* Which types with <code>Monad</code> instances will not have <code>MonadFail</code> instances?<br />
** <code>base</code>: <code>Either</code><br />
** <code>transformers</code>:<br />
** <code>stm</code>: <code>STM</code><br />
* What <code>MonadFail</code> instances will be created?<br />
** <code>base</code>: <code>IO</code><br />
** <code>transformers</code>:<br />
*** Proposal for an <code>Either</code> instance using <code>Monad</code> instance in <code>Control.Monad.Trans.Error</code>:<syntaxhighlight lang="haskell">instance MonadFail (Either String) where fail = Left </syntaxhighlight><br />
<br />
=== Adapting old code ===<br />
<br />
<ul><br />
<li>Help! My code is broken because of a missing <code>MonadFail</code> instance! ''Here are your options:''<br />
<ol><li>Write a <code>MonadFail</code> instance (and bring it into scope)<br />
<syntaxhighlight lang="haskell"><br />
#if !MIN_VERSION_base(4,11,0)<br />
-- Control.Monad.Fail import is redundant since GHC 8.8.1<br />
import qualified Control.Monad.Fail as Fail<br />
#endif<br />
import Control.Monad<br />
<br />
instance Monad Foo where<br />
(>>=) = <...bind impl...><br />
-- NB: <code>return</code> defaults to <code>pure</code><br />
#if !MIN_VERSION_base(4,11,0)<br />
-- Monad(fail) was removed in GHC 8.8.1<br />
fail = Fail.fail<br />
#endif<br />
<br />
instance MonadFail Foo where<br />
fail = <...fail implementation...><br />
</syntaxhighlight></li><br />
<li>Change your pattern to be irrefutable</li><br />
<li>Emulate the old behaviour by desugaring the pattern match by hand:<br />
<syntaxhighlight lang="haskell"><br />
do Left e <- foobar<br />
stuff<br />
</syntaxhighlight> becomes <syntaxhighlight lang="haskell"><br />
do x <- foobar<br />
e <- case x of<br />
Left e' -> e'<br />
Right r -> error "Pattern match failed" -- Boooo<br />
stuff<br />
</syntaxhighlight><br />
The point is you'll have to do your dirty laundry yourself now if you have a value that ''you'' know will always match, and if you don't handle the other patterns you'll get incompleteness warnings, and the compiler won't silently eat those for you.</li><br />
</ol></li><br />
<li>Help! My code is broken because you removed <code>fail</code> from <code>Monad</code> but my class defines it! ''Delete that part of the instance definition.''</li></ul><br />
<br />
=== Esimating the breakage ===<br />
<br />
Using our initial implementation, I compiled stackage-nightly, and grepped the logs for the warnings. Assuming my implementation is correct, the number of "missing <code>MonadFail</code> warnings generated is 487. Note that I filtered out <code>[]</code> <code>Maybe</code> and <code>ReadPrec</code> since those can be given a <code>MonadFail</code> instance from within GHC, and no breakage is expected from them.<br />
The build logs can be found [https://www.dropbox.com/s/knz0i979skam4zs/stackage-build.tar.xz?dl=0 here]. Search for "failable pattern" to find your way to the still pretty raw warnings.<br />
<br />
Here are some commands you might find interesting for exploring the logs:<br />
<br />
<syntaxhighlight lang="bash"><br />
# List all packages generating warnings (57 of them)<br />
grep "is used in the context" '' | \<br />
grep -v '(‘\[|Maybe|ReadPrec)' | \<br />
perl -pe 's#^(.'')\.log.''$#\1#' | \<br />
uniq -u<br />
<br />
# Histogram of the breaking contexts (mostly IO and parsers)<br />
grep "is used in the context" '' | \<br />
grep -v '(‘\[|Maybe|ReadPrec)' | \<br />
perl -pe 's#^.''in the context ‘([^ ]+).''$#\1#' | \<br />
sort | \<br />
uniq -c | \<br />
sort -rg<br />
</syntaxhighlight><br />
<br />
=== Transitional strategy ===<br />
<br />
The roadmap is similar to the [https://github.com/quchen/articles/blob/master/applicative_monad.md AMP], the main difference being that since <code>MonadFail</code> does not exist yet, we have to introduce new functionality and then switch to it.<br />
<br />
<ol><br />
<li>GHC 8.0 / base-4.9<br />
<ul><br />
<li>Add module <code>Control.Monad.Fail</code> with new class <code>MonadFail(fail)</code> so people can start writing instances for it. <code>Control.Monad</code> only re-exports the class <code>MonadFail</code> but not its <code>fail</code> method. NB: At this point, <code>Control.Monad.Fail.fail</code> clashes with <code>Prelude.fail</code> and <code>Control.Monad.fail</code>.</li><br />
<li>Add a language extension <code>-XMonadFailDesugaring</code> that changes desugaring to use <code>MonadFail(fail)</code> instead of <code>Monad(fail)</code> This has the effect that typechecking will infer a <code>MonadFail</code> constraint for <code>do</code> blocks with failable patterns, just as it is planned to do when the entire thing is done.</li><br />
<li>Add a warning when a <code>do</code> block that contains a failable pattern is desugared, but there is no <code>MonadFail</code> instance in scope: "Please add the instance or change your pattern matching." Add a flag to control whether this warning appears, but leave it off by default.</li><br />
<li>Add a warning when an instance implements the <code>fail</code> function (or when <code>fail</code> is imported as a method of <code>Monad</code> , as it will be removed from the <code>Monad</code> class in the future. (See also [https://ghc.haskell.org/trac/ghc/ticket/10071 GHC #10071]). Leave it off by default.</li><br />
</ul><br />
</li><br />
<li>GHC 8.4<br />
<ul><br />
<li>Turn on the warning about missing <code>MonadFail</code> instances that we added in 8.0 by default.</li><br />
</ul><br />
</li><br />
<li>GHC 8.6<br />
<ul><br />
<li>Switch <code>-XMonadFailDesugaring</code> on by default.</li><br />
<li>Warnings are still issued if the desugaring extension has been explicitly disabled.</li><br />
<li>Turn on the warning about explicit definition of `fail` in Monad that we added in 8.0 by default.</li><br />
</ul><br />
</li><br />
<li>GHC 8.8<br />
<ul><br />
<li>Remove <code>-XMonadFailDesugaring</code> leaving its effects on at all times.</li><br />
<li>Remove <code>fail</code> from <code>Monad</code></li><br />
<li>Instead, re-export <code>Control.Monad.Fail.fail</code> as <code>Prelude.fail</code> and <code>Control.Monad.fail</code></li><br />
<li><code>Control.Monad.Fail</code> is now a redundant module that can be considered deprecated.</li><br />
</ul><br />
</li><br />
</ol><br />
<br />
=== Current status ===<br />
<br />
* [https://wiki.haskell.org/ZuriHac2015 ZuriHac 2015 (29.5. - 31.5.)]: Franz Thoma (@fmthoma) and me (David Luposchainsky aka @quchen) started implementing the MFP in GHC.<br />
** Desugaring to the new <code>fail</code> can be controlled via a new language extension, <code>MonadFailDesugaring</code><br />
** If the language extension is turned off, a warning will be emitted for code that would break if it was enabled.<br />
** Warnings are emitted for types that ''have'' a ''MonadFail'' instance. This still needs to be fixed.<br />
** The error messages are readable, but should be more so. We're still on this.<br />
* 2015-06-09: Estimated breakage by compiling Stackage. Smaller than expected.<br />
* 2015-06-09 (late): Published. People seem to like the idea, with a couple of pain points remaining.<br />
* 2015-06-16: [https://github.com/quchen/articles/blob/master/monad_fail_update1.md Update 1 posted.]<br />
* 2015-09-18: [https://phabricator.haskell.org/D1248 Patch nearly finished. Some nontrivial tests still fail.]</div>Ysangkokhttps://wiki.haskell.org/index.php?title=Es/Librerias_y_Herramientas/Estructuras_de_Datos&diff=63009Es/Librerias y Herramientas/Estructuras de Datos2019-08-15T19:29:06Z<p>Ysangkok: fix gmane links using archive.fo</p>
<hr />
<div>{{unknown copyright}}<br />
{{LibrariesPage}}<br />
{{Es/Traducción en progreso|titulo=Librerias y Herramientas/Estructuras de Datos}}<br />
<br />
== Librerias y herramientas para Estructuras de datos en Haskell ==<br />
<br />
;[http://www.eecs.tufts.edu/~rdocki01/edison.html Edison]<br />
:Esta es la última versión de la librería Edison de estructuras de datos eficientes. También están disponibles [http://www.haskell.org/ghc/docs/edison/ versiones anteriores de Edison] por Chris Okasaki. Esta librería provee secuencias, mapeos finitos, colas de prioridad y conjuntos/multiconjuntos. ([http://www.eecs.usma.edu/Personnel/okasaki/pubs.html#hw00 artículo con un resumen]).<br />
<br />
;[http://homepages.nildram.co.uk/~ahey/HLibs/Data.Tree.AVL/ Data.Tree.AVL]<br />
:Una imlementación de árboles AVL y utilidades relacionadas.<br />
<br />
;[http://homepages.nildram.co.uk/~ahey/HLibs/Data.StringMap/ Data.StringMap]<br />
:Una librería que provee mapeos desde claves de String a valores, basada en Tries.<br />
<br />
;[http://www.cs.vu.nl/Strafunski/ Strafunski]<br />
:A bundle for generic programming. It provides programming support for generic traversal as useful in the implementation of program transformations.<br />
<br />
;[http://www.lochan.org/2005/keith-cl/libs/ Partial v0.1]<br />
:The Partial library provides a partial order class. It also provides routines for generating a Hasse diagram from a set and a partial order. Renderers are provided for the abstract Hasse diagram representation into LaTeX (via Xy-pic) and into dot, the format for AT&amp;T's Graphviz tools. Since no horizontal sorting is done, the Xy-pic output is rather poor at present; dot does a much better job with its layout optimisation algorithm.<br />
<br />
;[http://web.engr.oregonstate.edu/~erwig/diet/ Discrete Interval Encoding Trees]<br />
:The discrete interval encoding tree is a structure for storing subsets of types having a total order and a predecessor and a successor function.<br />
<br />
;[http://sourceforge.net/projects/ranged-sets/ Ranged Sets]<br />
:A ranged set is a list of non-overlapping ranges. The ranges have upper and lower boundaries, and a boundary divides the base type into values above and below. No value can ever sit on a boundary. So you can have the set {2.0 < x <= 3.0, 5.3 < x < 6}<br />
<br />
;[http://www.cwi.nl/~ralf/HList/ HList]<br />
:A heterogeneous collection is a datatype that is capable of storing data of different types, while providing operations for look-up, update, iteration, and others. There are various kinds of heterogeneous collections, differing in representation, invariants, and access operations.<br />
<br />
;[http://www.csee.ogi.edu/~diatchki/monadLib monadLib]<br />
:Iavor Diatchki's library of monad transformers for Haskell. It enables the quick construction of monads --- abstract data types that capture common programming idioms, such as throwing and catching exceptions or continuations. In many programming languages such features are built into the language (if they're provided at all), but in Haskell they are user-programmable.<br />
<br />
;[http://wiki.di.uminho.pt/wiki/bin/view/Alcino/PointlessHaskell Pointless Haskell]<br />
:Pointless Haskell is library for [[pointfree|point-free]] programming with recursion patterns defined as hylomorphisms. It also allows the visualization of the intermediate data structure of the hylomorphisms with GHood. This feature together with the DrHylo tool allows us to easily visualize recursion trees of Haskell functions.<br />
<br />
;[http://www.informatik.uni-freiburg.de/~wehr/haskell/ rhaskell : Reactive Objects]<br />
:Stefan Wehr's reactive objects library. Reactive objects are a convenient abstraction for writing programs which have to interact with a concurrent environment. A reactive object has two characteristics: the abandonment of all blocking operations and the unification of the concepts state and process. The former allows a reactive object to accept input from multiple sources without imposing any ordering on the input events. The latter prevents race conditions because the state of an object is only manipulated from the process belonging to the object.<br />
<br />
;[http://repetae.net/john/recent/out/GenUtil.html GenUtil]<br />
:A collection of random useful utility functions written in pure Haskell 98. In general, it trys to conform to the naming scheme put forth the Haskell prelude and fill in the obvious omissions, as well as provide useful routines in general.<br />
<br />
;[http://www.cs.uu.nl/~afie/pd09122004.zip PersistentDocument] ''The link is dead, somebody please either update it or remove it.''<br />
:The persistent document abstraction takes care of dealing with a document you want to open from and save to disk and that supports undo. This functionality can be used by editors of arbitrary documents and saves you a lot of quite subtle coding.<br />
<br />
;[[Zipper monad]]<br />
:A generic monad for navigating around arbitrary data structures<br />
<br />
=== Graphs ===<br />
<br />
;[http://web.engr.oregonstate.edu/~erwig/fgl/haskell/ FGL - A Functional Graph Library]<br />
:The functional graph library provides a collection of graph operations.<br />
<br />
;[http://wiki.di.uminho.pt/wiki/bin/view/PURe/PUReSoftware Data.Relation]<br />
:Part of the UMinho Haskell libraries, this library provides a representation and operations on relations. A special case of relations are graphs. The operations include graph chopping and slicing, strong connected component analysis, graphs metrics, and more.<br />
<br />
;[http://archive.fo/XdRKm Haskell Graph Automorphism Library]<br />
:Jean-Philippe Bernardy's implementation of Brendan McKay's algorithm for graph canonic labeling and automorphism group (Nauty).<br />
<br />
=== IO ===<br />
<br />
;[http://haskell.org/haskellwiki/Library/Streams Streams]<br />
:Streams is a feature-rich, flexible, extensible, backward-compatible and fast I/O library. It supports various stream types: files and legacy Handle type, string and memory buffers, pipes. There is also common functionality, available for any stream: buffering, Char encoding, locking.<br />
<br />
<br />
=== Mutable data ===<br />
<br />
;[http://www.isi.edu/~hdaume/STPP/ The Haskell STate Preprocessor]<br />
:This is a short preprocessor for stateful Haskell programs. It aleviates the pain of performing single array lookup/write/update functions with some syntax to support it. It also supports hash table operations based on the HashTable implementation available from the author. Finally, it supports monadic if and monadic case constructions. It is lightweight in the sense that it performs no syntactic analysis and is essentially a character transformer.<br />
<br />
;[http://haskell.org/haskellwiki/Library/ArrayRef Arrays & References Library]<br />
:Featuring:<br />
* Unboxed references in IO and ST monads<br />
* Monad-independent interfaces to boxed and unboxed references<br />
* Syntax sugar to make using of mutable objects easier (=:, +=, -=,..)<br />
* Reimplemented Arrays library with the following improvements:<br />
* Unboxed arrays now can be used in polymorphic functions<br />
* The MArray class now supports arrays with dynamic bounds<br />
* Implementation of dynamic (resizable) arrays<br />
<br />
See also [[Modern array libraries]]<br />
<br />
=== Strings ===<br />
<br />
;[http://www.cse.unsw.edu.au/~dons/fps.html Data.ByteString]<br />
:The FPS library provides mmapped and malloc'd packed strings (byte arrays held by a ForeignPtr), along with a list interface to these strings. It lets you do extremely fast I/O in Haskell; in some cases, even faster than typical C implementations, as well as conserving space.<br />
<br />
;[http://quux.org/devel/missingh MissingH]<br />
:MissingH is a library of pure-Haskell utility functions relating to strings, logging, and I/O.<br />
<br />
;[http://repetae.net/john/recent/out/HsLocale.html HsLocale]<br />
:A locale-aware replacement for the standard IO routines, and support for ''wide'' strings<br />
<br />
;[http://www.cse.unsw.edu.au/~dons/code/icfp05/tests/unit-tests/VariableExpansion.hs VariableExpansion]<br />
:A library for variable expansion inside strings<br />
<br />
=== Serialising data ===<br />
<br />
;[http://www.n-heptane.com/nhlab/repos/NewBinary NewBinary]<br />
:A port of Malcolm Wallace's Binary library from NHC, offering facilities for heap compression and binary I/O. The de-facto standard for binary I/O in Haskell<br />
<br />
;[http://www.cs.helsinki.fi/u/ekarttun/SerTH/ SerTH]<br />
:SerTH is a binary serialization library for Haskell. It supports serializing cyclic datatypes in a fast binary format. SerTH uses template haskell for deriving the serializing interface for new datatypes.<br />
<br />
;[http://haskell.org/haskellwiki/Library/AltBinary AltBinary]<br />
: AltBinary is an exhaustive library that support binary I/O and serialization. It's part of [http://haskell.org/haskellwiki/Library/Streams Streams] library, so serialization is possible to any I/O source, from String to memory-mapped file. It's also backward compatible with [http://www.n-heptane.com/nhlab/repos/NewBinary NewBinary] library what makes translation of old code trivial. Very fast, very feature-rich, Hugs/GHC compatible, etc, etc...<br />
<br />
=== Compressing data ===<br />
<br />
;[http://freearc.narod.ru/ Compression-2005]<br />
:Features of the Compression-2005 Library: <br />
* easy and uniform access to most competitive free compression algorithms as of April'05: LZMA, PPMd and GRZip<br />
* all input/output performed via user-supplied functions (callbacks), so you can compress data in memory, files, pipes, sockets and anything else<br />
* all parameters of compression algorithm are defined with a single string, for example "lzma:8mb:fast:hc4:fb32".<br />
Using this library, you can write whole bzip-like utility as one-liner! And it will compress even better than bzip2!<br />
<br />
=== Benchmarking data structures ===<br />
<br />
;[http://www.cs.york.ac.uk/fp/auburn/ Auburn]<br />
:Auburn is Graeme Moss's kit for benchmarking implementations of lazy data structures. Give it several implementations of an ADT (abstract data type) and it will tell you which one is best for your particular application.<br />
<br />
;[http://www.cse.unsw.edu.au/~dons/code/fps/tests/Bench.hs Bench]<br />
:Simple time and space benchmarking for various list-like data structures. Easily adapted to arbitrary structures<br />
<br />
{{traduccion|titulo=Libraries and tools/Data structures}}</div>Ysangkokhttps://wiki.haskell.org/index.php?title=Applications_and_libraries/Data_structures&diff=63008Applications and libraries/Data structures2019-08-15T19:28:09Z<p>Ysangkok: fix gmane links using archive.fo</p>
<hr />
<div>{{unknown copyright}}<br />
{{LibrariesPage}}<br />
<br />
==General libraries and tools for data structures==<br />
<br />
;[http://www.cs.princeton.edu/~rdockins/edison/home/ Edison]<br />
:This is the latest version of the Edison library of efficient data structures. There are also [http://www.haskell.org/ghc/docs/edison/ earlier version of Edison] by Chris Okasaki. It provides sequences, finite maps, priority queues, and sets/bags. ([http://www.eecs.usma.edu/Personnel/okasaki/pubs.html#hw00 overview paper]).<br />
<br />
;[[Library/New collections]]<br />
:This is a package of many useful collections types. Advantages include:<br />
:*It's easy to migrate from standard Lists/Sets/Maps to the new package. The package is an evolution (rather than a revolution) of the collections currently in the base package.<br />
:*Each collection type fits in a consistent framework (thanks to classes)<br />
:*An extensive QuickCheck test suite also serves as detailed specification for the collections.<br />
<br />
:This package includes and supercedes the following libraries:<br />
<br />
:;[http://homepages.nildram.co.uk/~ahey/HLibs/Data.Tree.AVL/ Data.Tree.AVL]<br />
::An implementation of AVL trees and related utilities.<br />
<br />
:;[http://homepages.nildram.co.uk/~ahey/HLibs/Data.StringMap/ Data.StringMap]<br />
::A library providing maps from String keys to values, based on Tries.<br />
<br />
:This package includes the following libraries, but they are maintained separately:<br />
<br />
:;[http://sourceforge.net/projects/ranged-sets/ Ranged Sets]<br />
::A ranged set is a list of non-overlapping ranges. The ranges have upper and lower boundaries, and a boundary divides the base type into values above and below. No value can ever sit on a boundary. So you can have the set {2.0 < x <= 3.0, 5.3 < x < 6}<br />
<br />
;[http://www.cs.vu.nl/Strafunski/ Strafunski]<br />
:A bundle for generic programming. It provides programming support for generic traversal as useful in the implementation of program transformations.<br />
<br />
;[http://www.lochan.org/2005/keith-cl/libs/ Partial v0.1]<br />
:The Partial library provides a partial order class. It also provides routines for generating a Hasse diagram from a set and a partial order. Renderers are provided for the abstract Hasse diagram representation into LaTeX (via Xy-pic) and into dot, the format for AT&amp;T's Graphviz tools. Since no horizontal sorting is done, the Xy-pic output is rather poor at present; dot does a much better job with its layout optimisation algorithm.<br />
<br />
;[http://web.engr.oregonstate.edu/~erwig/diet/ Discrete Interval Encoding Trees]<br />
:The discrete interval encoding tree (DIET) is a structure for storing subsets of types having a total order and a predecessor and a successor function.<br />
<br />
;[http://www.cwi.nl/~ralf/HList/ HList]<br />
:A heterogeneous collection is a datatype that is capable of storing data of different types, while providing operations for look-up, update, iteration, and others. There are various kinds of heterogeneous collections, differing in representation, invariants, and access operations.<br />
<br />
;[http://www.csee.ogi.edu/~diatchki/monadLib monadLib]<br />
:Iavor Diatchki's library of monad transformers for Haskell. It enables the quick construction of monads --- abstract data types that capture common programming idioms, such as throwing and catching exceptions or continuations. In many programming languages such features are built into the language (if they're provided at all), but in Haskell they are user-programmable.<br />
<br />
;[http://wiki.di.uminho.pt/wiki/bin/view/Alcino/PointlessHaskell Pointless Haskell]<br />
:Pointless Haskell is library for [[pointfree|point-free]] programming with recursion patterns defined as hylomorphisms. It also allows the visualization of the intermediate data structure of the hylomorphisms with GHood. This feature together with the DrHylo tool allows us to easily visualize recursion trees of Haskell functions.<br />
<br />
;[http://www.informatik.uni-freiburg.de/~wehr/haskell/ rhaskell : Reactive Objects]<br />
:Stefan Wehr's reactive objects library. Reactive objects are a convenient abstraction for writing programs which have to interact with a concurrent environment. A reactive object has two characteristics: the abandonment of all blocking operations and the unification of the concepts state and process. The former allows a reactive object to accept input from multiple sources without imposing any ordering on the input events. The latter prevents race conditions because the state of an object is only manipulated from the process belonging to the object.<br />
<br />
;[http://repetae.net/john/recent/out/GenUtil.html GenUtil]<br />
:A collection of random useful utility functions written in pure Haskell 98. In general, it tries to conform to the naming scheme put forth in the Haskell prelude and fill in the obvious omissions, as well as providing useful routines in general.<br />
<br />
;[http://www.cs.uu.nl/~afie/pd09122004.zip PersistentDocument] ''The link is dead, somebody please either update it or remove it.''<br />
:The persistent document abstraction takes care of dealing with a document you want to open from and save to disk and that supports undo. This functionality can be used by editors of arbitrary documents and saves you a lot of quite subtle coding.<br />
<br />
;[[Zipper monad]]<br />
:A generic monad for navigating around arbitrary data structures<br />
<br />
==Graphs==<br />
<br />
;[http://web.engr.oregonstate.edu/~erwig/fgl/haskell/ FGL - A Functional Graph Library]<br />
:The functional graph library provides a collection of graph operations.<br />
<br />
;[http://wiki.di.uminho.pt/wiki/bin/view/PURe/PUReSoftware Data.Relation]<br />
:Part of the UMinho Haskell libraries, this library provides a representation and operations on relations. A special case of relations are graphs. The operations include graph chopping and slicing, strong connected component analysis, graphs metrics, and more.<br />
<br />
;[http://archive.fo/XdRKm Haskell Graph Automorphism Library]<br />
:Jean-Philippe Bernardy's implementation of Brendan McKay's algorithm for graph canonical labeling and automorphism group (Nauty).<br />
<br />
==IO==<br />
<br />
;[[Library/Streams | Streams]]<br />
:Streams is a feature-rich, flexible, extensible, backward-compatible and fast I/O library. It supports various stream types: files and legacy Handle type, string and memory buffers, pipes. There is also common functionality available for any stream: buffering, Char encoding, locking.<br />
<br />
;[[Binary IO]]<br />
<br />
==Mutable data==<br />
<br />
;[http://www.isi.edu/~hdaume/STPP/ The Haskell STate Preprocessor]<br />
:This is a short preprocessor for stateful Haskell programs. It aleviates the pain of performing single array lookup/write/update functions with some syntax to support it. It also supports hash table operations based on the HashTable implementation available from the author. Finally, it supports monadic if and monadic case constructions. It is lightweight in the sense that it performs no syntactic analysis and is essentially a character transformer.<br />
<br />
;[[Library/ArrayRef | Arrays & References Library]]<br />
:Featuring:<br />
* Unboxed references in IO and ST monads<br />
* Monad-independent interfaces to boxed and unboxed references<br />
* Syntax sugar to make using of mutable objects easier (=:, +=, -=,..)<br />
* Reimplemented Arrays library with the following improvements:<br />
* Unboxed arrays now can be used in polymorphic functions<br />
* The MArray class now supports arrays with dynamic bounds<br />
* Implementation of dynamic (resizable) arrays<br />
<br />
;[http://code.haskell.org/storablevector/ Data.StorableVector.ST]<br />
:StorableVector also support mutation in ST monad.<br />
<br />
See also [[Modern array libraries]]<br />
<br />
==Lists==<br />
<br />
;[http://code.google.com/p/slist/ SList] ''(broken link)''<br />
:Sized lists for Haskell<br />
<br />
;[http://www.cse.unsw.edu.au/~dons/dlist.html dlist]<br />
:Difference lists (supporting O(1) append and snoc)<br />
<br />
==Strings==<br />
<br />
;[http://www.cse.unsw.edu.au/~dons/fps.html Data.ByteString]<br />
:The FPS library provides mmapped and malloc'd packed strings (byte arrays held by a ForeignPtr), along with a list interface to these strings. It lets you do extremely fast I/O in Haskell; in some cases, even faster than typical C implementations, as well as conserving space.<br />
<br />
;[http://hackage.haskell.org/package/Data-Rope Data.Rope]<br />
:A well-known tree data structure for manipulating strings without (too many) memory copies, contrarily to what Data.ByteString does. Also, contrarily to the functions in Data.ByteString.Lazy, most operations on ropes are in O(log n).<br />
<br />
;[http://code.haskell.org/storablevector/ Data.StorableVector]<br />
:This is very much the same like Data.ByteString extended to any Storable element type. There is a data structure for monolithic blocks and chunky sequences. Mutable access is also possible in ST monad.<br />
<br />
;[http://software.complete.org/missingh/ MissingH]<br />
:MissingH is a library of pure-Haskell utility functions relating to strings, logging, and I/O.<br />
<br />
;[http://repetae.net/john/recent/out/HsLocale.html HsLocale]<br />
:A locale-aware replacement for the standard IO routines, and support for ''wide'' strings<br />
<br />
;[http://www.cse.unsw.edu.au/~dons/code/icfp05/tests/unit-tests/VariableExpansion.hs VariableExpansion]<br />
:A library for variable expansion inside strings<br />
<br />
;[http://haskell-i18n.cvs.sourceforge.net/haskell-i18n/ i18n strings]<br />
:At sourceforge<br />
<br />
==Regular expressions==<br />
<br />
There are many libraries for regular expressions available. By default<br />
GHC comes with:<br />
<br />
;[http://darcs.haskell.org/packages/regex-base/ regex-base]<br />
:This defines the type classes for the new API<br />
<br />
;[http://darcs.haskell.org/packages/regex-compat/ regex-compat]<br />
:This defines the old Text.Regex.Posix API, using regex-posix<br />
<br />
;[http://darcs.haskell.org/packages/regex-posix/ regex-posix]<br />
:This is the interface to the old (and slow) posix backend (C's regex.h)<br />
<br />
All backends provide String and ByteString interfaces.<br />
<br />
Additional backend libraries are available for (hopefully) more efficient regular expression<br />
implementations:<br />
<br />
;[http://darcs.haskell.org/packages/regex-pcre/ regex-pcre]<br />
:PCRE-based regexes. This requires [http://www.pcre.org/ libpcre] (currently works against version 6.6.0 as of January 2007). This Haskell library and libpcre are both BSD. This is very fast but has left branch semantics instead of POSIX leftmost longest semantics.<br />
<br />
;[http://darcs.haskell.org/packages/regex-tre/ regex-tre]<br />
:TRE-based regexes. This requires [http://laurikari.net/tre/ libtre] (currently works against version 0.7.5 as of January 2007). Libtre aims to be POSIX compatible and is a much faster implementation that used by regex-posix. Note that libtre does have an [http://laurikari.net/pipermail/tre-general/2007-January/000083.html outstanding bug] in correctly interpreting some regular expressions. This Haskell package is BSD-3 licensed and libtre is LGPL.<br />
<br />
;[http://darcs.haskell.org/packages/regex-parsec/ regex-parsec]<br />
:Pure Haskell regexes implemented via parsec. The leftmost longest subexpression capture semantics of this library differ from the POSIX standard. This also has an option to prefer the left branch semantics that libpcre uses.<br />
<br />
;[http://darcs.haskell.org/packages/regex-dfa/ regex-dfa]<br />
:Pure Haskell DFA for regexes. This is licensed under LPGL (the above packages are all under BSD-3) due to derived code. This is faster than regex-parsec but does not return captured subexpressions. It also is being updated to handle repeated patterns that can match empty strings (the older version hangs, the new version rewrites the pattern internally).<br />
<br />
;There is a regex-tdfa packages in development (not released) that will be a pure Haskell and BSD-3 licensed implementation inspired by libtre. It aims to be a replacement for regex-posix.<br />
<br />
;Development versions (possible unstable or broken) of the above packages are also available under [http://darcs.haskell.org/packages/regex-unstable/ regex-unstable]. For support, please use the [[Mailing_lists | haskell-cafe]] mailing list.<br />
<br />
==Spatial indices==<br />
There are several libraries containing generic code for maps indexed by 2D, 3D or N-dimensional points that support efficient nearest-neighbour or range operations:<br />
<br />
* 2D:<br />
:;[http://hackage.haskell.org/package/spacepart spacepart]<br />
::Contains quadtree implementation.<br />
<br />
* 3D:<br />
:;[http://hackage.haskell.org/package/Octree octree]<br />
:: Simple unbalanced octrees.<br />
<br />
* Of arbitrary dimensionality:<br />
<br />
:;[http://hackage.haskell.org/package/pktree pktree]<br />
::PK-trees support both radius and rectangular range search.<br />
<br />
:;[http://hackage.haskell.org/package/KdTree k-d tree]<br />
::k-d trees also support efficient range and nearest neighbour search<br />
<br />
==Serialising data==<br />
<br />
;[http://www.cse.unsw.edu.au/~dons/binary/Data-Binary.html Data.Binary] ([http://darcs.haskell.org/binary/ darcs repository])<br />
;A library for serialising binary values to and from lazy ByteStrings.<br />
<br />
;[http://www.n-heptane.com/nhlab/repos/NewBinary NewBinary]<br />
:A port of Malcolm Wallace's Binary library from NHC, offering facilities for heap compression and binary I/O. The de-facto standard for binary I/O in Haskell<br />
<br />
;[http://www.cs.helsinki.fi/u/ekarttun/SerTH/ SerTH]<br />
:SerTH is a binary serialization library for Haskell. It supports serializing cyclic datatypes in a fast binary format. SerTH uses template haskell for deriving the serializing interface for new datatypes.<br />
<br />
;[[Library/AltBinary | AltBinary]]<br />
: AltBinary is an exhaustive library that support binary I/O and serialization. It's part of [http://haskell.org/haskellwiki/Library/Streams Streams] library, so serialization is possible to any I/O source, from String to memory-mapped file. It's also backward compatible with [http://www.n-heptane.com/nhlab/repos/NewBinary NewBinary] library what makes translation of old code trivial. Very fast, very feature-rich, Hugs/GHC compatible, etc, etc...<br />
<br />
;[http://svn.openfoundry.org/pugs/third-party/HsSyck/ HsSyck]<br />
:YAML is a straightforward machine parsable data serialization format designed for human readability and interaction with dynamic languages. It is optimized for data serialization, configuration settings, log files, Internet messaging and filtering. Syck is an extension, written in C, for reading and writing YAML swiftly in popular scripting languages. It is part of core Ruby, and also has bindings for Perl 5, Python, Lua, Cocoa, and Perl 6. HsSyck provides Data.Yaml.Syck as an interface to YAML structures, using Data.ByteString for efficient textual data representation. Additionally, we provide a set of DrIFT rules to dump and load arbitrary Haskell data types in the YAML format.<br />
<br />
;[[GenericSerialize]]<br />
:GenericSerialize is a library which serializes data using the "Scrap Your Boilerplate" infrastructure. This means that while it cannot easily support data-structure-specific serialization, it can support many different data formats cheaply.<br />
<br />
==Compressing data==<br />
<br />
;[[Library/Compression | Compressions-2005]]<br />
:Features of the Compression-2005 Library ([http://freearc.narod.ru/ homepage])<br />
* easy and uniform access to most competitive free compression algorithms as of April'05: LZMA, PPMd and GRZip<br />
* all input/output performed via user-supplied functions (callbacks), so you can compress data in memory, files, pipes, sockets and anything else<br />
* all parameters of compression algorithm are defined with a single string, for example "lzma:8mb:fast:hc4:fb32". <br />
* Using this library, you can write a bzip-like utility in one line, with better compression results than bzip2 itself.<br />
<br />
;[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/zlib Zlib]<br />
:Zlib bindings for ByteStrings. darcs get http://code.haskell.org/zlib/ ([http://hackage.haskell.org/cgi-bin/hackage-scripts/package/zlib docs])<br />
<br />
;[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/bzlib BZip2]<br />
:BZip2 bindings for ByteStrings. darcs get http://code.haskell.org/bzlib/ ([http://hackage.haskell.org/cgi-bin/hackage-scripts/package/bzlib docs])<br />
<br />
==Benchmarking data structures==<br />
<br />
;[http://www.cs.york.ac.uk/fp/auburn/ Auburn]<br />
:Auburn is Graeme Moss's kit for benchmarking implementations of lazy data structures. Give it several implementations of an ADT (abstract data type) and it will tell you which one is best for your particular application.<br />
<br />
;[http://www.cse.unsw.edu.au/~dons/code/fps/tests/Bench.hs Bench]<br />
:Simple time and space benchmarking for various list-like data structures. Easily adapted to arbitrary structures<br />
<br />
==Generic traversals==<br />
<br />
;[http://eecs.oregonstate.edu/~erwig/reclib/ RecLib A Recursion and Traversal Library for Haskell]<br />
:The Recursion Library for Haskell provides a rich set of generic traversal strategies to facilitate the flexible specification of generic term traversals. The underlying mechanism is the Scrap Your Boilerplate (SYB) approach. Most of the strategies that are used to implement recursion operators are taken from Stratego.<br />
<br />
==Typesafe variants of <hask>IntSet</hask> and <hask>IntMap</hask> for enumerations==<br />
<br />
* ChrisKuklewicz wrote a bit of boilerplate to re-use IntSet and IntMap with any Enum type: [[EnumSet EnumMap]]<br />
* an efficient implementation of EnumSet for sets which fit into a machine word can be found in [http://www.eecs.tufts.edu/~rdocki01/docs/edison/Data-Edison-Coll-EnumSet.html Edison] (see above)<br />
<br />
==Hackage==<br />
<br />
* [http://hackage.haskell.org/packages/archive/pkg-list.html#cat:Data%20Structures Data structures on Hackage]<br />
* [http://hackage.haskell.org/packages/archive/pkg-list.html#cat:Data More data structures on Hackage]<br />
* [http://hackage.haskell.org/packages/archive/pkg-list.html#cat:Generics Generics on Hackage]</div>Ysangkokhttps://wiki.haskell.org/index.php?title=Applications_and_libraries/Generic_programming&diff=63007Applications and libraries/Generic programming2019-08-15T19:26:18Z<p>Ysangkok: fix gmane links using archive.fo</p>
<hr />
<div>{{unknown copyright}}<br />
<br />
<br />
==Recommended libraries==<br />
See [[Generics]]<br />
<br />
<br />
== Old discussions ==<br />
=== Common library for generic programming ===<br />
<br />
Johan Jeuring and Andres Loeh [http://archive.fo/X72Xq announced] (in 2006) an initiative to design a common library for generic programming, which should work together with most of the Haskell compilers, and for which they hope to guarantee support for generics in Haskell into the future. If you want to get involved (or just want to see the discussion), you can subscribe to [http://www.haskell.org/mailman/listinfo/generics the generics mailing list] (mostly idle since ~2010). Check the [http://haskell.org/haskellwiki/Research_papers/Generics Haskell research wiki] for some background on generics.<br />
<br />
==== Work Plan ====<br />
<br />
We have identified a number of approaches that are potential candidates to a generic programming library:<br />
<br />
<ul><br />
<li><p>[[/Lightweight|A Lightweight Implementation Generics and Dynamics]]</p></li><br />
<li><p>[[/SyB| SYB (and variants)]]</p></li><br />
<li><p>[[/Strafunski| Strafunski]]</p></li><br />
<li><p>Generics for the Masses</p></li><br />
<li><p>Generics as a library</p></li><br />
<li><p>[[/Smash|Smash your Boilerplate]]</p></li><br />
<li><p>RepLib</p></li><br />
<li><p>Extensible superclasses</p></li><br />
<li><p>Almost compositional functions</p></li><br />
</ul><br />
<br />
At the moment we are discussing the advantages and disadvantages of the different approaches. Each approach is roughly two weeks under discussion and the results will be published in this Wiki Page. There is also a darcs repository where you can find some code that we are collecting. For retrieving this code do:<br />
<br />
> darcs get http://code.haskell.org/generics/<br />
<br />
The template that we are using to summarise the different approaches can be found [[/Template|here]].<br />
<br />
===Benchmark suite===<br />
We have developed a benchmark suite that tests the expressiveness of different generic programming libraries. For more information go to: [[GPBench]].</div>Ysangkokhttps://wiki.haskell.org/index.php?title=Applications_and_libraries/Mathematics&diff=63006Applications and libraries/Mathematics2019-08-15T19:24:41Z<p>Ysangkok: fix gmane links using archive.fo</p>
<hr />
<div>== Applications ==<br />
<br />
=== Physics ===<br />
<br />
;[http://ab-initio.mit.edu/meep/ Meep]<br />
:Meep (or MEEP) is a free finite-difference time-domain (FDTD) simulation software package developed at MIT to model electromagnetic systems. Meep used Haskell to generate C++ code, after Meep [http://ab-initio.mit.edu/wiki/index.php/Meep_release_notes 1.0] Haskell generation droped in favor of handwritten C++ code. <br />
<br />
;[[Numeric Quest]]<br />
:Jan Skibinski's [[Numeric Quest]] library provides modules that are useful for Quantum Mechanics, among other things.<br />
<br />
== Libraries ==<br />
<br />
=== Linear algebra ===<br />
<br />
;[http://hackage.haskell.org/package/bed-and-breakfast bed-and-breakfast]<br />
:A library that implements Matrix operations in pure Haskell using mutable arrays and the ST Monad. bed-and-breakfast does not need any additional software to be installed and can perform basic matrix operations like multiplication, finding the inverse, and calculating determinants efficiently.<br />
<br />
;[https://github.com/patperry/hs-linear-algebra hs-linear-algebra]<br />
:Patrick Perry's linear algebra library, built on BLAS. [https://github.com/cartazio/hs-cblas hs-cblas] seems to be a more up-to-date fork.<br />
<br />
;[http://www.cs.utah.edu/~hal/HBlas/index.html Wrapper to CLAPACK]<br />
<br />
;[http://haskelldsp.sourceforge.net/ Digital Signal Processing]<br />
:Modules for matrix manipulation, Fourier transform, interpolation, spectral estimation, and frequency estimation.<br />
<br />
;[http://archive.fo/bfres Index-aware linear algebra]<br />
:Frederik Eaton's library for statically checked matrix manipulation in Haskell<br />
<br />
;[[Numeric Quest]]<br />
:Jan Skibinski's [[Numeric Quest]] library provides several modules that are useful for linear algebra in general, among other things.<br />
<br />
;[[vector-space]]<br />
:The [[vector-space]] package defines classes and generic operations for vector spaces and affine spaces. It also defines a type of infinite towers of generalized derivatives (linear transformations).<br />
<br />
;[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hmatrix HMatrix]<br />
:By Alberto Ruiz. From the project [http://perception.inf.um.es/hmatrix/ website]:<br />
::''A purely functional interface to linear algebra and other numerical algorithms, internally implemented using LAPACK, BLAS, and GSL.<br />
<br />
::''This package includes standard matrix decompositions (eigensystems, singular values, Cholesky, QR, etc.), linear systems, numeric integration, root finding, etc.<br />
<br />
;[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Vec Vec]<br />
:By Scott E. Dillard. Static dimension checking:<br />
::''Vectors are represented by lists with type-encoded lengths. The constructor is :., which acts like a cons both at the value and type levels, with () taking the place of nil. So x:.y:.z:.() is a 3d vector. The library provides a set of common list-like functions (map, fold, etc) for working with vectors. Built up from these functions are a small but useful set of linear algebra operations: matrix multiplication, determinants, solving linear systems, inverting matrices.''<br />
<br />
;[https://github.com/martinra/hlinear HLinear]<br />
:By Alexandru Ghitza, Martin Westerholt-Raum. PDE decomposition of matrices over division rings. See [https://arxiv.org/abs/1605.02532 HLinear: Exact Dense Linear Algebra in Haskell].<br />
::''HLinear is a Haskell implementation of the PLE decomposition of matrices over division rings. It writes an arbitrary matrix as a product of a permutation matrix, a lower unitriangular matrix, and an echelon matrix.''<br />
<br />
== See also ==<br />
<br />
* [[Linear algebra]]<br />
* [[Mathematical prelude discussion]]<br />
<br />
<br />
See also: [[Linear algebra|Design discussions]]<br />
<br />
=== [[Physical units]] ===<br />
<br />
;[[Dimensionalized numbers]]<br />
: Working with physical units like second, meter and so on in a type-safe manner.<br />
<br />
;[http://darcs.haskell.org/numericprelude/src/Number/SI.hs NumericPrelude: Physical units]<br />
: Numeric values with dynamically checked units.<br />
<br />
;[[CalDims]]<br />
:This is not simply a library providing a new type of <hask>Num</hask> class, but stand-alone calculation tool that supports user defined functions and units (basic and derived), so it can provide dimension-safe calculation (not embedded but via shell). Calculations can be modified/saved via shell. It uses rational numbers to avoid rounding errors where possible.<br />
<br />
;[https://github.com/bjornbm/dimensional Dimensional]<br />
: Library providing data types for performing arithmetic with physical quantities and units. Information about the physical dimensions of the quantities/units is embedded in their types and the validity of operations is verified by the type checker at compile time. The boxing and unboxing of numerical values as quantities is done by multiplication and division of units.<br />
<br />
=== Number representations ===<br />
<br />
==== Decimal numbers ====<br />
<br />
;[http://src.seereason.com/decimal/ Decimal arithmetic library]<br />
:An implementation of real decimal arithmetic, for cases where the binary floating point is not acceptable (for example, money).<br />
<br />
==== Real and rational numbers ====<br />
<br />
There are several levels of [[Exact real arithmetic|handling real numbers]] and according libraries.<br />
<br />
===== Arbitrary precision =====<br />
<br />
* Numbers have fixed precision<br />
* Rounding errors accumulate<br />
* Sharing is easy, i.e. in <hask>sqrt pi + sin pi</hask>, <hask>pi</hask> is computed only once<br />
* Fast, because the routines can make use of the fast implementation of <hask>Integer</hask> operations<br />
<br />
;[[Numeric Quest]]<br />
:Jan Skibinski's [[Numeric Quest]] library provides, among other things, a type for arbitrary precision rational numbers with transcendental functions.<br />
<br />
;[http://cvs.haskell.org/darcs/numericprelude/src/Number/FixedPoint.hs FixedPoint.hs]<br />
:part of NumericPrelude project<br />
<br />
;[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/AERN-Basics AERN-Basics] [http://hackage.haskell.org/cgi-bin/hackage-scripts/package/AERN-Real AERN-Real] [http://hackage.haskell.org/cgi-bin/hackage-scripts/package/AERN-Real-Interval AERN-Real-Interval] [http://hackage.haskell.org/cgi-bin/hackage-scripts/package/AERN-Real-Double AERN-Real-Double]<br />
:contains type classes that form a foundation for ''rounded arithmetic'' and ''interval arithmetic'' with explicit control of rounding and the possibility to increase the rounding precision arbitrarily for types that support it. At the moment there are instances for Double floating point numbers where one can control the direction of rounding but cannot increase the rounding precision. In the near future instances for MPFR arbitrary precision numbers will be provided. Intervals can use as endpoints any type that supports directed rounding in the numerical order (such as Double or MPFR) and operations on intervals are rounded either outwards or inwards. Outwards rounding allows to safely approximate exact real arithmetic while a combination of both outwards and inwards rounding allows one to safely approximate exact interval arithmetic. Inverted intervals with Kaucher arithmetic are also supported.<br />
<br />
;[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/AERN-RnToRm AERN-RnToRm]<br />
:contains arithmetic of ''piecewise polynomial function intervals'' that approximate multi-dimensional (almost everywhere) continuous real functions to arbitrary precision<br />
<br />
;[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hmpfr hmpfr]<br />
:hmpfr is a purely functional haskell interface to the [http://www.mpfr.org/ MPFR] library<br />
<br />
;[http://hackage.haskell.org/package/numbers numbers]<br />
:provides an up-to-date, easy-to-use BigFloat implementation that builds with a modern GHC, among other things.<br />
<br />
===== Dynamic precision =====<br />
<br />
* You tell the precision and an expression shall be computed to, and the computer finds out, how precisely to compute the input values<br />
* Rounding errors do not accumulate<br />
* Sharing of temporary results is difficult, that is, in <hask>sqrt pi + sin pi</hask>, <hask>pi</hask> ''will'' be computed twice, each time with the required precision.<br />
* Almost as fast as arbitrary precision computation<br />
<br />
;[http://www.cs.man.ac.uk/arch/dlester/exact.html ERA] is an implementation (in Haskell 1.2) by David Lester.<br />
: It is quite fast, possibly the fastest Haskell implementation. At 220 lines it is also the shortest. Probably the shortest implementation of exact real arithmetic in any language.<br />
: The provided number type <hask>CReal</hask> is instance of the Haskell 98 numeric type classes and thus can be used whereever you used Float or Double before and encountered some numerical difficulties.<br />
:Here is a mirror: http://darcs.augustsson.net/Darcs/CReal/<br />
<br />
;[http://www.doc.ic.ac.uk/~ae/exact-computation/#bm:implementations IC-Reals] is an implementation by Abbas Edalat, Marko Krznar&#263; and Peter J. Potts.<br />
:This implementation uses linear fractional transformations.<br />
<br />
;[http://r6.ca/ Few Digits] by Russell O'Connor.<br />
:This is a prototype of the implementation he intendeds to write in [http://coq.inria.fr/ Coq]. Once the Coq implementation is complete, the Haskell code could be extracted producing an implementation that would be proved correct.<br />
<!--<br />
Example:<br />
*Data.Real.CReal> answer 1000 (exp 1 + sqrt 2)<br />
--><br />
<br />
;COMP is an implementation by Yann Kieffer.<br />
:The work is in beta and relies on new primitive operations on Integers which will be implemented in GHC. The library isn't available yet.<br />
<br />
;[http://www2.arnes.si/~abizja4/hera/ Hera] is an implementation by Aleš Bizjak.<br />
:It uses the [http://www.mpfr.org/ MPFR] library to implement dyadic rationals, on top of which are implemented intervals and real numbers. A real number is represented as a function <hask>Int -> Interval</hask> which represents a sequence of intervals converging to the real.<br />
<br />
===== Dynamic precision by lazy evaluation =====<br />
<br />
The real numbers are represented by an infinite datastructure, which allows you to increase precision successively by evaluating the data structure successively. All of the implementations below use some kind of digit stream as number representation.<br />
Sharing of results is simple.<br />
The implementations are either fast on simple expressions, because they use large blocks/bases, or they are fast on complex expressions, because they consume as little as possible input digits in order to emit the required output digits.<br />
<br />
;[http://medialab.freaknet.org/bignum/ BigFloat] is an implementation by Martin Guy.<br />
:It works with streams of decimal digits (strictly in the range from 0 to 9) and a separate sign. The produced digits are always correct. Output is postponed until the code is certain what the next digit is. This sometimes means that [http://medialab.freaknet.org/bignum/dudeney.html no more data is output].<br />
<br />
;In [http://users.info.unicaen.fr/~karczma/arpap/lazypi.ps.gz "The Most Unreliable Technique in the World to compute pi"] Jerzy Karczmarczuk develops some functions for computing pi lazily.<br />
<br />
;[http://darcs.haskell.org/numericprelude/src/Number/Positional.hs NumericPrelude: positional numbers]<br />
:Represents a real number as pair <hask>(exponent,[digit])</hask>, where the digits are <hask>Int</hask>s in the open range <hask>(-basis,basis)</hask>. There is no need for an extra sign item in the number data structure. The <hask>basis</hask> can range from <hask>10</hask> to <hask>1000</hask>. (Binary representations can be derived from the hexadecimal representation.) Showing the numbers in traditional format (non-negative digits) fails for fractions ending with a run of zeros. However the internal representation with negative digits can always be shown and is probably more useful for further processing. An interface for the numeric type hierarchy of the NumericPrelude project is provided.<br />
:It features<br />
:* basis conversion<br />
:* basic arithmetic: addition, subtraction, multiplication, division<br />
:* algebraic arithmetic: square root, other roots (no general polynomial roots)<br />
:* transcendental arithmetic: pi, exponential, logarithm, trigonometric and inverse trigonometric functions<br />
<br />
=== Type class hierarchies ===<br />
<br />
There are several approaches to improve the [[Mathematical prelude discussion|numeric type class hierarchy]].<br />
<br />
;Dylan Thurston and Henning Thielemann's [[Numeric Prelude]]<br />
:Experimental revised framework for numeric type classes. Needs hiding of Prelude, overriding hidden functions like fromInteger and multi-parameter type classes. Probably restricted to GHC.<br />
<br />
;Jerzy Karczmarczuk's [http://www.haskell.org/pipermail/haskell-cafe/2001-February/001510.html approach]<br />
<br />
;Serge D. Mechveliani's [ftp://ftp.botik.ru/pub/local/Mechveliani/basAlgPropos/ Basic Algebra proposal]<br />
<br />
;Andrew Frank's [http://www.haskell.org/pipermail/haskell-cafe/2006-April/015326.html approach]<br />
:The proposal: ftp://ftp.geoinfo.tuwien.ac.at/frank/numbersPrelude_v1.pdf<br />
<br />
;Haskell Prime: [http://prime.haskell.org/ticket/112 Ongoing efforts for the language revision]<br />
<br />
=== Discrete mathematics ===<br />
<br />
;[http://andrew.bromage.org/darcs/numbertheory/ Number Theory Library]<br />
:Andrew Bromage's Haskell number theory library, providing operations on primes, fibonacci sequences and combinatorics.<br />
<br />
;[http://users.skynet.be/jyp/HGAL/ HGAL]<br />
:An haskell implementation of Brendan McKay's algorithm for graph canonic labeling and automorphism group. (aka Nauty)<br />
<br />
;[http://www.cambridge.org/uk/catalogue/catalogue.asp?isbn=0521849306 Computational Oriented Matroids]<br />
:is a book by [http://wwwopt.mathematik.tu-darmstadt.de/~bokowski/ Jürgen G. Bokowski], where he develops Haskell code for Matroid computations.<br />
<br />
See also [[Libraries and tools/Cryptography]]<br />
<br />
=== Computer Algebra ===<br />
<br />
<!-- Older link: http://haskell.org/docon/ --><br />
; [http://homepages.inf.ed.ac.uk/wadler/realworld/docon2.html DoCon], the Algebraic Domain Constructor<br />
: A library by Sergey D. Mechveliani for Algebra, turns GHCi into a kind of Computer Algebra System<br />
<br />
;[http://www.info.unicaen.fr/~karczma/arpap/ Papers by Jerzy Karczmarczuk]<br />
:Some interesting uses of Haskell in mathematics, including [[functional differentiation]], power series, continued fractions.<br />
<br />
;[http://www.robtougher.com/HCAS/ HCAS] by Rob Tougher.<br />
<br />
=== Statistics ===<br />
;[http://hackage.haskell.org/package/hstats hstats]<br />
: Statistical Computing with Haskell<br />
<br />
;[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hmatrix-gsl-stats hmatrix-gsl-stats]<br />
: A binding to the statistics portion of GSL. Works with hmatrix<br />
<br />
;[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hstatistics hstatistics]<br />
: A library for doing statistics. Works with hmatrix<br />
<br />
=== Plotting ===<br />
<br />
;[http://hackage.haskell.org/package/easyplot easyplot]<br />
: Simple and easy wrapper to gnuplot.<br />
<br />
;[[Gnuplot]]<br />
: Simple wrapper to gnuplot<br />
<br />
;[http://hackage.haskell.org/packages/archive/hmatrix/latest/doc/html/Graphics-Plot.html hmatrix]<br />
: contains a deprecated gnuplot wrapper<br />
<br />
;[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Chart Chart]<br />
: A library for generating 2D Charts and Plots, based upon the cairo graphics library.<br />
<br />
;[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/plot plot]<br />
: A library for generating figures, based upon the cairo graphics libary with<br />
a simple, monadic interface.<br />
<br />
;[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/probability probability]<br />
: the module Numeric.Probability.Visualize contains a wrapper to [http://www.r-project.org/ R]<br />
<br />
;[https://github.com/abarbu/matplotlib-haskell matplotlib-haskell]<br />
: Haskell bindings for Python's Matplotlib<br />
<br />
;[https://github.com/ocramz/bokeh-hs bokeh-hs]<br />
: Haskell bindings for Bokeh<br />
<br />
=== Numerical optimization ===<br />
This classification is somewhat arbitrary. Something more systematic like GAMS might be helpful.<br />
<br />
==== bindings ====<br />
;[http://repetae.net/john/recent/out/HsASA.html Adaptive Simulated Annealing]<br />
:A Haskell interface to Lester Ingber's adaptive simulating annealing code.<br />
<br />
;[http://hackage.haskell.org/package/cmaes CMA-ES]<br />
:A wrapper for Covariance Matrix Adaptation Evolution Strategy<br />
<br />
;[https://github.com/ghorn/nlopt-haskell nlopt-haskell]<br />
:A low-level binding to the nlopt library<br />
<br />
;[http://hackage.haskell.org/package/ipopt-hs ipopt-hs]<br />
:A haskell binding to ipopt including automatic differentiation<br />
<br />
;[http://hackage.haskell.org/package/glpk-hs glpk-hs]<br />
:A high-level interface to GLPK's linear programming and mixed integer programming features.<br />
<br />
==== pure haskell ====<br />
;[http://hackage.haskell.org/package/nonlinear-optimization nonlinear-optimization]<br />
:A pure-haskell CG_DESCENT method is implemented<br />
<br />
=== Miscellaneous libraries ===<br />
<br />
;[http://www.robtougher.com/HaskellMath/ HaskellMath]<br />
:The HaskellMath library is a sandbox for experimenting with mathematics algorithms. So far I've implemented a few quantitative finance models (Black Scholes, Binomial Trees, etc) and basic linear algebra functions. Next I might work on either computer algebra or linear programming. All comments welcome!<br />
<br />
;[http://hackage.haskell.org/package/HaskellForMaths HaskellForMaths]<br />
:David Amos' library for combinatorics, group theory, commutative algebra and non-commutative algebra, which is described in an [http://haskellformaths.blogspot.com/ accompanying blog].<br />
<br />
;[http://darcs.haskell.org/htam/ Various math stuff by Henning Thielemann]<br />
:This is some unsorted mathematical stuff including: gnuplot wrapper (now maintained as separate package), portable grey map (PGM) image reader and writer, simplest numerical integration, differentiation, zero finding, interpolation, solution of differential equations, combinatorics, some solutions of math riddles, computation of fractal dimensions of iterated function systems (IFS)<br />
<br />
;[[Numeric Quest]]<br />
:Jan Skibinski wrote a collection of Haskell modules that are useful for Mathematics in general, and Quantum Mechanics in particular.<br />
<br />
:Some of the modules are hosted on [http://darcs.haskell.org/numeric-quest/ haskell.org]. They include modules for:<br />
:* Rational numbers with transcendental functions<br />
:* Roots of polynomials<br />
:* Eigensystems<br />
:* Tensors<br />
:* Dirac quantum mechanics<br />
<br />
:Other modules in Numeric Quest are currently only available via the [http://web.archive.org/web/20010605003250/http://www.numeric-quest.com/haskell/ Internet Archive]. They include, among many other things:<br />
:* [http://web.archive.org/web/*/http://www.numeric-quest.com/haskell/ State vector evolution]<br />
:* [http://web.archive.org/web/*/http://www.numeric-quest.com/haskell/ Short study of fuzzy oscillator]<br />
<br />
:See the [[Numeric Quest]] page for more information.<br />
<br />
;[http://www.dinkla.net/fp/cglib.html Geometric Algorithms]<br />
:A small Haskell library, containing algorithms for two-dimensional convex hulls, triangulations of polygons, Voronoi-diagrams and Delaunay-triangulations, the QEDS data structure, kd-trees and range-trees.<br />
<br />
;[http://home.solcon.nl/mklooster/repos/hmm/ Hmm: Haskell Metamath]<br />
:Hmm is a small Haskell library to parse and verify Metamath databases.<br />
<br />
;[[Probabilistic Functional Programming]]<br />
:The PFP library is a collection of modules for Haskell that facilitates probabilistic functional programming, that is, programming with stochastic values. The probabilistic functional programming approach is based on a data type for representing distributions. A distribution represent the outcome of a probabilistic event as a collection of all possible values, tagged with their likelihood. A nice aspect of this system is that simulations can be specified independently from their method of execution. That is, we can either fully simulate or randomize any simulation without altering the code which defines it.<br />
<br />
;[[Sinc function]]<br />
<br />
;[[Gamma and Beta function]]<br />
<br />
;[http://repetae.net/john/recent/out/Boolean.html Boolean]<br />
:A general boolean algebra class and some instances for Haskell.<br />
<br />
;[http://darcs.haskell.org/~lemmih/hode/ HODE]<br />
:HODE is a binding to the Open Dynamics Engine. ODE is an open source, high performance library for simulating rigid body dynamics.<br />
<br />
;[http://sourceforge.net/projects/ranged-sets Ranged Sets]<br />
:A ranged set is a list of non-overlapping ranges. The ranges have upper and lower boundaries, and a boundary divides the base type into values above and below. No value can ever sit on a boundary. So you can have the set <math>(2.0, 3.0] \cup (5.3, 6)</math>.<br />
<br />
;[http://code.google.com/p/hhydra/ hhydra]<br />
:Hhydra is a tool to compute Goodstein successions and hydra puzzles described by Bernard Hodgson in his article 'Herculean or Sisyphean tasks?' published in No 51 March 2004 of the Newsletter of the European Mathematical Society.<br />
<br />
[[Category:Mathematics|*]]<br />
{{LibrariesPage}}</div>Ysangkokhttps://wiki.haskell.org/index.php?title=Humor&diff=63005Humor2019-08-15T19:23:42Z<p>Ysangkok: fix gmane links using archive.fo</p>
<hr />
<div>Who says functional programmers never have any fun? Here's some of the<br />
hoaxes and other funny stuff from several sources.<br />
<br />
* [http://www.youtube.com/watch?v=Ci48kqp11F8 Ranjit Jhala performs Lambda Style!]<br />
* [http://ro-che.info/ccc/01.html Cartesian Closed Comic]<br />
*[[Let's_Play_Free_Games]]<br />
*[[Music of monads]]<br />
*[http://www.xent.com/pipermail/fork/Week-of-Mon-20070219/044101.html If Haskell were a working girl]<br />
*[[Humor/Microsoft|Microsoft takes over Haskell]]<br />
*[http://www.willamette.edu/~fruehr/haskell/evolution.html The Evolution of a Haskell Programmer] (can you write a factorial function?) <br />
*[[Humor/Haskell saves lives|Haskell saves lives!]]<br />
*[[Humor/Poem|An ode to Haskell]]<br />
*[[Humor/Flakes|Try some Haskell today!]]<br />
*[[Humor/Porn|Functional porn]]<br />
*[http://www.willamette.edu/~fruehr/haskell/seuss.html Dr. Seuss builds a parser]<br />
*[[Humor/Limericks|Limericks]]<br />
*[[Humor/Hugme|The latest Hugs release?]]<br />
*[[Humor/Enron|Haskell fingers Enron]]<br />
*[[Humor/1984|Haskells 1984 parallelisms]]<br />
*[[Humor/irish_joke|How to keep an imperative programmer busy for hours]]<br />
*[[Humor/How quick can you write a ISI paper with Haskell or without it ?]]<br />
*[[Humor/Urgent|URGENT ASSISTANCE NEEDED!]]<br />
*[[Humor/Homework|Need help with your homework?]]<br />
*[[Humor/Y-agra|Need help performing?]]<br />
*[[Humor/Slow|Haskell is slow!]]<br />
*[[Humor/Wanda|Wanda the fish is speaking]]<br />
*[http://www.newadvent.org/cathen/10447b.htm Monads explained by the Catholic Church]<br />
*[http://marc.info/?l=haskell&m=66622004421268 Committee Advocating The Superstitious Use of Parentheses]<br />
*[http://www.cse.unsw.edu.au/~dons/haskell-1990-2000/msg00159.html The Beta Release of Glasgow Haskell] (and [http://www.cse.unsw.edu.au/~dons/haskell-1990-2000/msg00191.html explanation])<br />
*[http://www.dcs.gla.ac.uk/~partain/haskerl/partain-1.html The Haskerl Extension to Haskell]<br />
* HaskellWiki's [http://www.haskell.org/haskellwiki/QuotesPage QuotesPage]. E.g. a quotation from <nowiki><autrijus></nowiki>:<br />
** Perl: "Easy things are easy, hard things are possible"<br />
** Haskell: "Hard things are easy, the impossible just happened"<br />
* [[Lambdabot|Lambdabot's]] [http://www.cse.unsw.edu.au/~dons/code/lambdabot/State/quote quotes archive].<br />
* [[HaskellCosmetics|Haskell cosmetics]], pure and good for you<br />
* [http://archive.fo/seKtU Haskell No Operation]<br />
* [[Almost Haskell]]<br />
* [http://www.haskell.org/pipermail/haskell-cafe/2006-November/019190.html There's a monster in my Haskell!] <br />
* [http://nssdc.gsfc.nasa.gov/image/planetary/jupiter/io.jpg What does IO look like?], or how why threading the real world is tricky.<br />
*[[Humor/Erlkönig|King IO (freely adapted from Goethe)]]<br />
*[http://koweycode.blogspot.com/2007/01/think-of-monad.html Think of a monad ... ]<br />
* [http://www.haskell.org.MonadTransformer.parallelnetz.de/haskellwiki/Category:Monad The warm, fuzzy thing transformer]<br />
* The [[Humor/LearningCurve|Haskell Learning Curve]]<br />
* [http://spl.smugmug.com/gallery/13227630_j2MHcg/#!i=960526161&k=XwKHSBM Lambdacats], inspired by the [http://en.wikipedia.org/wiki/Lolcat lolcat phenomenon].<br />
*[[Humor/Dialogs|The benefits of Haskell, via the Socratic method]]<br />
*[[Humor/Goldilocks|Goldilocks]]<br />
*[[Humor/Hackage Theme Song|Hackage Theme Song]]<br />
*[[Shooting your self in the foot]]<br />
*[[Haiku]]<br />
*[http://blog.plover.com/prog/burritos.html Monads are like burritos]<br />
*More Haskell humor at [http://www.reddit.com/r/ProgrammerHumor/search?q=haskell&restrict_sr=on reddit.com]<br />
<br />
[[Category:Humor|*]]<br />
[[Category:Community]]</div>Ysangkokhttps://wiki.haskell.org/index.php?title=Type_arithmetic&diff=63004Type arithmetic2019-08-15T19:23:22Z<p>Ysangkok: fix gmane links using archive.fo</p>
<hr />
<div>'''Type arithmetic''' (or type-level computation) are calculations on<br />
the type-level, often implemented in Haskell using functional<br />
dependencies to represent functions.<br />
<br />
A simple example of type-level computation are operations on [[Peano numbers]]:<br />
<br />
<haskell><br />
data Zero<br />
<br />
data Succ a<br />
<br />
class Add a b ab | a b -> ab, a ab -> b<br />
instance Add Zero b b<br />
instance (Add a b ab) => Add (Succ a) b (Succ ab)<br />
</haskell><br />
<br />
Many other representations of numbers are possible, including binary and<br />
balanced base tree. Type-level computation may also include type<br />
representations of boolean values, lists, trees and so on. It is closely<br />
connected to theorem proving, via<br />
[http://en.wikipedia.org/wiki/Curry-Howard the Curry-Howard isomorphism].<br />
<br />
A [http://okmij.org/ftp/Haskell/number-parameterized-types.html decimal representation] was put forward by [http://okmij.org/ftp/ Oleg Kiselyov] in [http://www.haskell.org/haskellwiki/The_Monad.Reader/Issue5/Number_Param_Types "Number-Parameterized Types"] in the [http://www.haskell.org/haskellwiki/The_Monad.Reader/Issue5 fifth issue] of [http://themonadreader.wordpress.com/ The Monad Reader].<br />
There is an implementation in the {{HackagePackage|id=type-level}} package, but unfortunately the arithmetic is really slow, because in fact it simulates Peano arithmetic with decimal numbers.<br />
<br />
== Library support ==<br />
<br />
Robert Dockins has gone as far as to write<br />
a [http://archive.fo/77scn library]<br />
for type level arithmetic, supporting the following operations on type<br />
level naturals: addition, subtraction, multiplication, division,<br />
remainder, GCD, and also contains the following predicates: test for<br />
zero, test for equality and < > <= >=<br />
<br />
This library uses a binary representation and can handle numbers at<br />
the order of 10^15 (at least). It also contains a test suite to help<br />
validate the somewhat unintuitive algorithms.<br />
<br />
More libraries:<br />
<br />
* {{HackagePackage|id=type-level}} Natural numbers in decimal representation using functional dependencies and Template Haskell. However arithmetic is performed in a unary way and thus it is quite slow.<br />
* {{HackagePackage|id=type-level-tf}} Similar to the type-level package (also in speed) but uses type families instead of functional dependencies and uses the same module names as the type-level package. Thus module name clashes are warranted if you have to use both packages.<br />
* {{HackagePackage|id=type-level-natural-number}} and related packages. A collection of packages where the simplest one is even Haskell2010.<br />
* {{HackagePackage|id=tfp}} Decimal representation, Type families, Template Haskell.<br />
* {{HackagePackage|id=typical}} Binary numbers and functional dependencies.<br />
* {{HackagePackage|id=type-unary}} Unary representation and type families.<br />
* {{HackagePackage|id=numtype}}, {{HackagePackage|id=numtype-tf}} Unary representation and functional dependencies and type families, respectively.<br />
<br />
== More type hackery ==<br />
<br />
Not to be outdone, Oleg Kiselyov has <br />
[http://archive.fo/JwMNI written]<br />
on invertible, terminating, 3-place addition, multiplication,<br />
exponentiation relations on type-level Peano numerals, where any two<br />
operands determine the third. He also shows the invertible factorial<br />
relation. Thus providing all common arithmetic operations on Peano<br />
numerals, including n-base discrete logarithm, n-th root, and the<br />
inverse of factorial. The inverting method can work with any<br />
representation of (type-level) numerals, binary or decimal.<br />
<br />
Oleg says, "The implementation of RSA on the type level is left for future work".<br />
<br />
== Djinn ==<br />
<br />
Somewhat related is Lennart Augustsson's tool <br />
[http://archive.fo/4Ztai Djinn], a theorem<br />
prover/coding wizard, that generates Haskell code from a given Haskell<br />
type declaration.<br />
<br />
Djinn interprets a Haskell type as a logic formula using<br />
[http://en.wikipedia.org/wiki/Curry-Howard the Curry-Howard isomorphism]<br />
and then a decision procedure for Intuitionistic Propositional Calculus.<br />
<br />
== An Advanced Example : Type-Level Quicksort ==<br />
<br />
An advanced example: quicksort on the type level.<br />
<br />
Here is a complete example of advanced type level computation, kindly<br />
provided by Roman Leshchinskiy. For further information consult Thomas<br />
Hallgren's 2001 paper <br />
[http://www.cs.chalmers.se/~hallgren/Papers/wm01.html Fun with Functional Dependencies]. <br />
<br />
<haskell><br />
module Sort where<br />
<br />
-- natural numbers<br />
data Zero<br />
data Succ a<br />
<br />
-- booleans<br />
data True<br />
data False<br />
<br />
-- lists<br />
data Nil<br />
data Cons a b<br />
<br />
-- shortcuts<br />
type One = Succ Zero<br />
type Two = Succ One<br />
type Three = Succ Two<br />
type Four = Succ Three<br />
<br />
-- example list<br />
list1 :: Cons Three (Cons Two (Cons Four (Cons One Nil)))<br />
list1 = undefined<br />
<br />
-- utilities<br />
numPred :: Succ a -> a<br />
numPred = const undefined<br />
<br />
class Number a where<br />
numValue :: a -> Int<br />
<br />
instance Number Zero where<br />
numValue = const 0<br />
instance Number x => Number (Succ x) where<br />
numValue x = numValue (numPred x) + 1<br />
<br />
numlHead :: Cons a b -> a<br />
numlHead = const undefined<br />
<br />
numlTail :: Cons a b -> b<br />
numlTail = const undefined<br />
<br />
class NumList l where<br />
listValue :: l -> [Int]<br />
<br />
instance NumList Nil where<br />
listValue = const []<br />
instance (Number x, NumList xs) => NumList (Cons x xs) where<br />
listValue l = numValue (numlHead l) : listValue (numlTail l)<br />
<br />
-- comparisons<br />
data Less<br />
data Equal<br />
data Greater<br />
<br />
class Cmp x y c | x y -> c<br />
<br />
instance Cmp Zero Zero Equal<br />
instance Cmp Zero (Succ x) Less<br />
instance Cmp (Succ x) Zero Greater<br />
instance Cmp x y c => Cmp (Succ x) (Succ y) c<br />
<br />
-- put a value into one of three lists according to a pivot element<br />
class Pick c x ls eqs gs ls' eqs' gs' | c x ls eqs gs -> ls' eqs' gs'<br />
instance Pick Less x ls eqs gs (Cons x ls) eqs gs<br />
instance Pick Equal x ls eqs gs ls (Cons x eqs) gs<br />
instance Pick Greater x ls eqs gs ls eqs (Cons x gs)<br />
<br />
-- split a list into three parts according to a pivot element<br />
class Split n xs ls eqs gs | n xs -> ls eqs gs<br />
instance Split n Nil Nil Nil Nil<br />
instance (Split n xs ls' eqs' gs',<br />
Cmp x n c,<br />
Pick c x ls' eqs' gs' ls eqs gs) =><br />
Split n (Cons x xs) ls eqs gs<br />
<br />
listSplit :: Split n xs ls eqs gs => (n, xs) -> (ls, eqs, gs)<br />
listSplit = const (undefined, undefined, undefined)<br />
<br />
-- zs = xs ++ ys<br />
class App xs ys zs | xs ys -> zs<br />
instance App Nil ys ys<br />
instance App xs ys zs => App (Cons x xs) ys (Cons x zs)<br />
<br />
-- zs = xs ++ [n] ++ ys<br />
-- this is needed because<br />
--<br />
-- class CCons x xs xss | x xs -> xss<br />
-- instance CCons x xs (Cons x xs)<br />
--<br />
-- doesn't work<br />
<br />
class App' xs n ys zs | xs n ys -> zs<br />
instance App' Nil n ys (Cons n ys)<br />
instance (App' xs n ys zs) => App' (Cons x xs) n ys (Cons x zs)<br />
<br />
-- quicksort<br />
class QSort xs ys | xs -> ys<br />
instance QSort Nil Nil<br />
instance (Split x xs ls eqs gs,<br />
QSort ls ls',<br />
QSort gs gs',<br />
App eqs gs' geqs,<br />
App' ls' x geqs ys) =><br />
QSort (Cons x xs) ys<br />
<br />
listQSort :: QSort xs ys => xs -> ys<br />
listQSort = const undefined<br />
</haskell><br />
<br />
And we need to be able to run this somehow, in the typechecker. So fire up ghci:<br />
<br />
<haskell><br />
> :t listQSort list1<br />
Cons<br />
(Succ Zero)<br />
(Cons (Succ One) (Cons (Succ Two) (Cons (Succ Three) Nil)))<br />
</haskell><br />
<br />
== A Really Advanced Example : Type-Level Lambda Calculus ==<br />
<br />
Again, thanks to Roman Leshchinskiy, we present a simple lambda calculus<br />
encoded in the type system (and with non-terminating typechecking fun!)<br />
<br />
Below is an example which encodes a stripped-down version of the lambda<br />
calculus (with only one variable):<br />
<br />
<haskell><br />
{-# OPTIONS -fglasgow-exts #-}<br />
data X<br />
data App t u<br />
data Lam t<br />
<br />
class Subst s t u | s t -> u<br />
instance Subst X u u<br />
instance (Subst s u s', Subst t u t') => Subst (App s t) u (App s' t')<br />
instance Subst (Lam t) u (Lam t)<br />
<br />
class Apply s t u | s t -> u<br />
instance (Subst s t u, Eval u u') => Apply (Lam s) t u'<br />
<br />
class Eval t u | t -> u<br />
instance Eval X X<br />
instance Eval (Lam t) (Lam t)<br />
instance (Eval s s', Apply s' t u) => Eval (App s t) u<br />
</haskell><br />
<br />
Now, lets evaluate some lambda expressions:<br />
<br />
<haskell><br />
> :t undefined :: Eval (App (Lam X) X) u => u<br />
undefined :: Eval (App (Lam X) X) u => u :: X<br />
</haskell><br />
<br />
Ok good, and:<br />
<br />
<haskell><br />
> :t undefined :: Eval (App (Lam (App X X)) (Lam (App X X)) ) u => u<br />
^CInterrupted.<br />
</haskell><br />
<br />
diverges ;)<br />
<br />
== Turing-completeness ==<br />
<br />
It's possible to embed the Turing-complete [[Type_SK|SK combinator calculus]] at the type level.<br />
<br />
== Theory ==<br />
<br />
See also [[dependent type]] theory.<br />
<br />
== Practice ==<br />
<br />
[[Extensible record]]s (which are used e.g. in type safe, declarative [[relational algebra]] approaches to [[Libraries and tools/Database interfaces|database management]])<br />
<br />
[[Category:Idioms]]<br />
[[Category:Mathematics]]<br />
[[Category:Type-level programming]]</div>Ysangkokhttps://wiki.haskell.org/index.php?title=Typeclassopedia&diff=63003Typeclassopedia2019-08-15T19:21:13Z<p>Ysangkok: fix gmane links using archive.fo</p>
<hr />
<div>''By [[User:Byorgey|Brent Yorgey]], byorgey@gmail.com''<br />
<br />
''Originally published 12 March 2009 in [http://www.haskell.org/wikiupload/8/85/TMR-Issue13.pdf issue 13] of [http://themonadreader.wordpress.com/ the Monad.Reader]. Ported to the Haskell wiki in November 2011 by [[User:Geheimdienst|Geheimdienst]].''<br />
<br />
''This is now the official version of the Typeclassopedia and supersedes the version published in the Monad.Reader. Please help update and extend it by editing it yourself or by leaving comments, suggestions, and questions on the [[Talk:Typeclassopedia|talk page]].''<br />
<br />
=Abstract=<br />
<br />
The standard Haskell libraries feature a number of type classes with algebraic or category-theoretic underpinnings. Becoming a fluent Haskell hacker requires intimate familiarity with them all, yet acquiring this familiarity often involves combing through a mountain of tutorials, blog posts, mailing list archives, and IRC logs.<br />
<br />
The goal of this document is to serve as a starting point for the student of Haskell wishing to gain a firm grasp of its standard type classes. The essentials of each type class are introduced, with examples, commentary, and extensive references for further reading.<br />
<br />
=Introduction=<br />
<br />
Have you ever had any of the following thoughts?<br />
* What the heck is a monoid, and how is it different from a mon<u>a</u>d?<br />
<br />
* I finally figured out how to use [[Parsec]] with do-notation, and someone told me I should use something called <code>Applicative</code> instead. Um, what?<br />
<br />
* Someone in the [[IRC channel|#haskell]] IRC channel used <code>(***)</code>, and when I asked Lambdabot to tell me its type, it printed out scary gobbledygook that didn’t even fit on one line! Then someone used <code>fmap fmap fmap</code> and my brain exploded.<br />
<br />
* When I asked how to do something I thought was really complicated, people started typing things like <code>zip.ap fmap.(id &&& wtf)</code> and the scary thing is that they worked! Anyway, I think those people must actually be robots because there’s no way anyone could come up with that in two seconds off the top of their head.<br />
<br />
If you have, look no further! You, too, can write and understand concise, elegant, idiomatic Haskell code with the best of them.<br />
<br />
There are two keys to an expert Haskell hacker’s wisdom:<br />
# Understand the types.<br />
# Gain a deep intuition for each type class and its relationship to other type classes, backed up by familiarity with many examples.<br />
<br />
It’s impossible to overstate the importance of the first; the patient student of type signatures will uncover many profound secrets. Conversely, anyone ignorant of the types in their code is doomed to eternal uncertainty. “Hmm, it doesn’t compile ... maybe I’ll stick in an<br />
<code>fmap</code> here ... nope, let’s see ... maybe I need another <code>(.)</code> somewhere? ... um ...”<br />
<br />
The second key—gaining deep intuition, backed by examples—is also important, but much more difficult to attain. A primary goal of this document is to set you on the road to gaining such intuition. However—<br />
<br />
:''There is no royal road to Haskell. {{h:title|Well, he probably would have said it if he knew Haskell.|—Euclid}}''<br />
<br />
This document can only be a starting point, since good intuition comes from hard work, [http://byorgey.wordpress.com/2009/01/12/abstraction-intuition-and-the-monad-tutorial-fallacy/ not from learning the right metaphor]. Anyone who reads and understands all of it will still have an arduous journey ahead—but sometimes a good starting point makes a big difference.<br />
<br />
It should be noted that this is not a Haskell tutorial; it is assumed that the reader is already familiar with the basics of Haskell, including the standard [{{HackageDocs|base|Prelude}} <code>Prelude</code>], the type system, data types, and type classes.<br />
<br />
The type classes we will be discussing and their interrelationships ([[:File:Dependencies.txt|source code for this graph can be found here]]):<br />
<br />
[[Image:Typeclassopedia-diagram.png]]<br />
<br />
{{note|<code>Apply</code> can be found in the [http://hackage.haskell.org/package/semigroupoids <code>semigroupoids</code> package], and <code>Comonad</code> in the [http://hackage.haskell.org/package/comonad <code>comonad</code> package].}}<br />
<br />
* <span style="border-bottom: 2px solid black">Solid arrows</span> point from the general to the specific; that is, if there is an arrow from <code>Foo</code> to <code>Bar</code> it means that every <code>Bar</code> is (or should be, or can be made into) a <code>Foo</code>.<br />
* <span style="border-bottom: 2px dotted black">Dotted lines</span> indicate some other sort of relationship.<br />
* <code>Monad</code> and <code>ArrowApply</code> are equivalent.<br />
* <code>Apply</code> and <code>Comonad</code> are greyed out since they are not actually (yet?) in the standard Haskell libraries {{noteref}}.<br />
<br />
One more note before we begin. The original spelling of “type class” is with two words, as evidenced by, for example, the [http://www.haskell.org/onlinereport/haskell2010/ Haskell 2010 Language Report], early papers on type classes like [http://citeseer.ist.psu.edu/viewdoc/summary?doi=10.1.1.103.5639 Type classes in Haskell] and [http://research.microsoft.com/en-us/um/people/simonpj/papers/type-class-design-space/ Type classes: exploring the design space], and [http://citeseer.ist.psu.edu/viewdoc/summary?doi=10.1.1.168.4008 Hudak et al.’s history of Haskell]. However, as often happens with two-word phrases that see a lot of use, it has started to show up as one word (“typeclass”) or, rarely, hyphenated (“type-class”). When wearing my prescriptivist hat, I prefer “type class”, but realize (after changing into my descriptivist hat) that there's probably not much I can do about it.<br />
<br />
[[Instances of List and Maybe]] illustrates these type classes with simple examples using List and Maybe. We now begin with the simplest type class of all: <code>Functor</code>.<br />
<br />
=Functor=<br />
<br />
The <code>Functor</code> class ([{{HackageDocs|base|Prelude}}#t:Functor haddock]) is the most basic and ubiquitous type class in the Haskell libraries. A simple intuition is that a <code>Functor</code> represents a “container” of some sort, along with the ability to apply a function uniformly to every element in the container. For example, a list is a container of elements, and we can apply a function to every element of a list, using <code>map</code>. As another example, a binary tree is also a container of elements, and it’s not hard to come up with a way to recursively apply a function to every element in a tree.<br />
<br />
Another intuition is that a <code>Functor</code> represents some sort of “computational context”. This intuition is generally more useful, but is more difficult to explain, precisely because it is so general. Some examples later should help to clarify the <code>Functor</code>-as-context point of view.<br />
<br />
In the end, however, a <code>Functor</code> is simply what it is defined to be; doubtless there are many examples of <code>Functor</code> instances that don’t exactly fit either of the above intuitions. The wise student will focus their attention on definitions and examples, without leaning too heavily on any particular metaphor. Intuition will come, in time, on its own.<br />
<br />
==Definition==<br />
<br />
Here is the type class declaration for <code>Functor</code>:<br />
<br />
<haskell><br />
class Functor f where<br />
fmap :: (a -> b) -> f a -> f b<br />
<br />
(<$) :: a -> f b -> f a<br />
(<$) = fmap . const<br />
</haskell><br />
<br />
<code>Functor</code> is exported by the <code>Prelude</code>, so no special imports are needed to use it. Note that the <code>(<$)</code> operator is provided for convenience, with a default implementation in terms of <code>fmap</code>; it is included in the class just to give <code>Functor</code> instances the opportunity to provide a more efficient implementation than the default. To understand <code>Functor</code>, then, we really need to understand <code>fmap</code>.<br />
<br />
First, the <code>f a</code> and <code>f b</code> in the type signature for <code>fmap</code> tell us that <code>f</code> isn’t a concrete type like <code>Int</code>; it is a sort of ''type function'' which takes another type as a parameter. More precisely, the ''kind'' of <code>f</code> must be <code>* -> *</code>. For example, <code>Maybe</code> is such a type with kind <code>* -> *</code>: <code>Maybe</code> is not a concrete type by itself (that is, there are no values of type <code>Maybe</code>), but requires another type as a parameter, like <code>Maybe Integer</code>. So it would not make sense to say <code>instance Functor Integer</code>, but it could make sense to say <code>instance Functor Maybe</code>.<br />
<br />
Now look at the type of <code>fmap</code>: it takes any function from <code>a</code> to <code>b</code>, and a value of type <code>f a</code>, and outputs a value of type <code>f b</code>. From the container point of view, the intention is that <code>fmap</code> applies a function to each element of a container, without altering the structure of the container. From the context point of view, the intention is that <code>fmap</code> applies a function to a value without altering its context. Let’s look at a few specific examples.<br />
<br />
Finally, we can understand <code>(<$)</code>: instead of applying a function to the values a container/context, it simply replaces them with a given value. This is the same as applying a constant function, so <code>(<$)</code> can be implemented in terms of <code>fmap</code>.<br />
<br />
==Instances==<br />
<br />
{{note|Recall that <code>[]</code> has two meanings in Haskell: it can either stand for the empty list, or, as here, it can represent the list type constructor (pronounced “list-of”). In other words, the type <code>[a]</code> (list-of-<code>a</code>) can also be written <code>[] a</code>.}}<br />
<br />
{{note|You might ask why we need a separate <code>map</code> function. Why not just do away with the current list-only <code>map</code> function, and rename <code>fmap</code> to <code>map</code> instead? Well, that’s a good question. The usual argument is that someone just learning Haskell, when using <code>map</code> incorrectly, would much rather see an error about lists than about <code>Functor</code>s.}}<br />
<br />
As noted before, the list constructor <code>[]</code> is a functor {{noteref}}; we can use the standard list function <code>map</code> to apply a function to each element of a list {{noteref}}. The <code>Maybe</code> type constructor is also a functor, representing a container which might hold a single element. The function <code>fmap g</code> has no effect on <code>Nothing</code> (there are no elements to which <code>g</code> can be applied), and simply applies <code>g</code> to the single element inside a <code>Just</code>. Alternatively, under the context interpretation, the list functor represents a context of nondeterministic choice; that is, a list can be thought of as representing a single value which is nondeterministically chosen from among several possibilities (the elements of the list). Likewise, the <code>Maybe</code> functor represents a context with possible failure. These instances are:<br />
<br />
<haskell><br />
instance Functor [] where<br />
fmap :: (a -> b) -> [a] -> [b]<br />
fmap _ [] = []<br />
fmap g (x:xs) = g x : fmap g xs<br />
-- or we could just say fmap = map<br />
<br />
instance Functor Maybe where<br />
fmap :: (a -> b) -> Maybe a -> Maybe b<br />
fmap _ Nothing = Nothing<br />
fmap g (Just a) = Just (g a)<br />
</haskell><br />
<br />
As an aside, in idiomatic Haskell code you will often see the letter <code>f</code> used to stand for both an arbitrary <code>Functor</code> and an arbitrary function. In this document, <code>f</code> represents only <code>Functor</code>s, and <code>g</code> or <code>h</code> always represent functions, but you should be aware of the potential confusion. In practice, what <code>f</code> stands for should always be clear from the context, by noting whether it is part of a type or part of the code.<br />
<br />
There are other <code>Functor</code> instances in the standard library as well:<br />
<br />
* <code>Either e</code> is an instance of <code>Functor</code>; <code>Either e a</code> represents a container which can contain either a value of type <code>a</code>, or a value of type <code>e</code> (often representing some sort of error condition). It is similar to <code>Maybe</code> in that it represents possible failure, but it can carry some extra information about the failure as well.<br />
<br />
* <code>((,) e)</code> represents a container which holds an “annotation” of type <code>e</code> along with the actual value it holds. It might be clearer to write it as <code>(e,)</code>, by analogy with an operator section like <code>(1+)</code>, but that syntax is not allowed in types (although it is allowed in expressions with the <code>TupleSections</code> extension enabled). However, you can certainly ''think'' of it as <code>(e,)</code>.<br />
<br />
* <code>((->) e)</code> (which can be thought of as <code>(e ->)</code>; see above), the type of functions which take a value of type <code>e</code> as a parameter, is a <code>Functor</code>. As a container, <code>(e -> a)</code> represents a (possibly infinite) set of values of <code>a</code>, indexed by values of <code>e</code>. Alternatively, and more usefully, <code>((->) e)</code> can be thought of as a context in which a value of type <code>e</code> is available to be consulted in a read-only fashion. This is also why <code>((->) e)</code> is sometimes referred to as the ''reader monad''; more on this later.<br />
<br />
* <code>IO</code> is a <code>Functor</code>; a value of type <code>IO a</code> represents a computation producing a value of type <code>a</code> which may have I/O effects. If <code>m</code> computes the value <code>x</code> while producing some I/O effects, then <code>fmap g m</code> will compute the value <code>g x</code> while producing the same I/O effects.<br />
<br />
* Many standard types from the [http://hackage.haskell.org/package/containers/ containers library] (such as <code>Tree</code>, <code>Map</code>, and <code>Sequence</code>) are instances of <code>Functor</code>. A notable exception is <code>Set</code>, which cannot be made a <code>Functor</code> in Haskell (although it is certainly a mathematical functor) since it requires an <code>Ord</code> constraint on its elements; <code>fmap</code> must be applicable to ''any'' types <code>a</code> and <code>b</code>. However, <code>Set</code> (and other similarly restricted data types) can be made an instance of a suitable generalization of <code>Functor</code>, either by [http://archive.fo/9sQhq making <code>a</code> and <code>b</code> arguments to the <code>Functor</code> type class themselves], or by adding an [http://blog.omega-prime.co.uk/?p=127 associated constraint].<br />
<br />
{{Exercises|<br />
<ol><br />
<li>Implement <code>Functor</code> instances for <code>Either e</code> and <code>((->) e)</code>.</li><br />
<li>Implement <code>Functor</code> instances for <code>((,) e)</code> and for <code>Pair</code>, defined as <br />
<br />
<haskell>data Pair a = Pair a a</haskell><br />
<br />
Explain their similarities and differences.<br />
</li><br />
<li>Implement a <code>Functor</code> instance for the type <code>ITree</code>, defined as<br />
<br />
<haskell><br />
data ITree a = Leaf (Int -> a) <br />
| Node [ITree a]<br />
</haskell><br />
</li><br />
<li>Give an example of a type of kind <code>* -> *</code> which cannot be made an instance of <code>Functor</code> (without using <code>undefined</code>).<br />
</li><br />
<li>Is this statement true or false? <br />
<br />
:''The composition of two <code>Functor</code>s is also a <code>Functor</code>.''<br />
<br />
If false, give a counterexample; if true, prove it by exhibiting some appropriate Haskell code.<br />
</li><br />
</ol><br />
}}<br />
<br />
==Laws==<br />
<br />
As far as the Haskell language itself is concerned, the only requirement to be a <code>Functor</code> is an implementation of <code>fmap</code> with the proper type. Any sensible <code>Functor</code> instance, however, will also satisfy the ''functor laws'', which are part of the definition of a mathematical functor. There are two:<br />
<br />
<haskell><br />
fmap id = id<br />
fmap (g . h) = (fmap g) . (fmap h)<br />
</haskell><br />
<br />
{{note|Technically, these laws make <code>f</code> and <code>fmap</code> together an endofunctor on ''Hask'', the category of Haskell types (ignoring [[Bottom|&perp;]], which is a party pooper). See [http://en.wikibooks.org/wiki/Haskell/Category_theory Wikibook: Category theory].}}<br />
<br />
Together, these laws ensure that <code>fmap g</code> does not change the ''structure'' of a container, only the elements. Equivalently, and more simply, they ensure that <code>fmap g</code> changes a value without altering its context {{noteref}}.<br />
<br />
The first law says that mapping the identity function over every item in a container has no effect. The second says that mapping a composition of two functions over every item in a container is the same as first mapping one function, and then mapping the other.<br />
<br />
As an example, the following code is a “valid” instance of <code>Functor</code> (it typechecks), but it violates the functor laws. Do you see why?<br />
<br />
<haskell><br />
-- Evil Functor instance<br />
instance Functor [] where<br />
fmap :: (a -> b) -> [a] -> [b]<br />
fmap _ [] = []<br />
fmap g (x:xs) = g x : g x : fmap g xs<br />
</haskell><br />
<br />
Any Haskeller worth their salt would reject this code as a gruesome abomination.<br />
<br />
Unlike some other type classes we will encounter, a given type has at most one valid instance of <code>Functor</code>. This [http://archive.fo/U8xIY can be proven] via the [http://homepages.inf.ed.ac.uk/wadler/topics/parametricity.html#free ''free theorem''] for the type of <code>fmap</code>. In fact, [http://byorgey.wordpress.com/2010/03/03/deriving-pleasure-from-ghc-6-12-1/ GHC can automatically derive] <code>Functor</code> instances for many data types.<br />
<br />
{{note|Actually, if <code>seq</code>/<code>undefined</code> are considered, it [http://stackoverflow.com/a/8323243/305559 is possible] to have an implementation which satisfies the first law but not the second. The rest of the comments in this section should be considered in a context where <code>seq</code> and <code>undefined</code> are excluded.}}<br />
<br />
A [https://github.com/quchen/articles/blob/master/second_functor_law.md similar argument also shows] that any <code>Functor</code> instance satisfying the first law (<code>fmap id = id</code>) will automatically satisfy the second law as well. Practically, this means that only the first law needs to be checked (usually by a very straightforward induction) to ensure that a <code>Functor</code> instance is valid.{{noteref}}<br />
<br />
{{Exercises|<br />
# Although it is not possible for a <code>Functor</code> instance to satisfy the first <code>Functor</code> law but not the second (excluding <code>undefined</code>), the reverse is possible. Give an example of a (bogus) <code>Functor</code> instance which satisfies the second law but not the first.<br />
# Which laws are violated by the evil <code>Functor</code> instance for list shown above: both laws, or the first law alone? Give specific counterexamples.<br />
}}<br />
<br />
==Intuition==<br />
<br />
There are two fundamental ways to think about <code>fmap</code>. The first has already been mentioned: it takes two parameters, a function and a container, and applies the function “inside” the container, producing a new container. Alternately, we can think of <code>fmap</code> as applying a function to a value in a context (without altering the context).<br />
<br />
Just like all other Haskell functions of “more than one parameter”, however, <code>fmap</code> is actually ''curried'': it does not really take two parameters, but takes a single parameter and returns a function. For emphasis, we can write <code>fmap</code>’s type with extra parentheses: <code>fmap :: (a -> b) -> (f a -> f b)</code>. Written in this form, it is apparent that <code>fmap</code> transforms a “normal” function (<code>g :: a -> b</code>) into one which operates over containers/contexts (<code>fmap g :: f a -> f b</code>). This transformation is often referred to as a ''lift''; <code>fmap</code> “lifts” a function from the “normal world” into the “<code>f</code> world”.<br />
<br />
==Utility functions==<br />
<br />
There are a few more <code>Functor</code>-related functions which can be imported from the <code>Data.Functor</code> module.<br />
<br />
* <code>(<$>)</code> is defined as a synonym for <code>fmap</code>. This enables a nice infix style that mirrors the <code>($)</code> operator for function application. For example, <code>f $ 3</code> applies the function <code>f</code> to 3, whereas <code>f <$> [1,2,3]</code> applies <code>f</code> to each member of the list.<br />
* <code>($>) :: Functor f => f a -> b -> f b</code> is just <code>flip (<$)</code>, and can occasionally be useful. To keep them straight, you can remember that <code>(<$)</code> and <code>($>)</code> point towards the value that will be kept.<br />
* <code>void :: Functor f => f a -> f ()</code> is a specialization of <code>(<$)</code>, that is, <code>void x = () <$ x</code>. This can be used in cases where a computation computes some value but the value should be ignored.<br />
<br />
==Further reading==<br />
<br />
A good starting point for reading about the category theory behind the concept of a functor is the excellent [http://en.wikibooks.org/wiki/Haskell/Category_theory Haskell wikibook page on category theory].<br />
<br />
=Applicative=<br />
<br />
A somewhat newer addition to the pantheon of standard Haskell type classes, ''applicative functors'' represent an abstraction lying in between <code>Functor</code> and <code>Monad</code> in expressivity, first described by McBride and Paterson. The title of their classic paper, [http://www.soi.city.ac.uk/~ross/papers/Applicative.html Applicative Programming with Effects], gives a hint at the intended intuition behind the [{{HackageDocs|base|Control-Applicative}} <code>Applicative</code>] type class. It encapsulates certain sorts of “effectful” computations in a functionally pure way, and encourages an “applicative” programming style. Exactly what these things mean will be seen later.<br />
<br />
==Definition==<br />
<br />
Recall that <code>Functor</code> allows us to lift a “normal” function to a function on computational contexts. But <code>fmap</code> doesn’t allow us to apply a function which is itself in a context to a value in a context. <code>Applicative</code> gives us just such a tool, <code>(<*>)</code> (variously pronounced as "apply", "app", or "splat"). It also provides a method, <code>pure</code>, for embedding values in a default, “effect free” context. Here is the type class declaration for <code>Applicative</code>, as defined in <code>Control.Applicative</code>:<br />
<br />
<haskell><br />
class Functor f => Applicative f where<br />
pure :: a -> f a<br />
infixl 4 <*>, *>, <*<br />
(<*>) :: f (a -> b) -> f a -> f b<br />
<br />
(*>) :: f a -> f b -> f b<br />
a1 *> a2 = (id <$ a1) <*> a2<br />
<br />
(<*) :: f a -> f b -> f a<br />
(<*) = liftA2 const<br />
</haskell><br />
<br />
Note that every <code>Applicative</code> must also be a <code>Functor</code>. In fact, as we will see, <code>fmap</code> can be implemented using the <code>Applicative</code> methods, so every <code>Applicative</code> is a functor whether we like it or not; the <code>Functor</code> constraint forces us to be honest.<br />
<br />
<code>(*>)</code> and <code>(<*)</code> are provided for convenience, in case a particular instance of <code>Applicative</code> can provide more efficient implementations, but they are provided with default implementations. For more on these operators, see the section on [[#Utility functions|Utility functions]] below.<br />
<br />
{{note|Recall that <code>($)</code> is just function application: <code>f $ x {{=}} f x</code>.}}<br />
<br />
As always, it’s crucial to understand the type signatures. First, consider <code>(<*>)</code>: the best way of thinking about it comes from noting that the type of <code>(<*>)</code> is similar to the type of <code>($)</code> {{noteref}}, but with everything enclosed in an <code>f</code>. In other words, <code>(<*>)</code> is just function application within a computational context. The type of <code>(<*>)</code> is also very similar to the type of <code>fmap</code>; the only difference is that the first parameter is <code>f (a -> b)</code>, a function in a context, instead of a “normal” function <code>(a -> b)</code>.<br />
<br />
<code>pure</code> takes a value of any type <code>a</code>, and returns a context/container of type <code>f a</code>. The intention is that <code>pure</code> creates some sort of “default” container or “effect free” context. In fact, the behavior of <code>pure</code> is quite constrained by the laws it should satisfy in conjunction with <code>(<*>)</code>. Usually, for a given implementation of <code>(<*>)</code> there is only one possible implementation of <code>pure</code>.<br />
<br />
(Note that previous versions of the Typeclassopedia explained <code>pure</code> in terms of a type class <code>Pointed</code>, which can still be found in the [http://hackage.haskell.org/package/pointed <code>pointed</code> package]. However, the current consensus is that <code>Pointed</code> is not very useful after all. For a more detailed explanation, see [[Why not Pointed?]])<br />
<br />
==Laws==<br />
<br />
{{note|See<br />
[{{HackageDocs|base|Control-Applicative}} haddock for Applicative] and [http://www.soi.city.ac.uk/~ross/papers/Applicative.html Applicative programming with effects]}}<br />
<br />
Traditionally, there are four laws that <code>Applicative</code> instances should satisfy {{noteref}}. In some sense, they are all concerned with making sure that <code>pure</code> deserves its name:<br />
<br />
* The identity law:<br /><haskell>pure id <*> v = v</haskell><br />
* Homomorphism:<br /><haskell>pure f <*> pure x = pure (f x)</haskell>Intuitively, applying a non-effectful function to a non-effectful argument in an effectful context is the same as just applying the function to the argument and then injecting the result into the context with <code>pure</code>.<br />
* Interchange:<br /><haskell>u <*> pure y = pure ($ y) <*> u</haskell>Intuitively, this says that when evaluating the application of an effectful function to a pure argument, the order in which we evaluate the function and its argument doesn't matter.<br />
* Composition:<br /><haskell>u <*> (v <*> w) = pure (.) <*> u <*> v <*> w </haskell>This one is the trickiest law to gain intuition for. In some sense it is expressing a sort of associativity property of <code>(<*>)</code>. The reader may wish to simply convince themselves that this law is type-correct.<br />
<br />
Considered as left-to-right rewrite rules, the homomorphism, interchange, and composition laws actually constitute an algorithm for transforming any expression using <code>pure</code> and <code>(<*>)</code> into a canonical form with only a single use of <code>pure</code> at the very beginning and only left-nested occurrences of <code>(<*>)</code>. Composition allows reassociating <code>(<*>)</code>; interchange allows moving occurrences of <code>pure</code> leftwards; and homomorphism allows collapsing multiple adjacent occurrences of <code>pure</code> into one.<br />
<br />
There is also a law specifying how <code>Applicative</code> should relate to <code>Functor</code>:<br />
<br />
<haskell><br />
fmap g x = pure g <*> x<br />
</haskell><br />
<br />
It says that mapping a pure function <code>g</code> over a context <code>x</code> is the same as first injecting <code>g</code> into a context with <code>pure</code>, and then applying it to <code>x</code> with <code>(<*>)</code>. In other words, we can decompose <code>fmap</code> into two more atomic operations: injection into a context, and application within a context. Since <code>(<$>)</code> is a synonym for <code>fmap</code>, the above law can also be expressed as:<br />
<br />
<code>g <$> x = pure g <*> x</code>.<br />
<br />
{{Exercises|<br />
# (Tricky) One might imagine a variant of the interchange law that says something about applying a pure function to an effectful argument. Using the above laws, prove that<haskell>pure f <*> x = pure (flip ($)) <*> x <*> pure f</haskell><br />
}}<br />
<br />
==Instances==<br />
<br />
Most of the standard types which are instances of <code>Functor</code> are also instances of <code>Applicative</code>.<br />
<br />
<code>Maybe</code> can easily be made an instance of <code>Applicative</code>; writing such an instance is left as an exercise for the reader.<br />
<br />
The list type constructor <code>[]</code> can actually be made an instance of <code>Applicative</code> in two ways; essentially, it comes down to whether we want to think of lists as ordered collections of elements, or as contexts representing multiple results of a nondeterministic computation (see Wadler’s [http://www.springerlink.com/content/y7450255v2670167/ How to replace failure by a list of successes]).<br />
<br />
Let’s first consider the collection point of view. Since there can only be one instance of a given type class for any particular type, one or both of the list instances of <code>Applicative</code> need to be defined for a <code>newtype</code> wrapper; as it happens, the nondeterministic computation instance is the default, and the collection instance is defined in terms of a <code>newtype</code> called <code>ZipList</code>. This instance is:<br />
<br />
<haskell><br />
newtype ZipList a = ZipList { getZipList :: [a] }<br />
<br />
instance Applicative ZipList where<br />
pure :: a -> ZipList a<br />
pure = undefined -- exercise<br />
<br />
(<*>) :: ZipList (a -> b) -> ZipList a -> ZipList b<br />
(ZipList gs) <*> (ZipList xs) = ZipList (zipWith ($) gs xs)<br />
</haskell><br />
<br />
To apply a list of functions to a list of inputs with <code>(<*>)</code>, we just match up the functions and inputs elementwise, and produce a list of the resulting outputs. In other words, we “zip” the lists together with function application, <code>($)</code>; hence the name <code>ZipList</code>. <br />
<br />
The other <code>Applicative</code> instance for lists, based on the nondeterministic computation point of view, is:<br />
<br />
<haskell><br />
instance Applicative [] where<br />
pure :: a -> [a]<br />
pure x = [x]<br />
<br />
(<*>) :: [a -> b] -> [a] -> [b]<br />
gs <*> xs = [ g x | g <- gs, x <- xs ]<br />
</haskell><br />
<br />
Instead of applying functions to inputs pairwise, we apply each function to all the inputs in turn, and collect all the results in a list.<br />
<br />
Now we can write nondeterministic computations in a natural style. To add the numbers <code>3</code> and <code>4</code> deterministically, we can of course write <code>(+) 3 4</code>. But suppose instead of <code>3</code> we have a nondeterministic computation that might result in <code>2</code>, <code>3</code>, or <code>4</code>; then we can write<br />
<br />
<haskell><br />
pure (+) <*> [2,3,4] <*> pure 4<br />
</haskell><br />
<br />
or, more idiomatically,<br />
<br />
<haskell><br />
(+) <$> [2,3,4] <*> pure 4.<br />
</haskell><br />
<br />
There are several other <code>Applicative</code> instances as well:<br />
<br />
* <code>IO</code> is an instance of <code>Applicative</code>, and behaves exactly as you would think: to execute <code>m1 <*> m2</code>, first <code>m1</code> is executed, resulting in a function <code>f</code>, then <code>m2</code> is executed, resulting in a value <code>x</code>, and finally the value <code>f x</code> is returned as the result of executing <code>m1 <*> m2</code>.<br />
<br />
* <code>((,) a)</code> is an <code>Applicative</code>, as long as <code>a</code> is an instance of <code>Monoid</code> ([[#Monoid|section Monoid]]). The <code>a</code> values are accumulated in parallel with the computation.<br />
<br />
* The <code>Applicative</code> module defines the <code>Const</code> type constructor; a value of type <code>Const a b</code> simply contains an <code>a</code>. This is an instance of <code>Applicative</code> for any <code>Monoid a</code>; this instance becomes especially useful in conjunction with things like <code>Foldable</code> ([[#Foldable|section Foldable]]).<br />
<br />
* The <code>WrappedMonad</code> and <code>WrappedArrow</code> newtypes make any instances of <code>Monad</code> ([[#Monad|section Monad]]) or <code>Arrow</code> ([[#Arrow|section Arrow]]) respectively into instances of <code>Applicative</code>; as we will see when we study those type classes, both are strictly more expressive than <code>Applicative</code>, in the sense that the <code>Applicative</code> methods can be implemented in terms of their methods.<br />
<br />
{{Exercises|<br />
# Implement an instance of <code>Applicative</code> for <code>Maybe</code>.<br />
# Determine the correct definition of <code>pure</code> for the <code>ZipList</code> instance of <code>Applicative</code>—there is only one implementation that satisfies the law relating <code>pure</code> and <code>(<*>)</code>.<br />
}}<br />
<br />
==Intuition==<br />
<br />
McBride and Paterson’s paper introduces the notation <math>[[g \; x_1 \; x_2 \; \cdots \; x_n]]\ </math> to denote function application in a computational context. If each <math>x_i\ </math> has type <math>f \; t_i\ </math> for some applicative functor <math>f\ </math>, and <math>g\ </math> has type <math>t_1 \to t_2 \to \dots \to t_n \to t\ </math>, then the entire expression <math>[[g \; x_1 \; \cdots \; x_n]]\ </math> has type <math>f \; t\ </math>. You can think of this as applying a function to multiple “effectful” arguments. In this sense, the double bracket notation is a generalization of <code>fmap</code>, which allows us to apply a function to a single argument in a context.<br />
<br />
Why do we need <code>Applicative</code> to implement this generalization of <code>fmap</code>? Suppose we use <code>fmap</code> to apply <code>g</code> to the first parameter <code>x1</code>. Then we get something of type <code>f (t2 -> ... t)</code>, but now we are stuck: we can’t apply this function-in-a-context to the next argument with <code>fmap</code>. However, this is precisely what <code>(<*>)</code> allows us to do.<br />
<br />
This suggests the proper translation of the idealized notation <math>[[g \; x_1 \; x_2 \; \cdots \; x_n]]\ </math> into Haskell, namely<br />
<haskell><br />
g <$> x1 <*> x2 <*> ... <*> xn,<br />
</haskell><br />
<br />
recalling that <code>Control.Applicative</code> defines <code>(<$>)</code> as convenient infix shorthand for <code>fmap</code>. This is what is meant by an “applicative style”—effectful computations can still be described in terms of function application; the only difference is that we have to use the special operator <code>(<*>)</code> for application instead of simple juxtaposition.<br />
<br />
Note that <code>pure</code> allows embedding “non-effectful” arguments in the middle of an idiomatic application, like<br />
<haskell><br />
g <$> x1 <*> pure x2 <*> x3<br />
</haskell><br />
which has type <code>f d</code>, given<br />
<haskell><br />
g :: a -> b -> c -> d<br />
x1 :: f a<br />
x2 :: b<br />
x3 :: f c<br />
</haskell><br />
<br />
The double brackets are commonly known as “idiom brackets”, because they allow writing “idiomatic” function application, that is, function application that looks normal but has some special, non-standard meaning (determined by the particular instance of <code>Applicative</code> being used). Idiom brackets are not supported by GHC, but they are supported by the [http://personal.cis.strath.ac.uk/~conor/pub/she/ Strathclyde Haskell Enhancement], a preprocessor which (among many other things) translates idiom brackets into standard uses of <code>(<$>)</code> and <code>(<*>)</code>. This can result in much more readable code when making heavy use of <code>Applicative</code>.<br />
<br />
In addition, as of GHC 8, the <code>ApplicativeDo</code> extension enables <code>g <$> x1 <*> x2 <*> ... <*> xn</code> to be written in a different style:<br />
<haskell><br />
do v1 <- x1<br />
v2 <- x2<br />
...<br />
vn <- xn<br />
pure (g v1 v2 ... vn)<br />
</haskell><br />
See the Further Reading section below as well as the discussion of do-notation in the Monad section for more information.<br />
<br />
==Utility functions==<br />
<br />
<code>Control.Applicative</code> provides several utility functions that work generically with any <code>Applicative</code> instance.<br />
<br />
* <code>liftA :: Applicative f => (a -> b) -> f a -> f b</code>. This should be familiar; of course, it is the same as <code>fmap</code> (and hence also the same as <code>(<$>)</code>), but with a more restrictive type. This probably exists to provide a parallel to <code>liftA2</code> and <code>liftA3</code>, but there is no reason you should ever need to use it.<br />
<br />
* <code>liftA2 :: Applicative f => (a -> b -> c) -> f a -> f b -> f c</code> lifts a 2-argument function to operate in the context of some <code>Applicative</code>. When <code>liftA2</code> is fully applied, as in <code>liftA2 f arg1 arg2</code>,it is typically better style to instead use <code>f <$> arg1 <*> arg2</code>. However, <code>liftA2</code> can be useful in situations where it is partially applied. For example, one could define a <code>Num</code> instance for <code>Maybe Integer</code> by defining <code>(+) = liftA2 (+)</code> and so on.<br />
<br />
* There is a <code>liftA3</code> but no <code>liftAn</code> for larger <code>n</code>.<br />
<br />
* <code>(*>) :: Applicative f => f a -> f b -> f b</code> sequences the effects of two <code>Applicative</code> computations, but discards the result of the first. For example, if <code>m1, m2 :: Maybe Int</code>, then <code>m1 *> m2</code> is <code>Nothing</code> whenever either <code>m1</code> or <code>m2</code> is <code>Nothing</code>; but if not, it will have the same value as <code>m2</code>.<br />
<br />
* Likewise, <code>(<*) :: Applicative f => f a -> f b -> f a</code> sequences the effects of two computations, but keeps only the result of the first, discarding the result of the second. Just as with <code>(<$)</code> and <code>($>)</code>, to keep <code>(<*)</code> and <code>(*>)</code> straight, remember that they point towards the values that will be kept.<br />
<br />
* <code>(<**>) :: Applicative f => f a -> f (a -> b) -> f b</code> is similar to <code>(<*>)</code>, but where the first computation produces value(s) which are provided as input to the function(s) produced by the second computation. Note this is not the same as <code>flip (<*>)</code>, because the effects are performed in the opposite order. This is possible to observe with any <code>Applicative</code> instance with non-commutative effects, such as the instance for lists: <code>(<**>) [1,2] [(+5),(*10)]</code> produces a different result than <code>(flip (<*>))</code> on the same arguments. <br />
<br />
* <code>when :: Applicative f => Bool -> f () -> f ()</code> conditionally executes a computation, evaluating to its second argument if the test is <code>True</code>, and to <code>pure ()</code> if the test is <code>False</code>.<br />
<br />
* <code>unless :: Applicative f => Bool -> f () -> f ()</code> is like <code>when</code>, but with the test negated.<br />
<br />
* The <code>guard</code> function is for use with instances of <code>Alternative</code> (an extension of <code>Applicative</code> to incorporate the ideas of failure and choice), which is discussed in the [[#Failure_and_choice:_Alternative.2C_MonadPlus.2C_ArrowPlus|section on <code>Alternative</code> and friends]].<br />
<br />
{{Exercises|<br />
# Implement a function <haskell>sequenceAL :: Applicative f => [f a] -> f [a]</haskell>. There is a generalized version of this, <code>sequenceA</code>, which works for any <code>Traversable</code> (see the later section on Traversable), but implementing this version specialized to lists is a good exercise.<br />
}}<br />
<br />
==Alternative formulation==<br />
<br />
An alternative, equivalent formulation of <code>Applicative</code> is given by<br />
<br />
<haskell><br />
class Functor f => Monoidal f where<br />
unit :: f ()<br />
(**) :: f a -> f b -> f (a,b)<br />
</haskell><br />
<br />
{{note|In category-theory speak, we say <code>f</code> is a ''lax'' monoidal functor because there aren't necessarily functions in the other direction, like <code>f (a, b) -> (f a, f b)</code>.}}<br />
Intuitively, this states that a <i>monoidal</i> functor{{noteref}} is one which has some sort of "default shape" and which supports some sort of "combining" operation. <code>pure</code> and <code>(<*>)</code> are equivalent in power to <code>unit</code> and <code>(**)</code> (see the Exercises below). More technically, the idea is that <code>f</code> preserves the "monoidal structure" given by the pairing constructor <code>(,)</code> and unit type <code>()</code>. This can be seen even more clearly if we rewrite the types of <code>unit</code> and <code>(**)</code> as<br />
<haskell><br />
unit' :: () -> f ()<br />
(**') :: (f a, f b) -> f (a, b)<br />
</haskell><br />
<br />
Furthermore, to deserve the name "monoidal" (see the [[#Monoid|section on Monoids]]), instances of <code>Monoidal</code> ought to satisfy the following laws, which seem much more straightforward than the traditional <code>Applicative</code> laws:<br />
<br />
{{note|In this and the following laws, <code>≅</code> refers to <i>isomorphism</i> rather than equality. In particular we consider <code>(x,()) ≅ x ≅ ((),x)</code> and <code>((x,y),z) ≅ (x,(y,z))</code>.}}<br />
* Left identity{{noteref}}: <haskell>unit ** v ≅ v</haskell><br />
* Right identity: <haskell>u ** unit ≅ u</haskell><br />
* Associativity: <haskell>u ** (v ** w) ≅ (u ** v) ** w</haskell><br />
<br />
These turn out to be equivalent to the usual <code>Applicative</code> laws. In a category theory setting, one would also require a naturality law:<br />
<br />
{{note|Here <code>g *** h {{=}} \(x,y) -> (g x, h y)</code>. See [[#Arrow|Arrows]].}}<br />
* Naturality: <haskell>fmap (g *** h) (u ** v) = fmap g u ** fmap h v</haskell><br />
<br />
but in the context of Haskell, this is a free theorem.<br />
<br />
Much of this section was taken from [http://blog.ezyang.com/2012/08/applicative-functors/ a blog post by Edward Z. Yang]; see his actual post for a bit more information.<br />
<br />
{{Exercises|<br />
# Implement <code>pure</code> and <code>(<*>)</code> in terms of <code>unit</code> and <code>(**)</code>, and vice versa.<br />
# Are there any <code>Applicative</code> instances for which there are also functions <code>f () -> ()</code> and <code>f (a,b) -> (f a, f b)</code>, satisfying some "reasonable" laws?<br />
# (Tricky) Prove that given your implementations from the first exercise, the usual <code>Applicative</code> laws and the <code>Monoidal</code> laws stated above are equivalent.<br />
}}<br />
<br />
==Further reading==<br />
<br />
[http://www.soi.city.ac.uk/~ross/papers/Applicative.html McBride and Paterson’s original paper] is a treasure-trove of information and examples, as well as some perspectives on the connection between <code>Applicative</code> and category theory. Beginners will find it difficult to make it through the entire paper, but it is extremely well-motivated—even beginners will be able to glean something from reading as far as they are able.<br />
<br />
{{note|Introduced by [http://conal.net/papers/simply-reactive/ an earlier paper] that was since superseded by [http://conal.net/papers/push-pull-frp/ Push-pull functional reactive programming].}}<br />
<br />
Conal Elliott has been one of the biggest proponents of <code>Applicative</code>. For example, the [http://conal.net/papers/functional-images/ Pan library for functional images] and the reactive library for functional reactive programming (FRP) {{noteref}} make key use of it; his blog also contains [http://conal.net/blog/tag/applicative-functor many examples of <code>Applicative</code> in action]. Building on the work of McBride and Paterson, Elliott also built the [[TypeCompose]] library, which embodies the observation (among others) that <code>Applicative</code> types are closed under composition; therefore, <code>Applicative</code> instances can often be automatically derived for complex types built out of simpler ones.<br />
<br />
Although the [http://hackage.haskell.org/package/parsec Parsec parsing library] ([http://legacy.cs.uu.nl/daan/download/papers/parsec-paper.pdf paper]) was originally designed for use as a monad, in its most common use cases an <code>Applicative</code> instance can be used to great effect; [http://www.serpentine.com/blog/2008/02/06/the-basics-of-applicative-functors-put-to-practical-work/ Bryan O’Sullivan’s blog post] is a good starting point. If the extra power provided by <code>Monad</code> isn’t needed, it’s usually a good idea to use <code>Applicative</code> instead.<br />
<br />
A couple other nice examples of <code>Applicative</code> in action include the [http://web.archive.org/web/20090416111947/chrisdone.com/blog/html/2009-02-10-applicative-configfile-hsql.html ConfigFile and HSQL libraries] and the [http://groups.inf.ed.ac.uk/links/formlets/ formlets library].<br />
<br />
Gershom Bazerman's [http://comonad.com/reader/2012/abstracting-with-applicatives/ post] contains many insights into applicatives.<br />
<br />
The <code>ApplicativeDo</code> extension is described in [https://ghc.haskell.org/trac/ghc/wiki/ApplicativeDo this wiki page], and in more detail in [http://doi.org/10.1145/2976002.2976007 this Haskell Symposium paper].<br />
<br />
=Monad=<br />
<br />
It’s a safe bet that if you’re reading this, you’ve heard of monads—although it’s quite possible you’ve never heard of <code>Applicative</code> before, or <code>Arrow</code>, or even <code>Monoid</code>. Why are monads such a big deal in Haskell? There are several reasons.<br />
<br />
* Haskell does, in fact, single out monads for special attention by making them the framework in which to construct I/O operations.<br />
* Haskell also singles out monads for special attention by providing a special syntactic sugar for monadic expressions: the <code>do</code>-notation. (As of GHC 8, <code>do</code>-notation can be used with <code>Applicative</code> as well, but the notation is still fundamentally related to monads.)<br />
* <code>Monad</code> has been around longer than other abstract models of computation such as <code>Applicative</code> or <code>Arrow</code>.<br />
* The more monad tutorials there are, the harder people think monads must be, and the more new monad tutorials are written by people who think they finally “get” monads (the [http://byorgey.wordpress.com/2009/01/12/abstraction-intuition-and-the-monad-tutorial-fallacy/ monad tutorial fallacy]).<br />
<br />
I will let you judge for yourself whether these are good reasons.<br />
<br />
In the end, despite all the hoopla, <code>Monad</code> is just another type class. Let’s take a look at its definition.<br />
<br />
==Definition==<br />
As of GHC 7.10, [{{HackageDocs|base|Prelude}}#t:Monad <code>Monad</code>] is defined as:<br />
<br />
<haskell><br />
class Applicative m => Monad m where<br />
return :: a -> m a<br />
(>>=) :: m a -> (a -> m b) -> m b<br />
(>>) :: m a -> m b -> m b<br />
m >> n = m >>= \_ -> n<br />
<br />
fail :: String -> m a<br />
</haskell><br />
<br />
(Prior to GHC 7.10, <code>Applicative</code> was not a superclass of <code>Monad</code>, for historical reasons.)<br />
<br />
The <code>Monad</code> type class is exported by the <code>Prelude</code>, along with a few standard instances. However, many utility functions are found in [{{HackageDocs|base|Control-Monad}} <code>Control.Monad</code>].<br />
<br />
Let’s examine the methods in the <code>Monad</code> class one by one. The type of <code>return</code> should look familiar; it’s the same as <code>pure</code>. Indeed, <code>return</code> ''is'' <code>pure</code>, but with an unfortunate name. (Unfortunate, since someone coming from an imperative programming background might think that <code>return</code> is like the C or Java keyword of the same name, when in fact the similarities are minimal.) For historical reasons, we still have both names, but they should always denote the same value (although this cannot be enforced). Likewise, <code>(>>)</code> should be the same as <code>(*>)</code> from <code>Applicative</code>. It is possible that <code>return</code> and <code>(>>)</code> may eventually be removed from the <code>Monad</code> class: see the [https://ghc.haskell.org/trac/ghc/wiki/Proposal/MonadOfNoReturn Monad of No Return proposal].<br />
<br />
We can see that <code>(>>)</code> is a specialized version of <code>(>>=)</code>, with a default implementation given. It is only included in the type class declaration so that specific instances of <code>Monad</code> can override the default implementation of <code>(>>)</code> with a more efficient one, if desired. Also, note that although <code>_ >> n = n</code> would be a type-correct implementation of <code>(>>)</code>, it would not correspond to the intended semantics: the intention is that <code>m >> n</code> ignores the ''result'' of <code>m</code>, but not its ''effects''.<br />
<br />
The <code>fail</code> function is an awful hack that has no place in the <code>Monad</code> class; more on this later.<br />
<br />
The only really interesting thing to look at—and what makes <code>Monad</code> strictly more powerful than <code>Applicative</code>—is <code>(>>=)</code>, which is often called ''bind''.<br />
<br />
We could spend a while talking about the intuition behind <code>(>>=)</code>—and we will. But first, let’s look at some examples.<br />
<br />
==Instances==<br />
<br />
Even if you don’t understand the intuition behind the <code>Monad</code> class, you can still create instances of it by just seeing where the types lead you. You may be surprised to find that this actually gets you a long way towards understanding the intuition; at the very least, it will give you some concrete examples to play with as you read more about the <code>Monad</code> class in general. The first few examples are from the standard <code>Prelude</code>; the remaining examples are from the [http://hackage.haskell.org/package/transformers <code>transformers</code> package].<br />
<br />
<ul><br />
<li>The simplest possible instance of <code>Monad</code> is [http://hackage.haskell.org/packages/archive/mtl/1.1.0.2/doc/html/Control-Monad-Identity.html <code>Identity</code>], which is described in Dan Piponi’s highly recommended blog post on [http://blog.sigfpe.com/2007/04/trivial-monad.html The Trivial Monad]. Despite being “trivial”, it is a great introduction to the <code>Monad</code> type class, and contains some good exercises to get your brain working.<br />
</li><br />
<li>The next simplest instance of <code>Monad</code> is <code>Maybe</code>. We already know how to write <code>return</code>/<code>pure</code> for <code>Maybe</code>. So how do we write <code>(>>=)</code>? Well, let’s think about its type. Specializing for <code>Maybe</code>, we have<br />
<br />
<haskell><br />
(>>=) :: Maybe a -> (a -> Maybe b) -> Maybe b.<br />
</haskell><br />
<br />
If the first argument to <code>(>>=)</code> is <code>Just x</code>, then we have something of type <code>a</code> (namely, <code>x</code>), to which we can apply the second argument—resulting in a <code>Maybe b</code>, which is exactly what we wanted. What if the first argument to <code>(>>=)</code> is <code>Nothing</code>? In that case, we don’t have anything to which we can apply the <code>a -> Maybe b</code> function, so there’s only one thing we can do: yield <code>Nothing</code>. This instance is:<br />
<br />
<haskell><br />
instance Monad Maybe where<br />
return :: a -> Maybe a<br />
return = Just<br />
<br />
(>>=) :: Maybe a -> (a -> Maybe b) -> Maybe b<br />
(Just x) >>= g = g x<br />
Nothing >>= _ = Nothing<br />
</haskell><br />
<br />
We can already get a bit of intuition as to what is going on here: if we build up a computation by chaining together a bunch of functions with <code>(>>=)</code>, as soon as any one of them fails, the entire computation will fail (because <code>Nothing >>= f</code> is <code>Nothing</code>, no matter what <code>f</code> is). The entire computation succeeds only if all the constituent functions individually succeed. So the <code>Maybe</code> monad models computations which may fail.<br />
</li><br />
<br />
<li>The <code>Monad</code> instance for the list constructor <code>[]</code> is similar to its <code>Applicative</code> instance; see the exercise below.<br />
</li><br />
<br />
<li>Of course, the <code>IO</code> constructor is famously a <code>Monad</code>, but its implementation is somewhat magical, and may in fact differ from compiler to compiler. It is worth emphasizing that the <code>IO</code> monad is the ''only'' monad which is magical. It allows us to build up, in an entirely pure way, values representing possibly effectful computations. The special value <code>main</code>, of type <code>IO ()</code>, is taken by the runtime and actually executed, producing actual effects. Every other monad is functionally pure, and requires no special compiler support. We often speak of monadic values as “effectful computations”, but this is because some monads allow us to write code ''as if'' it has side effects, when in fact the monad is hiding the plumbing which allows these apparent side effects to be implemented in a functionally pure way.<br />
</li><br />
<br />
<li>As mentioned earlier, <code>((->) e)</code> is known as the ''reader monad'', since it describes computations in which a value of type <code>e</code> is available as a read-only environment.<br />
<br />
The [http://hackage.haskell.org/packages/archive/mtl/latest/doc/html/Control-Monad-Reader.html <code>Control.Monad.Reader</code>] module provides the <code>Reader e a</code> type, which is just a convenient <code>newtype</code> wrapper around <code>(e -> a)</code>, along with an appropriate <code>Monad</code> instance and some <code>Reader</code>-specific utility functions such as <code>ask</code> (retrieve the environment), <code>asks</code> (retrieve a function of the environment), and <code>local</code> (run a subcomputation under a different environment).<br />
</li><br />
<br />
<li>The [http://hackage.haskell.org/packages/archive/mtl/latest/doc/html/Control-Monad-Writer-Lazy.html <code>Control.Monad.Writer</code>] module provides the <code>Writer</code> monad, which allows information to be collected as a computation progresses. <code>Writer w a</code> is isomorphic to <code>(a,w)</code>, where the output value <code>a</code> is carried along with an annotation or “log” of type <code>w</code>, which must be an instance of <code>Monoid</code> (see [[#Monoid|section Monoid]]); the special function <code>tell</code> performs logging.<br />
</li><br />
<br />
<li>The [http://hackage.haskell.org/packages/archive/mtl/latest/doc/html/Control-Monad-State-Lazy.html <code>Control.Monad.State</code>] module provides the <code>State s a</code> type, a <code>newtype</code> wrapper around <code>s -> (a,s)</code>. Something of type <code>State s a</code> represents a stateful computation which produces an <code>a</code> but can access and modify the state of type <code>s</code> along the way. The module also provides <code>State</code>-specific utility functions such as <code>get</code> (read the current state), <code>gets</code> (read a function of the current state), <code>put</code> (overwrite the state), and <code>modify</code> (apply a function to the state).<br />
</li><br />
<br />
<li>The [http://hackage.haskell.org/packages/archive/mtl/latest/doc/html/Control-Monad-Cont.html <code>Control.Monad.Cont</code>] module provides the <code>Cont</code> monad, which represents computations in continuation-passing style. It can be used to suspend and resume computations, and to implement non-local transfers of control, co-routines, other complex control structures—all in a functionally pure way. <code>Cont</code> has been called the [http://blog.sigfpe.com/2008/12/mother-of-all-monads.html “mother of all monads”] because of its universal properties.<br />
</li><br />
</ul><br />
<br />
{{Exercises|<br />
<ol><br />
<li>Implement a <code>Monad</code> instance for the list constructor, <code>[]</code>. Follow the types!</li><br />
<li>Implement a <code>Monad</code> instance for <code>((->) e)</code>.</li><br />
<li>Implement <code>Functor</code> and <code>Monad</code> instances for <code>Free f</code>, defined as<br />
<haskell><br />
data Free f a = Var a<br />
| Node (f (Free f a))<br />
</haskell><br />
You may assume that <code>f</code> has a <code>Functor</code> instance. This is known as the ''free monad'' built from the functor <code>f</code>.<br />
</li><br />
</ol><br />
}}<br />
<br />
==Intuition==<br />
<br />
Let’s look more closely at the type of <code>(>>=)</code>. The basic intuition is that it combines two computations into one larger computation. The first argument, <code>m a</code>, is the first computation. However, it would be boring if the second argument were just an <code>m b</code>; then there would be no way for the computations to interact with one another (actually, this is exactly the situation with <code>Applicative</code>). So, the second argument to <code>(>>=)</code> has type <code>a -> m b</code>: a function of this type, given a ''result'' of the first computation, can produce a second computation to be run. In other words, <code>x >>= k</code> is a computation which runs <code>x</code>, and then uses the result(s) of <code>x</code> to ''decide'' what computation to run second, using the output of the second computation as the result of the entire computation.<br />
<br />
{{note|Actually, because Haskell allows general recursion, one can recursively construct ''infinite'' grammars, and hence <code>Applicative</code> (together with <code>Alternative</code>) is enough to parse any context-sensitive language with a finite alphabet. See [http://byorgey.wordpress.com/2012/01/05/parsing-context-sensitive-languages-with-applicative/ Parsing context-sensitive languages with Applicative].}}<br />
Intuitively, it is this ability to use the output from previous computations to decide what computations to run next that makes <code>Monad</code> more powerful than <code>Applicative</code>. The structure of an <code>Applicative</code> computation is fixed, whereas the structure of a <code>Monad</code> computation can change based on intermediate results. This also means that parsers built using an <code>Applicative</code> interface can only parse context-free languages; in order to parse context-sensitive languages a <code>Monad</code> interface is needed.{{noteref}}<br />
<br />
To see the increased power of <code>Monad</code> from a different point of view, let’s see what happens if we try to implement <code>(>>=)</code> in terms of <code>fmap</code>, <code>pure</code>, and <code>(<*>)</code>. We are given a value <code>x</code> of type <code>m a</code>, and a function <code>k</code> of type <code>a -> m b</code>, so the only thing we can do is apply <code>k</code> to <code>x</code>. We can’t apply it directly, of course; we have to use <code>fmap</code> to lift it over the <code>m</code>. But what is the type of <code>fmap k</code>? Well, it’s <code>m a -> m (m b)</code>. So after we apply it to <code>x</code>, we are left with something of type <code>m (m b)</code>—but now we are stuck; what we really want is an <code>m b</code>, but there’s no way to get there from here. We can ''add'' <code>m</code>’s using <code>pure</code>, but we have no way to ''collapse'' multiple <code>m</code>’s into one.<br />
<br />
{{note|1=You might hear some people claim that the definition in terms of <code>return</code>, <code>fmap</code>, and <code>join</code> is the “math definition” and the definition in terms of <code>return</code> and <code>(>>=)</code> is something specific to Haskell. In fact, both definitions were known in the mathematics community long before Haskell picked up monads.}}<br />
<br />
This ability to collapse multiple <code>m</code>’s is exactly the ability provided by the function <code>join :: m (m a) -> m a</code>, and it should come as no surprise that an alternative definition of <code>Monad</code> can be given in terms of <code>join</code>:<br />
<br />
<haskell><br />
class Applicative m => Monad'' m where<br />
join :: m (m a) -> m a<br />
</haskell><br />
<br />
In fact, the canonical definition of monads in category theory is in terms of <code>return</code>, <code>fmap</code>, and <code>join</code> (often called <math>\eta</math>, <math>T</math>, and <math>\mu</math> in the mathematical literature). Haskell uses an alternative formulation with <code>(>>=)</code> instead of <code>join</code> since it is more convenient to use {{noteref}}. However, sometimes it can be easier to think about <code>Monad</code> instances in terms of <code>join</code>, since it is a more “atomic” operation. (For example, <code>join</code> for the list monad is just <code>concat</code>.)<br />
<br />
{{Exercises|<br />
# Implement <code>(>>{{=}})</code> in terms of <code>fmap</code> (or <code>liftM</code>) and <code>join</code>.<br />
# Now implement <code>join</code> and <code>fmap</code> (<code>liftM</code>) in terms of <code>(>>{{=}})</code> and <code>return</code>.<br />
}}<br />
<br />
==Utility functions==<br />
<br />
The [{{HackageDocs|base|Control-Monad}} <code>Control.Monad</code>] module provides a large number of convenient utility functions, all of which can be implemented in terms of the basic <code>Monad</code> operations (<code>return</code> and <code>(>>=)</code> in particular). We have already seen one of them, namely, <code>join</code>. We also mention some other noteworthy ones here; implementing these utility functions oneself is a good exercise. For a more detailed guide to these functions, with commentary and example code, see Henk-Jan van Tuyl’s [http://members.chello.nl/hjgtuyl/tourdemonad.html tour].<br />
<br />
* <code>liftM :: Monad m => (a -> b) -> m a -> m b</code>. This should be familiar; of course, it is just <code>fmap</code>. The fact that we have both <code>fmap</code> and <code>liftM</code> is a consequence of the fact that the <code>Monad</code> type class did not require a <code>Functor</code> instance until recently, even though mathematically speaking, every monad is a functor. If you are using GHC 7.10 or newer, you should avoid using <code>liftM</code> and just use <code>fmap</code> instead.<br />
<br />
* <code>ap :: Monad m => m (a -> b) -> m a -> m b</code> should also be familiar: it is equivalent to <code>(<*>)</code>, justifying the claim that the <code>Monad</code> interface is strictly more powerful than <code>Applicative</code>. We can make any <code>Monad</code> into an instance of <code>Applicative</code> by setting <code>pure = return</code> and <code>(<*>) = ap</code>.<br />
<br />
* <code>sequence :: Monad m => [m a] -> m [a]</code> takes a list of computations and combines them into one computation which collects a list of their results. It is again something of a historical accident that <code>sequence</code> has a <code>Monad</code> constraint, since it can actually be implemented only in terms of <code>Applicative</code> (see the exercise at the end of the Utility Functions section for Applicative). Note that the actual type of <code>sequence</code> is more general, and works over any <code>Traversable</code> rather than just lists; see the [[#Traversable|section on <code>Traversable</code>]].<br />
<br />
* <code>replicateM :: Monad m => Int -> m a -> m [a]</code> is simply a combination of [{{HackageDocs|base|Prelude}}#v:replicate <code>replicate</code>] and <code>sequence</code>.<br />
<br />
* <code>mapM :: Monad m => (a -> m b) -> [a] -> m [b]</code> maps its first argument over the second, and <code>sequence</code>s the results. The <code>forM</code> function is just <code>mapM</code> with its arguments reversed; it is called <code>forM</code> since it models generalized <code>for</code> loops: the list <code>[a]</code> provides the loop indices, and the function <code>a -> m b</code> specifies the “body” of the loop for each index. Again, these functions actually work over any <code>Traversable</code>, not just lists, and they can also be defined in terms of <code>Applicative</code>, not <code>Monad</code>: the analogue of <code>mapM</code> for <code>Applicative</code> is called <code>traverse</code>.<br />
<br />
* <code>(=<<) :: Monad m => (a -> m b) -> m a -> m b</code> is just <code>(>>=)</code> with its arguments reversed; sometimes this direction is more convenient since it corresponds more closely to function application.<br />
<br />
* <code>(>=>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c</code> is sort of like function composition, but with an extra <code>m</code> on the result type of each function, and the arguments swapped. We’ll have more to say about this operation later. There is also a flipped variant, <code>(<=<)</code>.<br />
<br />
Many of these functions also have “underscored” variants, such as <code>sequence_</code> and <code>mapM_</code>; these variants throw away the results of the computations passed to them as arguments, using them only for their side effects.<br />
<br />
Other monadic functions which are occasionally useful include <code>filterM</code>, <code>zipWithM</code>, <code>foldM</code>, and <code>forever</code>.<br />
<br />
==Laws==<br />
<br />
There are several laws that instances of <code>Monad</code> should satisfy (see also the [[Monad laws]] wiki page). The standard presentation is:<br />
<br />
<haskell><br />
return a >>= k = k a<br />
m >>= return = m<br />
m >>= (\x -> k x >>= h) = (m >>= k) >>= h<br />
</haskell><br />
<br />
The first and second laws express the fact that <code>return</code> behaves nicely: if we inject a value <code>a</code> into a monadic context with <code>return</code>, and then bind to <code>k</code>, it is the same as just applying <code>k</code> to <code>a</code> in the first place; if we bind a computation <code>m</code> to <code>return</code>, nothing changes. The third law essentially says that <code>(>>=)</code> is associative, sort of.<br />
<br />
{{note|I like to pronounce this operator “fish”.}}<br />
<br />
However, the presentation of the above laws, especially the third, is marred by the asymmetry of <code>(>>=)</code>. It’s hard to look at the laws and see what they’re really saying. I prefer a much more elegant version of the laws, which is formulated in terms of <code>(>=>)</code> {{noteref}}. Recall that <code>(>=>)</code> “composes” two functions of type <code>a -> m b</code> and <code>b -> m c</code>. You can think of something of type <code>a -> m b</code> (roughly) as a function from <code>a</code> to <code>b</code> which may also have some sort of effect in the context corresponding to <code>m</code>. <code>(>=>)</code> lets us compose these “effectful functions”, and we would like to know what properties <code>(>=>)</code> has. The monad laws reformulated in terms of <code>(>=>)</code> are:<br />
<br />
<haskell><br />
return >=> g = g<br />
g >=> return = g<br />
(g >=> h) >=> k = g >=> (h >=> k)<br />
</haskell><br />
<br />
{{note|As fans of category theory will note, these laws say precisely that functions of type <code>a -> m b</code> are the arrows of a category with <code>(>{{=}}>)</code> as composition! Indeed, this is known as the ''Kleisli category'' of the monad <code>m</code>. It will come up again when we discuss <code>Arrow</code>s.}}<br />
<br />
Ah, much better! The laws simply state that <code>return</code> is the identity of <code>(>=>)</code>, and that <code>(>=>)</code> is associative {{noteref}}.<br />
<br />
There is also a formulation of the monad laws in terms of <code>fmap</code>, <code>return</code>, and <code>join</code>; for a discussion of this formulation, see the Haskell [http://en.wikibooks.org/wiki/Haskell/Category_theory wikibook page on category theory].<br />
<br />
{{Exercises|<br />
# Given the definition <code>g >{{=}}> h {{=}} \x -> g x >>{{=}} h</code>, prove the equivalence of the above laws and the usual monad laws.<br />
}}<br />
<br />
==<code>do</code> notation==<br />
<br />
Haskell’s special <code>do</code> notation supports an “imperative style” of programming by providing syntactic sugar for chains of monadic expressions. The genesis of the notation lies in realizing that something like <code>a >>= \x -> b >> c >>= \y -> d </code> can be more readably written by putting successive computations on separate lines:<br />
<br />
<haskell><br />
a >>= \x -><br />
b >><br />
c >>= \y -><br />
d<br />
</haskell><br />
<br />
This emphasizes that the overall computation consists of four computations <code>a</code>, <code>b</code>, <code>c</code>, and <code>d</code>, and that <code>x</code> is bound to the result of <code>a</code>, and <code>y</code> is bound to the result of <code>c</code> (<code>b</code>, <code>c</code>, and <code>d</code> are allowed to refer to <code>x</code>, and <code>d</code> is allowed to refer to <code>y</code> as well). From here it is not hard to imagine a nicer notation:<br />
<br />
<haskell><br />
do { x <- a<br />
; b<br />
; y <- c<br />
; d<br />
}<br />
</haskell><br />
<br />
(The curly braces and semicolons may optionally be omitted; the Haskell parser uses layout to determine where they should be inserted.) This discussion should make clear that <code>do</code> notation is just syntactic sugar. In fact, <code>do</code> blocks are recursively translated into monad operations (almost) like this:<br />
<br />
<pre><br />
do e → e<br />
do { e; stmts } → e >> do { stmts }<br />
do { v <- e; stmts } → e >>= \v -> do { stmts }<br />
do { let decls; stmts} → let decls in do { stmts }<br />
</pre><br />
<br />
This is not quite the whole story, since <code>v</code> might be a pattern instead of a variable. For example, one can write<br />
<br />
<haskell><br />
do (x:xs) <- foo<br />
bar x<br />
</haskell><br />
<br />
but what happens if <code>foo</code> is an empty list? Well, remember that ugly <code>fail</code> function in the <code>Monad</code> type class declaration? That’s what happens. See [http://www.haskell.org/onlinereport/exps.html#sect3.14 section 3.14 of the Haskell Report] for the full details. See also the discussion of <code>MonadPlus</code> and <code>MonadZero</code> in the [[#Other monoidal classes: Alternative, MonadPlus, ArrowPlus|section on other monoidal classes]].<br />
<br />
A final note on intuition: <code>do</code> notation plays very strongly to the “computational context” point of view rather than the “container” point of view, since the binding notation <code>x <- m</code> is suggestive of “extracting” a single <code>x</code> from <code>m</code> and doing something with it. But <code>m</code> may represent some sort of a container, such as a list or a tree; the meaning of <code>x <- m</code> is entirely dependent on the implementation of <code>(>>=)</code>. For example, if <code>m</code> is a list, <code>x <- m</code> actually means that <code>x</code> will take on each value from the list in turn.<br />
<br />
Sometimes, the full power of <code>Monad</code> is not needed to desugar <code>do</code>-notation. For example,<br />
<br />
<haskell><br />
do x <- foo1<br />
y <- foo2<br />
z <- foo3<br />
return (g x y z)<br />
</haskell><br />
<br />
would normally be desugared to <code>foo1 >>= \x -> foo2 >>= \y -> foo3 >>= \z -> return (g x y z)</code>, but this is equivalent to <code>g <$> foo1 <*> foo2 <*> foo3</code>. With the <code>ApplicativeDo</code> extension enabled (as of GHC 8.0), GHC tries hard to desugar <code>do</code>-blocks using <code>Applicative</code> operations wherever possible. This can sometimes lead to efficiency gains, even for types which also have <code>Monad</code> instances, since in general <code>Applicative</code> computations may be run in parallel, whereas monadic ones may not. For example, consider<br />
<br />
<haskell><br />
g :: Int -> Int -> M Int<br />
<br />
-- These could be expensive<br />
bar, baz :: M Int<br />
<br />
foo :: M Int<br />
foo = do<br />
x <- bar<br />
y <- baz<br />
g x y<br />
</haskell><br />
<br />
<code>foo</code> definitely depends on the <code>Monad</code> instance of <code>M</code>, since the effects generated by the whole computation may depend (via <code>g</code>) on the <code>Int</code> outputs of <code>bar</code> and <code>baz</code>. Nonetheless, with <code>ApplicativeDo</code> enabled, <code>foo</code> can be desugared as<br />
<haskell><br />
join (g <$> bar <*> baz)<br />
</haskell><br />
which may allow <code>bar</code> and <code>baz</code> to be computed in parallel, since they at least do not depend on each other.<br />
<br />
The <code>ApplicativeDo</code> extension is described in [https://ghc.haskell.org/trac/ghc/wiki/ApplicativeDo this wiki page], and in more detail in [http://doi.org/10.1145/2976002.2976007 this Haskell Symposium paper].<br />
<br />
==Further reading==<br />
<br />
Philip Wadler was the first to propose using monads to structure functional programs. [http://homepages.inf.ed.ac.uk/wadler/topics/monads.html His paper] is still a readable introduction to the subject.<br />
<br />
{{note|1=<br />
[[All About Monads]],<br />
[http://www.haskell.org/haskellwiki/Monads_as_Containers Monads as containers],<br />
[http://en.wikibooks.org/w/index.php?title=Haskell/Understanding_monads Understanding monads],<br />
[[The Monadic Way]],<br />
[http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html You Could Have Invented Monads! (And Maybe You Already Have.)],<br />
[http://www.haskell.org/pipermail/haskell-cafe/2006-November/019190.html there’s a monster in my Haskell!],<br />
[http://kawagner.blogspot.com/2007/02/understanding-monads-for-real.html Understanding Monads. For real.],<br />
[http://www.randomhacks.net/articles/2007/03/12/monads-in-15-minutes Monads in 15 minutes: Backtracking and Maybe],<br />
[http://www.haskell.org/haskellwiki/Monads_as_computation Monads as computation],<br />
[http://metafoo.co.uk/practical-monads.txt Practical Monads]}}<br />
<br />
There are, of course, numerous monad tutorials of varying quality {{noteref}}.<br />
<br />
A few of the best include Cale Gibbard’s [http://www.haskell.org/haskellwiki/Monads_as_Containers Monads as containers] and [http://www.haskell.org/haskellwiki/Monads_as_computation Monads as computation]; Jeff Newbern’s [[All About Monads]], a comprehensive guide with lots of examples; and Dan Piponi’s [http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html You Could Have Invented Monads!], which features great exercises. If you just want to know how to use <code>IO</code>, you could consult the [[Introduction to IO]]. Even this is just a sampling; the [[monad tutorials timeline]] is a more complete list. (All these monad tutorials have prompted parodies like [http://koweycode.blogspot.com/2007/01/think-of-monad.html think of a monad ...] as well as other kinds of backlash like [http://ahamsandwich.wordpress.com/2007/07/26/monads-and-why-monad-tutorials-are-all-awful/ Monads! (and Why Monad Tutorials Are All Awful)] or [http://byorgey.wordpress.com/2009/01/12/abstraction-intuition-and-the-monad-tutorial-fallacy/ Abstraction, intuition, and the “monad tutorial fallacy”].)<br />
<br />
Other good monad references which are not necessarily tutorials include [http://members.chello.nl/hjgtuyl/tourdemonad.html Henk-Jan van Tuyl’s tour] of the functions in <code>Control.Monad</code>, Dan Piponi’s [http://blog.sigfpe.com/2006/10/monads-field-guide.html field guide], Tim Newsham’s [http://www.thenewsh.com/~newsham/haskell/monad.html What’s a Monad?], and Chris Smith's excellent article [http://cdsmith.wordpress.com/2012/04/18/why-do-monads-matter/ Why Do Monads Matter?]. There are also many blog posts which have been written on various aspects of monads; a collection of links can be found under [[Blog articles/Monads]].<br />
<br />
For help constructing monads from scratch, and for obtaining a "deep embedding" of monad operations suitable for use in, say, compiling a domain-specific language, see [http://projects.haskell.org/operational Apfelmus's operational package].<br />
<br />
One of the quirks of the <code>Monad</code> class and the Haskell type system is that it is not possible to straightforwardly declare <code>Monad</code> instances for types which require a class constraint on their data, even if they are monads from a mathematical point of view. For example, <code>Data.Set</code> requires an <code>Ord</code> constraint on its data, so it cannot be easily made an instance of <code>Monad</code>. A solution to this problem was [http://www.randomhacks.net/articles/2007/03/15/data-set-monad-haskell-macros first described by Eric Kidd], and later made into a [http://hackage.haskell.org/cgi-bin/hackage-scripts/package/rmonad library named rmonad] by Ganesh Sittampalam and Peter Gavin.<br />
<br />
There are many good reasons for eschewing <code>do</code> notation; some have gone so far as to [[Do_notation_considered_harmful|consider it harmful]].<br />
<br />
Monads can be generalized in various ways; for an exposition of one possibility, see Robert Atkey’s paper on [https://bentnib.org/paramnotions-jfp.pdf parameterized monads], or Dan Piponi’s [http://blog.sigfpe.com/2009/02/beyond-monads.html Beyond Monads].<br />
<br />
For the categorically inclined, monads can be viewed as monoids ([http://blog.sigfpe.com/2008/11/from-monoids-to-monads.html From Monoids to Monads]) and also as closure operators ([http://blog.plover.com/math/monad-closure.html Triples and Closure]). Derek Elkins’ article in [http://www.haskell.org/wikiupload/8/85/TMR-Issue13.pdf issue 13 of the Monad.Reader] contains an exposition of the category-theoretic underpinnings of some of the standard <code>Monad</code> instances, such as <code>State</code> and <code>Cont</code>. Jonathan Hill and Keith Clarke have [http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.53.6497 an early paper explaining the connection between monads as they arise in category theory and as used in functional programming]. There is also a [http://okmij.org/ftp/Computation/IO-monad-history.html web page by Oleg Kiselyov] explaining the history of the IO monad.<br />
<br />
Links to many more research papers related to monads can be found under [[Research papers/Monads and arrows]].<br />
<br />
=MonadFail=<br />
<br />
Some monads support a notion of ''failure'', without necessarily supporting the notion of ''recovery'' suggested by <code>MonadPlus</code>, and possibly including a primitive error reporting mechanism. This notion is expressed by the relatively unprincipled <code>MonadFail</code>. When the <code>MonadFailDesugaring</code> language extension is enabled, the <code>fail</code> method from <code>MonadFail</code> is used for pattern match failure in <code>do</code> bindings rather than the traditional <code>fail</code> method of the <code>Monad</code> class. This language change is being implemented because there are many monads, such as <code>Reader</code>, <code>State</code>, <code>Writer</code>, <code>RWST</code>, and <code>Cont</code> that simply do not support a legitimate <code>fail</code> method.<br />
<br />
See the [https://prime.haskell.org/wiki/Libraries/Proposals/MonadFail MonadFail proposal] for more information.<br />
<br />
==Definition==<br />
<br />
<haskell><br />
class Monad m => MonadFail m where<br />
fail :: String -> m a<br />
</haskell><br />
<br />
==Law==<br />
<br />
<haskell><br />
fail s >>= m = fail s<br />
</haskell><br />
<br />
=Monad transformers=<br />
<br />
One would often like to be able to combine two monads into one: for example, to have stateful, nondeterministic computations (<code>State</code> + <code>[]</code>), or computations which may fail and can consult a read-only environment (<code>Maybe</code> + <code>Reader</code>), and so on. Unfortunately, monads do not compose as nicely as applicative functors (yet another reason to use <code>Applicative</code> if you don’t need the full power that <code>Monad</code> provides), but some monads can be combined in certain ways.<br />
<br />
==Standard monad transformers==<br />
<br />
The [http://hackage.haskell.org/package/transformers transformers] library provides a number of standard ''monad transformers''. Each monad transformer adds a particular capability/feature/effect to any existing monad.<br />
<br />
* [http://hackage.haskell.org/packages/archive/transformers/latest/doc/html/Control-Monad-Trans-Identity.html <code>IdentityT</code>] is the identity transformer, which maps a monad to (something isomorphic to) itself. This may seem useless at first glance, but it is useful for the same reason that the <code>id</code> function is useful -- it can be passed as an argument to things which are parameterized over an arbitrary monad transformer, when you do not actually want any extra capabilities.<br />
* [http://hackage.haskell.org/packages/archive/transformers/latest/doc/html/Control-Monad-Trans-State.html <code>StateT</code>] adds a read-write state.<br />
* [http://hackage.haskell.org/packages/archive/transformers/latest/doc/html/Control-Monad-Trans-Reader.html <code>ReaderT</code>] adds a read-only environment.<br />
* [http://hackage.haskell.org/packages/archive/transformers/latest/doc/html/Control-Monad-Trans-Writer.html <code>WriterT</code>] adds a write-only log.<br />
* [http://hackage.haskell.org/packages/archive/transformers/0.2.2.0/doc/html/Control-Monad-Trans-RWS.html <code>RWST</code>] conveniently combines <code>ReaderT</code>, <code>WriterT</code>, and <code>StateT</code> into one.<br />
* [http://hackage.haskell.org/packages/archive/transformers/latest/doc/html/Control-Monad-Trans-Maybe.html <code>MaybeT</code>] adds the possibility of failure.<br />
* [http://hackage.haskell.org/packages/archive/transformers/latest/doc/html/Control-Monad-Trans-Error.html <code>ErrorT</code>] adds the possibility of failure with an arbitrary type to represent errors.<br />
* [http://hackage.haskell.org/packages/archive/transformers/latest/doc/html/Control-Monad-Trans-List.html <code>ListT</code>] adds non-determinism (however, see the discussion of <code>ListT</code> below).<br />
* [http://hackage.haskell.org/packages/archive/transformers/latest/doc/html/Control-Monad-Trans-Cont.html <code>ContT</code>] adds continuation handling.<br />
<br />
For example, <code>StateT s Maybe</code> is an instance of <code>Monad</code>; computations of type <code>StateT s Maybe a</code> may fail, and have access to a mutable state of type <code>s</code>. Monad transformers can be multiply stacked. One thing to keep in mind while using monad transformers is that the order of composition matters. For example, when a <code>StateT s Maybe a</code> computation fails, the state ceases being updated (indeed, it simply disappears); on the other hand, the state of a <code>MaybeT (State s) a</code> computation may continue to be modified even after the computation has "failed". This may seem backwards, but it is correct. Monad transformers build composite monads “inside out”; <code>MaybeT (State s) a</code> is isomorphic to <code>s -> (Maybe a, s)</code>. (Lambdabot has an indispensable <code>@unmtl</code> command which you can use to “unpack” a monad transformer stack in this way.)<br />
Intuitively, the monads become "more fundamental" the further inside the stack you get, and the effects of inner monads "have precedence" over the effects of outer ones. Of course, this is just handwaving, and if you are unsure of the proper order for some monads you wish to combine, there is no substitute for using <code>@unmtl</code> or simply trying out the various options.<br />
<br />
==Definition and laws==<br />
<br />
All monad transformers should implement the <code>MonadTrans</code> type class, defined in <code>Control.Monad.Trans.Class</code>:<br />
<br />
<haskell><br />
class MonadTrans t where<br />
lift :: Monad m => m a -> t m a<br />
</haskell><br />
<br />
It allows arbitrary computations in the base monad <code>m</code> to be “lifted” into computations in the transformed monad <code>t m</code>. (Note that type application associates to the left, just like function application, so <code>t m a = (t m) a</code>.)<br />
<br />
<code>lift</code> must satisfy the laws<br />
<haskell><br />
lift . return = return<br />
lift (m >>= f) = lift m >>= (lift . f)<br />
</haskell><br />
which intuitively state that <code>lift</code> transforms <code>m a</code> computations into <code>t m a</code> computations in a "sensible" way, which sends the <code>return</code> and <code>(>>=)</code> of <code>m</code> to the <code>return</code> and <code>(>>=)</code> of <code>t m</code>.<br />
<br />
{{Exercises|<br />
# What is the kind of <code>t</code> in the declaration of <code>MonadTrans</code>?<br />
}}<br />
<br />
==Transformer type classes and "capability" style==<br />
<br />
{{note|The only problem with this scheme is the quadratic number of instances required as the number of standard monad transformers grows—but as the current set of standard monad transformers seems adequate for most common use cases, this may not be that big of a deal.}}<br />
<br />
There are also type classes (provided by the [http://hackage.haskell.org/package/mtl <code>mtl</code> package]) for the operations of each transformer. For example, the <code>MonadState</code> type class provides the state-specific methods <code>get</code> and <code>put</code>, allowing you to conveniently use these methods not only with <code>State</code>, but with any monad which is an instance of <code>MonadState</code>—including <code>MaybeT (State s)</code>, <code>StateT s (ReaderT r IO)</code>, and so on. Similar type classes exist for <code>Reader</code>, <code>Writer</code>, <code>Cont</code>, <code>IO</code>, and others {{noteref}}.<br />
<br />
These type classes serve two purposes. First, they get rid of (most of) the need for explicitly using <code>lift</code>, giving a type-directed way to automatically determine the right number of calls to <code>lift</code>. Simply writing <code>put</code> will be automatically translated into <code>lift . put</code>, <code>lift . lift . put</code>, or something similar depending on what concrete monad stack you are using.<br />
<br />
Second, they give you more flexibility to switch between different concrete monad stacks. For example, if you are writing a state-based algorithm, don't write<br />
<haskell><br />
foo :: State Int Char<br />
foo = modify (*2) >> return 'x'<br />
</haskell><br />
but rather<br />
<haskell><br />
foo :: MonadState Int m => m Char<br />
foo = modify (*2) >> return 'x'<br />
</haskell><br />
Now, if somewhere down the line you realize you need to introduce the possibility of failure, you might switch from <code>State Int</code> to <code>MaybeT (State Int)</code>. The type of the first version of <code>foo</code> would need to be modified to reflect this change, but the second version of <code>foo</code> can still be used as-is.<br />
<br />
However, this sort of "capability-based" style (<i>e.g.</i> specifying that <code>foo</code> works for any monad with the "state capability") quickly runs into problems when you try to naively scale it up: for example, what if you need to maintain two independent states? A framework for solving this and related problems is described by Schrijvers and Olivera ([http://users.ugent.be/~tschrijv/Research/papers/icfp2011.pdf Monads, zippers and views: virtualizing the monad stack, ICFP 2011]) and is implemented in the [http://hackage.haskell.org/package/Monatron <code>Monatron</code> package].<br />
<br />
==Composing monads==<br />
<br />
Is the composition of two monads always a monad? As hinted previously, the answer is no.<br />
<br />
Since <code>Applicative</code> functors are closed under composition, the problem must lie with <code>join</code>. Indeed, suppose <code>m</code> and <code>n</code> are arbitrary monads; to make a monad out of their composition we would need to be able to implement<br />
<haskell><br />
join :: m (n (m (n a))) -> m (n a)<br />
</haskell><br />
but it is not clear how this could be done in general. The <code>join</code> method for <code>m</code> is no help, because the two occurrences of <code>m</code> are not next to each other (and likewise for <code>n</code>).<br />
<br />
However, one situation in which it can be done is if <code>n</code> ''distributes'' over <code>m</code>, that is, if there is a function<br />
<haskell><br />
distrib :: n (m a) -> m (n a)<br />
</haskell><br />
satisfying certain laws. See Jones and Duponcheel ([http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.42.2605 Composing Monads]); see also the [[#Traversable|section on Traversable]].<br />
<br />
For a much more in-depth discussion and analysis of the failure of monads to be closed under composition, see [http://stackoverflow.com/questions/13034229/concrete-example-showing-that-monads-are-not-closed-under-composition-with-proo?lq=1 this question on StackOverflow].<br />
<br />
{{Exercises|<br />
* Implement <code>join :: M (N (M (N a))) -> M (N a)</code>, given <code>distrib :: N (M a) -> M (N a)</code> and assuming <code>M</code> and <code>N</code> are instances of <code>Monad</code>.<br />
}}<br />
<br />
==Further reading==<br />
<br />
Much of the monad transformer library (originally [http://hackage.haskell.org/package/mtl <code>mtl</code>], now split between <code>mtl</code> and [http://hackage.haskell.org/package/transformers <code>transformers</code>]), including the <code>Reader</code>, <code>Writer</code>, <code>State</code>, and other monads, as well as the monad transformer framework itself, was inspired by Mark Jones’ classic paper [http://web.cecs.pdx.edu/~mpj/pubs/springschool.html Functional Programming with Overloading and Higher-Order Polymorphism]. It’s still very much worth a read—and highly readable—after almost fifteen years.<br />
<br />
See [http://archive.fo/wxSkj Edward Kmett's mailing list message] for a description of the history and relationships among monad transformer packages (<code>mtl</code>, <code>transformers</code>, <code>monads-fd</code>, <code>monads-tf</code>).<br />
<br />
There are two excellent references on monad transformers. Martin Grabmüller’s [https://github.com/mgrabmueller/TransformersStepByStep/blob/master/Transformers.lhs Monad Transformers Step by Step] is a thorough description, with running examples, of how to use monad transformers to elegantly build up computations with various effects. [http://cale.yi.org/index.php/How_To_Use_Monad_Transformers Cale Gibbard’s article] on how to use monad transformers is more practical, describing how to structure code using monad transformers to make writing it as painless as possible. Another good starting place for learning about monad transformers is a [http://blog.sigfpe.com/2006/05/grok-haskell-monad-transformers.html blog post by Dan Piponi].<br />
<br />
The <code>ListT</code> transformer from the <code>transformers</code> package comes with the caveat that <code>ListT m</code> is only a monad when <code>m</code> is ''commutative'', that is, when <code>ma >>= \a -> mb >>= \b -> foo</code> is equivalent to <code>mb >>= \b -> ma >>= \a -> foo</code> (i.e. the order of <code>m</code>'s effects does not matter). For one explanation why, see Dan Piponi's blog post [http://blog.sigfpe.com/2006/11/why-isnt-listt-monad.html "Why isn't <code><nowiki>ListT []</nowiki></code> a monad"]. For more examples, as well as a design for a version of <code>ListT</code> which does not have this problem, see [http://www.haskell.org/haskellwiki/ListT_done_right <code>ListT</code> done right].<br />
<br />
There is an alternative way to compose monads, using coproducts, as described by [http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.8.3581 Lüth and Ghani]. This method is interesting but has not (yet?) seen widespread use. For a more recent alternative, see Kiselyov et al's [http://okmij.org/ftp/Haskell/extensible/exteff.pdf Extensible Effects: An Alternative to Monad Transformers].<br />
<br />
=MonadFix=<br />
<br />
''Note: <code>MonadFix</code> is included here for completeness (and because it is interesting) but seems not to be used much. Skipping this section on a first read-through is perfectly OK (and perhaps even recommended).''<br />
<br />
==<code>do rec</code> notation==<br />
<br />
The <code>MonadFix</code> class describes monads which support the special fixpoint operation <code>mfix :: (a -> m a) -> m a</code>, which allows the output of monadic computations to be defined via (effectful) recursion. This is [http://www.haskell.org/ghc/docs/latest/html/users_guide/syntax-extns.html#recursive-do-notation supported in GHC] by a special “recursive do” notation, enabled by the <code>-XRecursiveDo</code> flag. Within a <code>do</code> block, one may have a nested <code>rec</code> block, like so:<br />
<haskell><br />
do { x <- foo<br />
; rec { y <- baz<br />
; z <- bar<br />
; bob<br />
}<br />
; w <- frob<br />
}<br />
</haskell><br />
Normally (if we had <code>do</code> in place of <code>rec</code> in the above example), <code>y</code> would be in scope in <code>bar</code> and <code>bob</code> but not in <code>baz</code>, and <code>z</code> would be in scope only in <code>bob</code>. With the <code>rec</code>, however, <code>y</code> and <code>z</code> are both in scope in all three of <code>baz</code>, <code>bar</code>, and <code>bob</code>. A <code>rec</code> block is analogous to a <code>let</code> block such as<br />
<haskell><br />
let { y = baz<br />
; z = bar<br />
}<br />
in bob<br />
</haskell><br />
because, in Haskell, every variable bound in a <code>let</code>-block is in scope throughout the entire block. (From this point of view, Haskell's normal <code>do</code> blocks are analogous to Scheme's <code>let*</code> construct.)<br />
<br />
What could such a feature be used for? One of the motivating examples given in the original paper describing <code>MonadFix</code> (see below) is encoding circuit descriptions. A line in a <code>do</code>-block such as <br />
<haskell><br />
x <- gate y z<br />
</haskell><br />
describes a gate whose input wires are labeled <code>y</code> and <code>z</code> and whose output wire is labeled <code>x</code>. Many (most?) useful circuits, however, involve some sort of feedback loop, making them impossible to write in a normal <code>do</code>-block (since some wire would have to be mentioned as an input ''before'' being listed as an output). Using a <code>rec</code> block solves this problem.<br />
<br />
==Examples and intuition==<br />
<br />
Of course, not every monad supports such recursive binding. However, as mentioned above, it suffices to have an implementation of <code>mfix :: (a -> m a) -> m a</code>, satisfying a few laws. Let's try implementing <code>mfix</code> for the <code>Maybe</code> monad. That is, we want to implement a function<br />
<haskell><br />
maybeFix :: (a -> Maybe a) -> Maybe a<br />
</haskell><br />
{{note|Actually, <code>fix</code> is implemented slightly differently for efficiency reasons; but the given definition is equivalent and simpler for the present purpose.}}<br />
Let's think for a moment about the implementation {{noteref}} of the non-monadic <code>fix :: (a -> a) -> a</code>:<br />
<haskell><br />
fix f = f (fix f)<br />
</haskell><br />
Inspired by <code>fix</code>, our first attempt at implementing <code>maybeFix</code> might be something like<br />
<haskell><br />
maybeFix :: (a -> Maybe a) -> Maybe a<br />
maybeFix f = maybeFix f >>= f<br />
</haskell><br />
This has the right type. However, something seems wrong: there is nothing in particular here about <code>Maybe</code>; <code>maybeFix</code> actually has the more general type <code>Monad m => (a -> m a) -> m a</code>. But didn't we just say that not all monads support <code>mfix</code>?<br />
<br />
The answer is that although this implementation of <code>maybeFix</code> has the right type, it does ''not'' have the intended semantics. If we think about how <code>(>>=)</code> works for the <code>Maybe</code> monad (by pattern-matching on its first argument to see whether it is <code>Nothing</code> or <code>Just</code>) we can see that this definition of <code>maybeFix</code> is completely useless: it will just recurse infinitely, trying to decide whether it is going to return <code>Nothing</code> or <code>Just</code>, without ever even so much as a glance in the direction of <code>f</code>.<br />
<br />
The trick is to simply ''assume'' that <code>maybeFix</code> will return <code>Just</code>, and get on with life!<br />
<haskell><br />
maybeFix :: (a -> Maybe a) -> Maybe a<br />
maybeFix f = ma<br />
where ma = f (fromJust ma)<br />
</haskell><br />
This says that the result of <code>maybeFix</code> is <code>ma</code>, and assuming that <code>ma = Just x</code>, it is defined (recursively) to be equal to <code>f x</code>.<br />
<br />
Why is this OK? Isn't <code>fromJust</code> almost as bad as <code>unsafePerformIO</code>? Well, usually, yes. This is just about the only situation in which it is justified! The interesting thing to note is that <code>maybeFix</code> ''will never crash'' -- although it may, of course, fail to terminate. The only way we could get a crash is if we try to evaluate <code>fromJust ma</code> when we know that <code>ma = Nothing</code>. But how could we know <code>ma = Nothing</code>? Since <code>ma</code> is defined as <code>f (fromJust ma)</code>, it must be that this expression has already been evaluated to <code>Nothing</code> -- in which case there is no reason for us to be evaluating <code>fromJust ma</code> in the first place! <br />
<br />
To see this from another point of view, we can consider three possibilities. First, if <code>f</code> outputs <code>Nothing</code> without looking at its argument, then <code>maybeFix f</code> clearly returns <code>Nothing</code>. Second, if <code>f</code> always outputs <code>Just x</code>, where <code>x</code> depends on its argument, then the recursion can proceed usefully: <code>fromJust ma</code> will be able to evaluate to <code>x</code>, thus feeding <code>f</code>'s output back to it as input. Third, if <code>f</code> tries to use its argument to decide whether to output <code>Just</code> or <code>Nothing</code>, then <code>maybeFix f</code> will not terminate: evaluating <code>f</code>'s argument requires evaluating <code>ma</code> to see whether it is <code>Just</code>, which requires evaluating <code>f (fromJust ma)</code>, which requires evaluating <code>ma</code>, ... and so on.<br />
<br />
There are also instances of <code>MonadFix</code> for lists (which works analogously to the instance for <code>Maybe</code>), for <code>ST</code>, and for <code>IO</code>. The [http://hackage.haskell.org/packages/archive/base/latest/doc/html/System-IO.html#fixIO instance for <code>IO</code>] is particularly amusing: it creates a new (empty) <code>MVar</code>, immediately reads its contents using <code>unsafeInterleaveIO</code> (which delays the actual reading lazily until the value is needed), uses the contents of the <code>MVar</code> to compute a new value, which it then writes back into the <code>MVar</code>. It almost seems, spookily, that <code>mfix</code> is sending a value back in time to itself through the <code>MVar</code> -- though of course what is really going on is that the reading is delayed just long enough (via <code>unsafeInterleaveIO</code>) to get the process bootstrapped.<br />
<br />
{{Exercises|<br />
* Implement a <code>MonadFix</code> instance for <code>[]</code>.<br />
}}<br />
<br />
==<code>mdo</code> syntax==<br />
<br />
The example at the start of this section can also be written<br />
<br />
<haskell><br />
mdo { x <- foo<br />
; y <- baz<br />
; z <- bar<br />
; bob<br />
; w <- frob<br />
}<br />
</haskell><br />
<br />
which will be translated into the original example (assuming that, say, <code>bar</code> and <code>bob</code> refer to <code>y</code>. The difference is that <code>mdo</code> will analyze the code in order to find minimal recursive blocks, which will be placed in <code>rec</code> blocks, whereas <code>rec</code> blocks desugar directly into calls to <code>mfix</code> without any further analysis.<br />
<br />
==Further reading==<br />
<br />
For more information (such as the precise desugaring rules for <code>rec</code> blocks), see Levent Erkök and John Launchbury's 2002 Haskell workshop paper, [http://sites.google.com/site/leventerkok/recdo.pdf?attredirects=0 A Recursive do for Haskell], or for full details, Levent Erkök’s thesis, [http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.15.1543&rep=rep1&type=pdf Value Recursion in Monadic Computations]. (Note, while reading, that <code>MonadFix</code> used to be called <code>MonadRec</code>.) You can also read the [http://www.haskell.org/ghc/docs/latest/html/users_guide/syntax-extns.html#recursive-do-notation GHC user manual section on recursive do-notation].<br />
<br />
=Semigroup=<br />
<br />
A semigroup is a set <math>S\ </math> together with a binary operation <math>\oplus\ </math> which<br />
combines elements from <math>S\ </math>. The <math>\oplus\ </math> operator is required to be associative<br />
(that is, <math>(a \oplus b) \oplus c = a \oplus (b \oplus c)\ </math>, for any<br />
<math>a,b,c\ </math> which are elements of <math>S\ </math>).<br />
<br />
For example, the natural numbers under addition form a semigroup: the sum of any two natural numbers is a natural number, and <math>(a+b)+c = a+(b+c)\ </math> for any natural numbers <math>a\ </math>, <math>b\ </math>, and <math>c\,\ </math>. The integers under multiplication also form a semigroup, as do the integers (or rationals, or reals) under <math>\max\ </math> or <math>\min\ </math>, Boolean values under conjunction and disjunction, lists under concatenation, functions from a set to itself under composition ... Semigroups show up all over the place, once you know to look for them.<br />
<br />
==Definition==<br />
<br />
As of version 4.9 of the <code>base</code> package (which comes with GHC 8.0), semigroups are defined in the <code>Data.Semigroup</code> module. (If you are working with a previous version of base, or want to write a library that supports previous versions of base, you can use the <code>semigroups</code> package.)<br />
<br />
The definition of the <code>Semigroup</code> type class ([https://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Semigroup.html haddock]) is as follows:<br />
<br />
<haskell><br />
class Semigroup a where<br />
(<>) :: a -> a -> a<br />
<br />
sconcat :: NonEmpty a -> a<br />
sconcat (a :| as) = go a as where<br />
go b (c:cs) = b <> go c cs<br />
go b [] = b<br />
<br />
stimes :: Integral b => b -> a -> a<br />
stimes = ...<br />
</haskell><br />
<br />
The really important method is <code>(<>)</code>, representing the associative binary operation. The other two methods have default implementations in terms of <code>(<>)</code>, and are included in the type class in case some instances can give more efficient implementations than the default.<br />
<br />
<code>sconcat</code> reduces a nonempty list using <code>(<>)</code>. For most instances, this is the same as <code>foldr1 (<>)</code>, but it can be constant-time for idempotent semigroups.<br />
<br />
<code>stimes n</code> is equivalent to (but sometimes considerably more efficient than) <code>sconcat . replicate n</code>. Its default definition uses multiplication by doubling (also known as exponentiation by squaring). For many semigroups, this is an important optimization; for some, such as lists, it is terrible and must be overridden.<br />
<br />
See the [https://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Semigroup.html haddock documentation] for more information on <code>sconcat</code> and <code>stimes</code>.<br />
<br />
==Laws==<br />
<br />
The only law is that <code>(<>)</code> must be associative:<br />
<br />
<haskell><br />
(x <> y) <> z = x <> (y <> z)<br />
</haskell><br />
<br />
=Monoid=<br />
<br />
Many semigroups have a special element <math>e</math> for which the binary operation <math>\oplus</math> is the identity, that is, <math>e \oplus x = x \oplus e = x</math> for every element <math>x</math>. Such a semigroup-with-identity-element is called a ''monoid''.<br />
<br />
==Definition==<br />
<br />
The definition of the <code>Monoid</code> type class (defined in<br />
<code>Data.Monoid</code>; [{{HackageDocs|base|Data-Monoid}} haddock]) is:<br />
<br />
<haskell><br />
class Monoid a where<br />
mempty :: a<br />
mappend :: a -> a -> a<br />
<br />
mconcat :: [a] -> a<br />
mconcat = foldr mappend mempty<br />
</haskell><br />
<br />
The <code>mempty</code> value specifies the identity element of the monoid, and <code>mappend</code><br />
is the binary operation. The default definition for <code>mconcat</code><br />
“reduces” a list of elements by combining them all with <code>mappend</code>,<br />
using a right fold. It is only in the <code>Monoid</code> class so that specific<br />
instances have the option of providing an alternative, more efficient<br />
implementation; usually, you can safely ignore <code>mconcat</code> when creating<br />
a <code>Monoid</code> instance, since its default definition will work just fine.<br />
<br />
The <code>Monoid</code> methods are rather unfortunately named; they are inspired<br />
by the list instance of <code>Monoid</code>, where indeed <code>mempty = []</code> and <code>mappend = (++)</code>, but this is misleading since many<br />
monoids have little to do with appending (see these [http://archive.fo/hkTOb Comments from OCaml Hacker Brian Hurt] on the Haskell-cafe mailing list). The situation is made somewhat better by <code>(<>)</code>, which is provided as an alias for <code>mappend</code>.<br />
<br />
Note that the <code>(<>)</code> alias for <code>mappend</code> conflicts with the <code>Semigroup</code> method of the same name. For this reason, <code>Data.Semigroup</code> re-exports much of <code>Data.Monoid</code>; to use semigroups and monoids together, just import <code>Data.Semigroup</code>, and make sure all your types have both <code>Semigroup</code> and <code>Monoid</code> instances (and that <code>(<>) = mappend</code>).<br />
<br />
==Laws==<br />
<br />
Of course, every <code>Monoid</code> instance should actually be a monoid in the<br />
mathematical sense, which implies these laws:<br />
<br />
<haskell><br />
mempty `mappend` x = x<br />
x `mappend` mempty = x<br />
(x `mappend` y) `mappend` z = x `mappend` (y `mappend` z)<br />
</haskell><br />
<br />
==Instances==<br />
<br />
There are quite a few interesting <code>Monoid</code> instances defined in <code>Data.Monoid</code>.<br />
<br />
<ul><br />
<li><code>[a]</code> is a <code>Monoid</code>, with <code>mempty = []</code> and <code>mappend = (++)</code>. It is not hard to check that <code>(x ++ y) ++ z = x ++ (y ++ z)</code> for any lists <code>x</code>, <code>y</code>, and <code>z</code>, and that the empty list is the identity: <code>[] ++ x = x ++ [] = x</code>.</li><br />
<br />
<li>As noted previously, we can make a monoid out of any numeric type under either addition or multiplication. However, since we can’t have two instances for the same type, <code>Data.Monoid</code> provides two <code>newtype</code> wrappers, <code>Sum</code> and <code>Product</code>, with appropriate <code>Monoid</code> instances.<br />
<br />
<haskell><br />
> getSum (mconcat . map Sum $ [1..5])<br />
15<br />
> getProduct (mconcat . map Product $ [1..5])<br />
120<br />
</haskell><br />
<br />
This example code is silly, of course; we could just write<br />
<code>sum [1..5]</code> and <code>product [1..5]</code>. Nevertheless, these instances are useful in more generalized settings, as we will see in the [[Foldable|section on <code>Foldable</code>]].</li><br />
<br />
<li><code>Any</code> and <code>All</code> are <code>newtype</code> wrappers providing <code>Monoid</code> instances for <code>Bool</code> (under disjunction and conjunction, respectively).</li><br />
<br />
<li> There are three instances for <code>Maybe</code>: a basic instance which lifts a <code>Monoid</code> instance for <code>a</code> to an instance for <code>Maybe a</code>, and two <code>newtype</code> wrappers <code>First</code> and <code>Last</code> for which <code>mappend</code> selects the first (respectively last) non-<code>Nothing</code> item.</li><br />
<br />
<li><code>Endo a</code> is a newtype wrapper for functions <code>a -> a</code>, which form a monoid under composition.</li><br />
<br />
<li>There are several ways to “lift” <code>Monoid</code> instances to instances with additional structure. We have already seen that an instance for <code>a</code> can be lifted to an instance for <code>Maybe a</code>. There are also tuple instances: if <code>a</code> and <code>b</code> are instances of <code>Monoid</code>, then so is <code>(a,b)</code>, using the monoid operations for <code>a</code> and <code>b</code> in the obvious pairwise manner. Finally, if <code>a</code> is a <code>Monoid</code>, then so is the function type <code>e -> a</code> for any <code>e</code>; in particular, <code>g `mappend` h</code> is the function which applies both <code>g</code> and <code>h</code> to its argument and then combines the results using the underlying <code>Monoid</code> instance for <code>a</code>. This can be quite useful and elegant (see [http://archive.fo/dUbHK example]).</li><br />
<br />
<li>The type <code>Ordering = LT | EQ | GT</code> is a <code>Monoid</code>, defined in such a way that <code>mconcat (zipWith compare xs ys)</code> computes the lexicographic ordering of <code>xs</code> and <code>ys</code> (if <code>xs</code> and <code>ys</code> have the same length). In particular, <code>mempty = EQ</code>, and <code>mappend</code> evaluates to its leftmost non-<code>EQ</code> argument (or <code>EQ</code> if both arguments are <code>EQ</code>). This can be used together with the function instance of <code>Monoid</code> to do some clever things ([http://www.reddit.com/r/programming/comments/7cf4r/monoids_in_my_programming_language/c06adnx example]).</li><br />
<br />
<li>There are also <code>Monoid</code> instances for several standard data structures in the containers library ([http://hackage.haskell.org/packages/archive/containers/0.2.0.0/doc/html/index.html haddock]), including <code>Map</code>, <code>Set</code>, and <code>Sequence</code>.</li><br />
</ul><br />
<br />
<code>Monoid</code> is also used to enable several other type class instances.<br />
As noted previously, we can use <code>Monoid</code> to make <code>((,) e)</code> an instance of <code>Applicative</code>:<br />
<br />
<haskell><br />
instance Monoid e => Applicative ((,) e) where<br />
pure :: Monoid e => a -> (e,a)<br />
pure x = (mempty, x)<br />
<br />
(<*>) :: Monoid e => (e,a -> b) -> (e,a) -> (e,b)<br />
(u, f) <*> (v, x) = (u `mappend` v, f x)<br />
</haskell><br />
<br />
<code>Monoid</code> can be similarly used to make <code>((,) e)</code> an instance of <code>Monad</code> as well; this is known as the ''writer monad''. As we’ve already seen, <code>Writer</code> and <code>WriterT</code> are a newtype wrapper and transformer for this monad, respectively.<br />
<br />
<code>Monoid</code> also plays a key role in the <code>Foldable</code> type class (see section [[#Foldable|Foldable]]).<br />
<br />
==Further reading==<br />
<br />
Monoids got a fair bit of attention in 2009, when<br />
[http://blog.enfranchisedmind.com/2009/01/random-thoughts-on-haskell/ a blog post by Brian Hurt]<br />
complained about the fact that the names of many Haskell type classes<br />
(<code>Monoid</code> in particular) are taken from abstract mathematics. This<br />
resulted in [http://archive.fo/hkTOb a long Haskell-cafe thread]<br />
arguing the point and discussing monoids in general.<br />
<br />
{{note|May its name live forever.}}<br />
<br />
However, this was quickly followed by several blog posts about<br />
<code>Monoid</code> {{noteref}}. First, Dan Piponi<br />
wrote a great introductory post, [http://blog.sigfpe.com/2009/01/haskell-monoids-and-their-uses.html Haskell Monoids and their Uses]. This was quickly followed by<br />
Heinrich Apfelmus’ [http://apfelmus.nfshost.com/monoid-fingertree.html Monoids and Finger Trees], an accessible exposition of<br />
Hinze and Paterson’s [http://www.soi.city.ac.uk/%7Eross/papers/FingerTree.html classic paper on 2-3 finger trees], which makes very clever<br />
use of <code>Monoid</code> to implement an elegant and generic data structure.<br />
Dan Piponi then wrote two fascinating articles about using <code>Monoids</code><br />
(and finger trees): [http://blog.sigfpe.com/2009/01/fast-incremental-regular-expression.html Fast Incremental Regular Expressions] and [http://blog.sigfpe.com/2009/01/beyond-regular-expressions-more.html Beyond Regular Expressions]<br />
<br />
In a similar vein, David Place’s article on improving <code>Data.Map</code> in<br />
order to compute incremental folds (see [http://www.haskell.org/wikiupload/6/6a/TMR-Issue11.pdf the Monad Reader issue 11])<br />
is also a<br />
good example of using <code>Monoid</code> to generalize a data structure.<br />
<br />
Some other interesting examples of <code>Monoid</code> use include [http://www.reddit.com/r/programming/comments/7cf4r/monoids_in_my_programming_language/c06adnx building elegant list sorting combinators], [http://byorgey.wordpress.com/2008/04/17/collecting-unstructured-information-with-the-monoid-of-partial-knowledge/ collecting unstructured information], [http://izbicki.me/blog/gausian-distributions-are-monoids combining probability distributions], and a brilliant series of posts by Chung-Chieh Shan and Dylan Thurston using <code>Monoid</code>s to [http://conway.rutgers.edu/~ccshan/wiki/blog/posts/WordNumbers1/ elegantly solve a difficult combinatorial puzzle] (followed by [http://conway.rutgers.edu/~ccshan/wiki/blog/posts/WordNumbers2/ part 2], [http://conway.rutgers.edu/~ccshan/wiki/blog/posts/WordNumbers3/ part 3], [http://conway.rutgers.edu/~ccshan/wiki/blog/posts/WordNumbers4/ part 4]).<br />
<br />
As unlikely as it sounds, monads can actually be viewed as a sort of<br />
monoid, with <code>join</code> playing the role of the binary operation and<br />
<code>return</code> the role of the identity; see [http://blog.sigfpe.com/2008/11/from-monoids-to-monads.html Dan Piponi’s blog post].<br />
<br />
=Failure and choice: Alternative, MonadPlus, ArrowPlus=<br />
<br />
Several classes (<code>Applicative</code>, <code>Monad</code>, <code>Arrow</code>) have "monoidal" subclasses, intended to model computations that support "failure" and "choice" (in some appropriate sense).<br />
<br />
==Definition==<br />
<br />
The <code>Alternative</code> type class ([{{HackageDocs|base|Control-Applicative}}#g:2 haddock])<br />
is for <code>Applicative</code> functors which also have<br />
a monoid structure:<br />
<br />
<haskell><br />
class Applicative f => Alternative f where<br />
empty :: f a<br />
(<|>) :: f a -> f a -> f a<br />
<br />
some :: f a -> f [a]<br />
many :: f a -> f [a]<br />
</haskell><br />
<br />
The basic intuition is that <code>empty</code> represents some sort of "failure", and <code>(<|>)</code> represents a choice between alternatives. (However, this intuition does not fully capture the nuance possible; see the section on Laws below.) Of course, <code>(<|>)</code> should be associative and <code>empty</code> should be the identity element for it.<br />
Instances of <code>Alternative</code> must implement <code>empty</code> and <code>(&lt;|&gt;)</code>; <code>some</code> and <code>many</code> have default implementations but are included in the class since specialized implementations may be more efficient than the default.<br />
<br />
The default definitions of <code>some</code> and <code>many</code> are essentially given by<br />
<br />
<haskell><br />
some v = (:) <$> v <*> many v<br />
many v = some v <|> pure []<br />
</haskell><br />
<br />
(though for some reason, in actual fact they are not defined via mutual recursion). The intuition is that both keep running <code>v</code>, collecting its results into a list, until it fails; <code>some v</code> requires <code>v</code> to succeed at least once, whereas <code>many v</code> does not require it to succeed at all. That is, <code>many</code> represents 0 or more repetitions of <code>v</code>, whereas <code>some</code> represents 1 or more repetitions. Note that <code>some</code> and <code>many</code> do not make sense for all instances of <code>Alternative</code>; they are discussed further below.<br />
<br />
Likewise, <code>MonadPlus</code> ([{{HackageDocs|base|Control-Monad}}#t:MonadPlus haddock])<br />
is for <code>Monad</code>s with a monoid structure:<br />
<br />
<haskell><br />
class Monad m => MonadPlus m where<br />
mzero :: m a<br />
mplus :: m a -> m a -> m a<br />
</haskell><br />
<br />
Finally, <code>ArrowZero</code> and <code>ArrowPlus</code> ([{{HackageDocs|base|Control-Arrow}}#t:ArrowZero haddock])<br />
represent <code>Arrow</code>s ([[#Arrow|see below]]) with a<br />
monoid structure:<br />
<br />
<haskell><br />
class Arrow arr => ArrowZero arr where<br />
zeroArrow :: b `arr` c<br />
<br />
class ArrowZero arr => ArrowPlus arr where<br />
(<+>) :: (b `arr` c) -> (b `arr` c) -> (b `arr` c)<br />
</haskell><br />
<br />
==Instances==<br />
<br />
Although this document typically discusses laws before presenting example instances, for <code>Alternative</code> and friends it is worth doing things the other way around, because there is some controversy over the laws and it helps to have some concrete examples in mind when discussing them. We mostly focus on <code>Alternative</code> in this section and the next; now that <code>Applicative</code> is a superclass of <code>Monad</code>, there is little reason to use <code>MonadPlus</code> any longer, and <code>ArrowPlus</code> is rather obscure.<br />
<br />
* <code>Maybe</code> is an instance of <code>Alternative</code>, where <code>empty</code> is <code>Nothing</code> and the choice operator <code>(<|>)</code> results in its first argument when it is <code>Just</code>, and otherwise results in its second argument. Hence folding over a list of <code>Maybe</code> with <code>(<|>)</code> (which can be done with <code>asum</code> from <code>Data.Foldable</code>) results in the first non-<code>Nothing</code> value in the list (or <code>Nothing</code> if there are none).<br />
<br />
* <code>[]</code> is an instance, with <code>empty</code> given by the empty list, and <code>(<|>)</code> equal to <code>(++)</code>. It is worth pointing out that this is identical to the <code>Monoid</code> instance for <code>[a]</code>, whereas the <code>Alternative</code> and <code>Monoid</code> instances for <code>Maybe</code> are different: the <code>Monoid</code> instance for <code>Maybe a</code> requires a <code>Monoid</code> instance for <code>a</code>, and monoidally combines the contained values when presented with two <code>Just</code>s.<br />
<br />
Let's think about the behavior of <code>some</code> and <code>many</code> for <code>Maybe</code> and <code>[]</code>. For <code>Maybe</code>, we have <code>some Nothing = (:) <$> Nothing <*> many Nothing = Nothing <*> many Nothing = Nothing</code>. Hence we also have <code>many Nothing = some Nothing <|> pure [] = Nothing <|> pure [] = pure [] = Just []</code>. Boring. But what about applying <code>some</code> and <code>many</code> to <code>Just</code>? In fact, <code>some (Just a)</code> and <code>many (Just a)</code> are both bottom! The problem is that since <code>Just a</code> is always "successful", the recursion will never terminate. In theory the result "should be" the infinite list <code>[a,a,a,...]</code> but it cannot even start producing any elements of this list, because there is no way for the <code>(<*>)</code> operator to yield any output until it knows that the result of the call to <code>many</code> will be <code>Just</code>.<br />
<br />
You can work out the behavior for <code>[]</code> yourself, but it ends up being quite similar: <code>some</code> and <code>many</code> yield boring results when applied to the empty list, and yield bottom when applied to any non-empty list.<br />
<br />
In the end, <code>some</code> and <code>many</code> really only make sense when used with some sort of "stateful" <code>Applicative</code> instance, for which an action <code>v</code>, when run multiple times, can succeed some finite number of times and then fail. For example, parsers have this behavior, and indeed, parsers were the original motivating example for the <code>some</code> and <code>many</code> methods; more on this below.<br />
<br />
* Since GHC 8.0 (that is, <code>base-4.9</code>), there is an instance of <code>Alternative</code> for <code>IO</code>. <code>empty</code> throws an I/O exception, and <code>(<|>)</code> works by first running its left-hand argument; if the left-hand argument throws an I/O exception, <code>(<|>)</code> catches the exception and then calls its second argument. (Note that other types of exceptions are not caught.) There are other, much better ways to handle I/O errors, but this is a quick and dirty way that may work for simple, one-off programs, such as expressions typed at the GHCi prompt. For example, if you want to read the contents of a file but use some default contents in case the file does not exist, you can just write <code>readFile "somefile.txt" <|> return "default file contents"</code>.<br />
<br />
* <code>Concurrently</code> from the <code>async</code> package has an <code>Alternative</code> instance, for which <code>c1 <|> c2</code> races <code>c1</code> and <code>c2</code> in parallel, and returns the result of whichever finishes first. <code>empty</code> corresponds to the action that runs forever without returning a value.<br />
<br />
* Practically any parser type (e.g. from <code>parsec</code>, <code>megaparsec</code>, <code>trifecta</code>, ...) has an <code>Alternative</code> instance, where <code>empty</code> is an unconditional parse failure, and <code>(<|>)</code> is left-biased choice. That is, <code>p1 <|> p2</code> first tries parsing with <code>p1</code>, and if <code>p1</code> fails then it tries <code>p2</code> instead.<br />
<br />
<code>some</code> and <code>many</code> work particularly well with parser types having an <code>Applicative</code> instance: if <code>p</code> is a parser, then <code>some p</code> parses one or more consecutive occurrences of <code>p</code> (i.e. it will parse as many occurrences of <code>p</code> as possible and then stop), and <code>many p</code> parses zero or more occurrences.<br />
<br />
==Laws==<br />
<br />
Of course, instances of <code>Alternative</code> should satisfy the monoid laws<br />
<br />
<haskell><br />
empty <|> x = x<br />
x <|> empty = x<br />
(x <|> y) <|> z = x <|> (y <|> z)<br />
</haskell><br />
<br />
The documentation for <code>some</code> and <code>many</code> states that they should be the "least solution" (i.e. least in the definedness partial order) to their characterizing, mutually recursive default definitions. However, [https://www.reddit.com/r/haskell/comments/2j8bvl/laws_of_some_and_many/ this is controversial], and probably wasn't really thought out very carefully.<br />
<br />
Since <code>Alternative</code> is a subclass of <code>Applicative</code>, a natural question is, "how should <code>empty</code> and <code>(<|>)</code> interact with <code>(<*>)</code> and <code>pure</code>?"<br />
<br />
Almost everyone agrees on the ''left zero'' law (though see the discussion of the ''right zero'' law below):<br />
<br />
<haskell><br />
empty <*> f = empty<br />
</haskell><br />
<br />
After this is where it starts to get a bit hairy though. It turns out there are several other laws one might imagine adding, and different instances satisfy different laws.<br />
<br />
* ''Right Zero'':<p>Another obvious law would be <haskell>f <*> empty = empty</haskell></p><p>This law is satisfied by most instances; however, it is not satisfied by <code>IO</code>. Once the effects in <code>f</code> have been executed, there is no way to roll them back if we later encounter an exception. Now consider the <code>Backwards</code> applicative transformer from the <code>transformers</code> package. If <code>f</code> is <code>Applicative</code>, then so is <code>Backwards f</code>; it works the same way but performs the actions of the arguments to <code>(<*>)</code> in the reverse order. There is also an instance <code>Alternative f => Alternative (Backwards f)</code>. If some <code>f</code> (such as <code>IO</code>) satisfies ''left zero'' but not ''right zero'', then <code>Backwards f</code> satisfies ''right zero'' but not ''left zero''! So even the ''left zero'' law is suspect. The point is that given the existence of <code>Backwards</code> we cannot privilege one direction or the other.</p><br />
<br />
<br />
* ''Left Distribution'':<p><haskell>(a <|> b) <*> c = (a <*> c) <|> (b <*> c)</haskell></p><p>This distributivity law is satisfied by <code>[]</code> and <code>Maybe</code>, as you may verify. However, it is ''not'' satisfied by <code>IO</code> or most parsers. The reason is that <code>a</code> and <code>b</code> can have effects which influence execution of <code>c</code>, and the left-hand side may end up failing where the right-hand side succeeds.</p><p>For example, consider <code>IO</code>, and suppose that <code>a</code> always executes successfully, but <code>c</code> throws an I/O exception after <code>a</code> has run. Concretely, say, <code>a</code> might ensure that a certain file does not exist (deleting it if it does exist or doing nothing if it does not), and then <code>c</code> tries to read that file. In that case <code>(a <|> b) <*> c</code> will first delete the file, ignoring <code>b</code> since <code>a</code> is successful, and then throw an exception when <code>c</code> tries to read the file. On the other hand, <code>b</code> might ensure that the same file in question ''does'' exist. In that case <code>(a <*> c) <|> (b <*> c)</code> would succeed: after <code>(a <*> c)</code> throws an exception, it would be caught by <code>(<|>)</code>, and then <code>(b <*> c)</code> would be tried.</p><p>This law does not hold for parsers for a similar reason: <code>(a <|> b) <*> c</code> has to "commit" to parsing with <code>a</code> or <code>b</code> before running <code>c</code>, whereas <code>(a <*> c) <|> (b <*> c)</code> allows backtracking if <code>a <*> c</code> fails. In the particular case that <code>a</code> succeeds but <code>c</code> fails after <code>a</code> but not after <code>b</code>, these may give different results. For example, suppose <code>a</code> and <code>c</code> both expect to see two asterisks, but <code>b</code> expects to see only one. If there are only three asterisks in the input, <code>b <*> c</code> will be successful whereas <code>a <*> c</code> will not.</p><br />
<br />
* ''Right Distribution'':<p><haskell>a <*> (b <|> c) = (a <*> b) <|> (a <*> c)</haskell></p><p>This law is not satisfied by very many instances, but it's still worth discussing. In particular the law is still satisfied by <code>Maybe</code>. However, it is ''not'' satisfied by, for example, lists. The problem is that the results come out in a different order. For example, suppose <code>a = [(+1), (*10)]</code>, <code>b = [2]</code>, and <code>c = [3]</code>. Then the left-hand side yields <code>[3,4,20,30]</code>, whereas the right-hand side is <code>[3,20,4,30]</code>.</p><p><code>IO</code> does not satisfy it either, since, for example, <code>a</code> may succeed only the ''second'' time it is executed. Parsers, on the other hand, may or may not satisfy this law, depending on how they handle backtracking. Parsers for which <code>(<|>)</code> by itself does full backtracking will satisfy the law; but for many parser combinator libraries this is not the case, for efficiency reasons. For example, parsec fails this law: if <code>a</code> succeeds while consuming some input, and afterwards <code>b</code> fails without consuming any input, then the left-hand side may succeed while the right-hand side fails: after <code>(a <*> b)</code> fails, the right-hand side tries to re-run <code>a</code> without backtracking over the input the original <code>a</code> consumed.</p><br />
<br />
* ''Left Catch'':<p><haskell>(pure a) <|> x = pure a</haskell></p><p>Intuitively, this law states that <code>pure</code> should always represent a "successful" computation. It is satisfied by <code>Maybe</code>, <code>IO</code>, and parsers. However, it is not satisfied by lists, since lists collect ''all'' possible results: it corresponds to <code>[a] ++ x == [a]</code> which is obviously false.</p><br />
<br />
This, then, is the situation: we have a lot of instances of <code>Alternative</code> (and <code>MonadPlus</code>), with each instance satisfying some ''subset'' of these laws. Moreover, it's not always the ''same'' subset, so there is no obvious "default" set of laws to choose. For now at least, we just have to live with the situation. When using a particular instance of <code>Alternative</code> or <code>MonadPlus</code>, it's worth thinking carefully about which laws it satisfies.<br />
<br />
==Utility functions==<br />
<br />
There are a few <code>Alternative</code>-specific utility functions worth mentioning:<br />
<br />
* <haskell>guard :: Alternative f => Bool -> f ()</haskell> checks the given condition, and evaluates to <code>pure ()</code> if the condition holds, and <code>empty</code> if not. This can be used to create a conditional failure point in the middle of a computation, where the computation only proceeds if a certain condition holds.<br />
<br />
* <haskell>optional :: Alternative f => f a -> f (Maybe a)</haskell> reifies potential failure into the <code>Maybe</code> type: that is, <code>optional x</code> is a computation which always succeeds, returning <code>Nothing</code> if <code>x</code> fails and <code>Just a</code> if <code>x</code> successfully results in <code>a</code>. It is useful, for example, in the context of parsers, where it corresponds to a production which can occur zero or one times.<br />
<br />
==Further reading==<br />
<br />
There used to be a type class called <code>MonadZero</code> containing only<br />
<code>mzero</code>, representing monads with failure. The <code>do</code>-notation requires<br />
some notion of failure to deal with failing pattern matches.<br />
Unfortunately, <code>MonadZero</code> was scrapped in favor of adding the <code>fail</code><br />
method to the <code>Monad</code> class. If we are lucky, someday <code>MonadZero</code> will<br />
be restored, and <code>fail</code> will be banished to the bit bucket where it<br />
belongs (see [[MonadPlus reform proposal]]). The idea is that any<br />
<code>do</code>-block which uses pattern matching (and hence may fail) would require<br />
a <code>MonadZero</code> constraint; otherwise, only a <code>Monad</code> constraint would be<br />
required.<br />
<br />
A great introduction to the <code>MonadPlus</code> type class, with interesting examples of its use, is Doug Auclair’s ''MonadPlus: What a Super Monad!'' in [http://www.haskell.org/wikiupload/6/6a/TMR-Issue11.pdf the Monad.Reader issue 11].<br />
<br />
Another interesting use of <code>MonadPlus</code> can be found in Christiansen et al, [http://www-ps.informatik.uni-kiel.de/~sad/icfp2016-preprint.pdf All Sorts of Permutations], from ICFP 2016.<br />
<br />
The [https://hackage.haskell.org/package/logict logict package] defines a type with prominent <code>Alternative</code> and <code>MonadPlus</code> instances that can be used to efficiently enumerate possibilities subject to constraints, ''i.e.'' logic programming; it's like the list monad on steroids.<br />
<br />
=Foldable=<br />
<br />
The <code>Foldable</code> class, defined in the <code>Data.Foldable</code><br />
module ([{{HackageDocs|base|Data-Foldable}} haddock]), abstracts over containers which can be<br />
“folded” into a summary value. This allows such folding operations<br />
to be written in a container-agnostic way.<br />
<br />
==Definition==<br />
<br />
The definition of the <code>Foldable</code> type class is:<br />
<br />
<haskell><br />
class Foldable t where<br />
fold :: Monoid m => t m -> m<br />
foldMap :: Monoid m => (a -> m) -> t a -> m<br />
foldr :: (a -> b -> b) -> b -> t a -> b<br />
foldr' :: (a -> b -> b) -> b -> t a -> b<br />
foldl :: (b -> a -> b) -> b -> t a -> b<br />
foldl' :: (b -> a -> b) -> b -> t a -> b<br />
foldr1 :: (a -> a -> a) -> t a -> a<br />
foldl1 :: (a -> a -> a) -> t a -> a<br />
toList :: t a -> [a]<br />
null :: t a -> Bool<br />
length :: t a -> Int<br />
elem :: Eq a => a -> t a -> Bool<br />
maximum :: Ord a => t a -> a<br />
minimum :: Ord a => t a -> a<br />
sum :: Num a => t a -> a<br />
product :: Num a => t a -> a<br />
</haskell><br />
<br />
This may look complicated, but in fact, to make a <code>Foldable</code> instance<br />
you only need to implement one method: your choice of <code>foldMap</code> or<br />
<code>foldr</code>. All the other methods have default implementations in terms<br />
of these, and are included in the class in case more<br />
efficient implementations can be provided.<br />
<br />
==Instances and examples==<br />
<br />
The type of <code>foldMap</code> should make it clear what it is supposed to do:<br />
given a way to convert the data in a container into a <code>Monoid</code> (a<br />
function <code>a -> m</code>) and a container of <code>a</code>’s (<code>t a</code>), <code>foldMap</code><br />
provides a way to iterate over the entire contents of the container,<br />
converting all the <code>a</code>’s to <code>m</code>’s and combining all the <code>m</code>’s with<br />
<code>mappend</code>. The following code shows two examples: a simple<br />
implementation of <code>foldMap</code> for lists, and a binary tree example<br />
provided by the <code>Foldable</code> documentation.<br />
<br />
<haskell><br />
instance Foldable [] where<br />
foldMap :: Monoid m => (a -> m) -> [a] -> m<br />
foldMap g = mconcat . map g<br />
<br />
data Tree a = Empty | Leaf a | Node (Tree a) a (Tree a)<br />
<br />
instance Foldable Tree where<br />
foldMap :: Monoid m => (a -> m) -> Tree a -> m<br />
foldMap f Empty = mempty<br />
foldMap f (Leaf x) = f x<br />
foldMap f (Node l k r) = foldMap f l `mappend` f k `mappend` foldMap f r<br />
</haskell><br />
<br />
The <code>Foldable</code> module also provides instances for <code>Maybe</code> and <code>Array</code>;<br />
additionally, many of the data structures found in the standard [http://hackage.haskell.org/package/containers containers library] (for example, <code>Map</code>, <code>Set</code>, <code>Tree</code>,<br />
and <code>Sequence</code>) provide their own <code>Foldable</code> instances.<br />
<br />
{{Exercises|<br />
# Implement <code>fold</code> in terms of <code>foldMap</code>.<br />
# What would you need in order to implement <code>foldMap</code> in terms of <code>fold</code>?<br />
# Implement <code>foldMap</code> in terms of <code>foldr</code>.<br />
# Implement <code>foldr</code> in terms of <code>foldMap</code> (hint: use the <code>Endo</code> monoid).<br />
# What is the type of <code>foldMap . foldMap</code>? Or <code>foldMap . foldMap . foldMap</code>, etc.? What do they do?<br />
}}<br />
<br />
==Derived folds==<br />
<br />
Given an instance of <code>Foldable</code>, we can write generic,<br />
container-agnostic functions such as:<br />
<br />
<haskell><br />
-- Compute the size of any container.<br />
containerSize :: Foldable f => f a -> Int<br />
containerSize = getSum . foldMap (const (Sum 1))<br />
<br />
-- Compute a list of elements of a container satisfying a predicate.<br />
filterF :: Foldable f => (a -> Bool) -> f a -> [a]<br />
filterF p = foldMap (\a -> if p a then [a] else [])<br />
<br />
-- Get a list of all the Strings in a container which include the<br />
-- letter a.<br />
aStrings :: Foldable f => f String -> [String]<br />
aStrings = filterF (elem 'a')<br />
</haskell><br />
<br />
The <code>Foldable</code> module also provides a large number of predefined<br />
folds. These used to be generalized versions of <code>Prelude</code> functions of the<br />
same name that only worked on lists; but [https://wiki.haskell.org/Foldable_Traversable_In_Prelude as of GHC 7.10], the generalized versions themselves are now exported from the Prelude: for example, <code>concat</code>, <code>concatMap</code>, <code>and</code>,<br />
<code>or</code>, <code>any</code>, <code>all</code>, <code>sum</code>, <code>product</code>, <code>maximum</code>(<code>By</code>),<br />
<code>minimum</code>(<code>By</code>), <code>elem</code>, <code>notElem</code>, and <code>find</code>. For example, before GHC 7.10, <code>length</code> used to have type <code>length :: [a] -> Int</code>; now it has type <code>Foldable t => t a -> Int</code> (and is in fact the same as the <code>containerSize</code> function shown above).<br />
<br />
The important function <code>toList</code> is also provided, which turns any <code>Foldable</code> structure into a list of its elements in left-right order; it works by folding with the list monoid.<br />
<br />
There are also generic functions that work with <code>Applicative</code> or<br />
<code>Monad</code> instances to generate some sort of computation from each<br />
element in a container, and then perform all the side effects from<br />
those computations, discarding the results: <code>traverse_</code>, <code>sequenceA_</code>,<br />
and others. The results must be discarded because the <code>Foldable</code><br />
class is too weak to specify what to do with them: we cannot, in<br />
general, make an arbitrary <code>Applicative</code> or <code>Monad</code> instance into a <code>Monoid</code>, but we can make <code>m ()</code> into a <code>Monoid</code> for any such <code>m</code>. If we do have an <code>Applicative</code> or <code>Monad</code> with a monoid<br />
structure—that is, an <code>Alternative</code> or a <code>MonadPlus</code>—then we can<br />
use the <code>asum</code> or <code>msum</code> functions, which can combine the results as<br />
well. Consult the [{{HackageDocs|base|Data-Foldable}} <code>Foldable</code> documentation] for<br />
more details on any of these functions.<br />
<br />
Note that the <code>Foldable</code> operations always forget the structure of<br />
the container being folded. If we start with a container of type <code>t a</code> for some <code>Foldable t</code>, then <code>t</code> will never appear in the output<br />
type of any operations defined in the <code>Foldable</code> module. Many times<br />
this is exactly what we want, but sometimes we would like to be able<br />
to generically traverse a container while preserving its<br />
structure—and this is exactly what the <code>Traversable</code> class provides,<br />
which will be discussed in the next section.<br />
<br />
{{Exercises|<br />
# Implement <code>toList :: Foldable f {{=}}> f a -> [a]</code> in terms of either <code>foldr</code> or <code>foldMap</code>.<br />
# Show how one could implement the generic version of <code>foldr</code> in terms of <code>toList</code>, assuming we had only the list-specific <code>foldr :: (a -> b -> b) -> b -> [a] -> b</code>.<br />
# Pick some of the following functions to implement: <code>concat</code>, <code>concatMap</code>, <code>and</code>, <code>or</code>, <code>any</code>, <code>all</code>, <code>sum</code>, <code>product</code>, <code>maximum</code>(<code>By</code>), <code>minimum</code>(<code>By</code>), <code>elem</code>, <code>notElem</code>, and <code>find</code>. Figure out how they generalize to <code>Foldable</code> and come up with elegant implementations using <code>fold</code> or <code>foldMap</code> along with appropriate <code>Monoid</code> instances.<br />
}}<br />
<br />
==Utility functions==<br />
<br />
* <code>asum :: (Alternative f, Foldable t) => t (f a) -> f a</code> takes a container full of computations and combines them using <code>(<|>)</code>.<br />
<br />
* <code>sequenceA_ :: (Applicative f, Foldable t) => t (f a) -> f ()</code> takes a container full of computations and runs them in sequence, discarding the results (that is, they are used only for their effects). Since the results are discarded, the container only needs to be <code>Foldable</code>. (Compare with <code>sequenceA :: (Applicative f, Traversable t) => t (f a) -> f (t a)</code>, which requires a stronger <code>Traversable</code> constraint in order to be able to reconstruct a container of results having the same shape as the original container.)<br />
<br />
* <code>traverse_ :: (Applicative f, Foldable t) => (a -> f b) -> t a -> f ()</code> applies the given function to each element in a foldable container and sequences the effects (but discards the results).<br />
<br />
* <code>for_</code> is the same as <code>traverse_</code> but with its arguments flipped. This is the moral equivalent of a "foreach" loop in an imperative language.<br />
<br />
* For historical reasons, there are also variants of all the above with overly-restrictive <code>Monad</code>(-like) constraints: <code>msum</code> is the same as <code>asum</code> specialized to <code>MonadPlus</code>, and <code>sequence_</code>, <code>mapM_</code>, and <code>forM_</code> respectively are <code>Monad</code> specializations of <code>sequenceA_</code>, <code>traverse_</code>, and <code>for_</code>.<br />
<br />
{{Exercises|<br />
# Implement <code>traverse_</code> in terms of <code>sequenceA_</code> and vice versa. One of these will need an extra constraint. What is it?<br />
}}<br />
<br />
==Foldable actually isn't==<br />
<br />
The generic term "fold" is often used to refer to the more technical concept of [[Catamorphisms|catamorphism]]. Intuitively, given a way to summarize "one level of structure" (where recursive subterms have already been replaced with their summaries), a catamorphism can summarize an entire recursive structure. It is important to realize that <code>Foldable</code> does <i>not</i> correspond to catamorphisms, but to something weaker. In particular, <code>Foldable</code> allows observing only the left-right traversal order of elements within a structure, not the actual structure itself. Put another way, every use of <code>Foldable</code> can be expressed in terms of <code>toList</code>. For example, <code>fold</code> itself is equivalent to <code>mconcat . toList</code>.<br />
<br />
This is sufficient for many tasks, but not all. For example, consider trying to compute the depth of a <code>Tree</code>: try as we might, there is no way to implement it using <code>Foldable</code>. However, it <i>can</i> be implemented as a catamorphism.<br />
<br />
==Further reading==<br />
<br />
The <code>Foldable</code> class had its genesis in [http://www.soi.city.ac.uk/~ross/papers/Applicative.html McBride and Paterson’s paper]<br />
introducing <code>Applicative</code>, although it has<br />
been fleshed out quite a bit from the form in the paper.<br />
<br />
An interesting use of <code>Foldable</code> (as well as <code>Traversable</code>) can be<br />
found in Janis Voigtländer’s paper [http://doi.acm.org/10.1145/1480881.1480904 Bidirectionalization for free!].<br />
<br />
For more on the relationship between <code>fold</code>, <code>foldMap</code>, and <code>foldr</code>, see [https://byorgey.wordpress.com/2012/11/05/foldr-is-made-of-monoids/ foldr is made of monoids].<br />
<br />
There was [http://tojans.me/blog/2015/10/13/foldable-for-non-haskellers-haskells-controversial-ftp-proposal/ quite a bit of controversy] in the Haskell community about a [https://wiki.haskell.org/Foldable_Traversable_In_Prelude proposal to integrate <code>Foldable</code> (and <code>Traversable</code>) more tightly into the Prelude], known as the FTP. Some of the controversy centered around <code>Foldable</code> instances such as the one for <code>((,) a)</code>, which, together with generalized types for functions such as <code>length :: Foldable t => t a -> Int</code>, allow one to derive seemingly nonsensical results such as <code>length (2,3) = 1</code>. Here is a [https://www.youtube.com/watch?v=87re_yIQMDw humorous talk] poking fun at the situation.<br />
<br />
=Traversable=<br />
<br />
==Definition==<br />
<br />
The <code>Traversable</code> type class, defined in the <code>Data.Traversable</code><br />
module ([{{HackageDocs|base|Data-Traversable}} haddock]), is:<br />
<br />
<haskell><br />
class (Functor t, Foldable t) => Traversable t where<br />
traverse :: Applicative f => (a -> f b) -> t a -> f (t b)<br />
sequenceA :: Applicative f => t (f a) -> f (t a)<br />
mapM :: Monad m => (a -> m b) -> t a -> m (t b)<br />
sequence :: Monad m => t (m a) -> m (t a)<br />
</haskell><br />
<br />
As you can see, every <code>Traversable</code> is also a <code>Foldable</code> <code>Functor</code>. To make a <code>Traversable</code> instance, it suffices to implement either <code>traverse</code> or<br />
<code>sequenceA</code>; the other methods all have default implementations in<br />
terms of these. Note that <code>mapM</code> and <code>sequence</code> only exist for historical reasons; especially now that <code>Applicative</code> is a superclass of <code>Monad</code>, they are nothing more than copies of <code>traverse</code> and <code>sequenceA</code>, respectively, but with more restrictive types.<br />
<br />
==Intuition==<br />
<br />
<br />
The key method of the <code>Traversable</code> class is <code>traverse</code>, which has the following type:<br />
<haskell><br />
traverse :: Applicative f => (a -> f b) -> t a -> f (t b)<br />
</haskell><br />
This leads us to view <code>Traversable</code> as a generalization of <code>Functor</code>. <code>traverse</code> is an "effectful <code>fmap</code>": it allows us to map over a structure of type <code>t a</code>, applying a function to every element of type <code>a</code> in order to produce a new structure of type <code>t b</code>; but along the way the function may have some effects (captured by the applicative functor <code>f</code>).<br />
<br />
Alternatively, we may consider the <code>sequenceA</code> function. Consider its type:<br />
<haskell><br />
sequenceA :: Applicative f => t (f a) -> f (t a)<br />
</haskell><br />
This answers the fundamental question: when can we commute two<br />
functors? For example, can we turn a tree of lists into a list of<br />
trees?<br />
<br />
The ability to compose two monads depends crucially on this ability to<br />
commute functors. Intuitively, if we want to build a composed monad<br />
<code>M a = m (n a)</code> out of monads <code>m</code> and <code>n</code>, then to be able to<br />
implement <code>join :: M (M a) -> M a</code>, that is,<br />
<code>join :: m (n (m (n a))) -> m (n a)</code>, we have to be able to commute<br />
the <code>n</code> past the <code>m</code> to get <code>m (m (n (n a)))</code>, and then we can use the<br />
<code>join</code>s for <code>m</code> and <code>n</code> to produce something of type <code>m (n a)</code>. See<br />
[http://web.cecs.pdx.edu/~mpj/pubs/springschool.html Mark Jones’ paper] for more details.<br />
<br />
It turns out that given a <code>Functor</code> constraint on the type <code>t</code>, <code>traverse</code> and <code>sequenceA</code> are equivalent in power: either can be implemented in terms of the other.<br />
<br />
{{Exercises|<br />
# There are at least two natural ways to turn a tree of lists into a list of trees. What are they, and why?<br />
# Give a natural way to turn a list of trees into a tree of lists.<br />
# What is the type of <code>traverse . traverse</code>? What does it do?<br />
# Implement <code>traverse</code> in terms of <code>sequenceA</code>, and vice versa.<br />
}}<br />
<br />
==Instances and examples==<br />
<br />
What’s an example of a <code>Traversable</code> instance?<br />
The following code shows an example instance for the same<br />
<code>Tree</code> type used as an example in the previous <code>Foldable</code> section. It<br />
is instructive to compare this instance with a <code>Functor</code> instance for<br />
<code>Tree</code>, which is also shown.<br />
<br />
<haskell><br />
data Tree a = Empty | Leaf a | Node (Tree a) a (Tree a)<br />
<br />
instance Traversable Tree where<br />
traverse :: Applicative f => (a -> f b) -> Tree a -> f (Tree b) <br />
traverse g Empty = pure Empty<br />
traverse g (Leaf x) = Leaf <$> g x<br />
traverse g (Node l x r) = Node <$> traverse g l<br />
<*> g x<br />
<*> traverse g r<br />
<br />
instance Functor Tree where<br />
fmap :: (a -> b) -> Tree a -> Tree b<br />
fmap g Empty = Empty<br />
fmap g (Leaf x) = Leaf $ g x<br />
fmap g (Node l x r) = Node (fmap g l)<br />
(g x)<br />
(fmap g r)<br />
</haskell><br />
<br />
It should be clear that the <code>Traversable</code> and <code>Functor</code> instances for<br />
<code>Tree</code> are structurally identical; the only difference is that the <code>Functor</code><br />
instance involves normal function application, whereas the<br />
applications in the <code>Traversable</code> instance take place within an<br />
<code>Applicative</code> context, using <code>(<$>)</code> and <code>(<*>)</code>. This same pattern will hold for any type.<br />
<br />
Any <code>Traversable</code> functor is also <code>Foldable</code>, and a <code>Functor</code>. We can see<br />
this not only from the class declaration, but by the fact that we can<br />
implement the methods of both classes given only the <code>Traversable</code><br />
methods.<br />
<br />
The standard libraries provide a number of <code>Traversable</code> instances,<br />
including instances for <code>[]</code>, <code>ZipList</code>, <code>Maybe</code>, <code>((,) e)</code>, <code>Sum</code>, <code>Product</code>, <code>Either e</code>, <code>Map</code>, <code>Tree</code>, and <code>Sequence</code>.<br />
Notably, <code>Set</code> is not <code>Traversable</code>, although it is <code>Foldable</code>.<br />
<br />
{{Exercises|<br />
# Implement <code>fmap</code> and <code>foldMap</code> using only the <code>Traversable</code> methods. (Note that the <code>Traversable</code> module provides these implementations as <code>fmapDefault</code> and <code>foldMapDefault</code>.)<br />
# Implement <code>Traversable</code> instances for <code>[]</code>, <code>Maybe</code>, <code>((,) e)</code>, and <code>Either e</code>.<br />
# Explain why <code>Set</code> is <code>Foldable</code> but not <code>Traversable</code>.<br />
# Show that <code>Traversable</code> functors compose: that is, implement an instance for <code>Traversable (Compose f g)</code> given <code>Traversable</code> instances for <code>f</code> and <code>g</code>.<br />
}}<br />
<br />
==Laws==<br />
<br />
Any instance of <code>Traversable</code> must satisfy the following two laws, where <code>Identity</code> is the identity functor (as defined in the [http://hackage.haskell.org/packages/archive/transformers/latest/doc/html/Data-Functor-Identity.html <code>Data.Functor.Identity</code> module] from the <code>transformers</code> package), and <code>Compose</code> wraps the composition of two functors (as defined in [http://hackage.haskell.org/packages/archive/transformers/0.3.0.0/doc/html/Data-Functor-Compose.html <code>Data.Functor.Compose</code>]):<br />
<br />
# <code>traverse Identity = Identity</code><br />
# <code>traverse (Compose . fmap g . f) = Compose . fmap (traverse g) . traverse f</code><br />
<br />
The first law essentially says that traversals cannot make up arbitrary effects. The second law explains how doing two traversals in sequence can be collapsed to a single traversal.<br />
<br />
Additionally, suppose <code>eta</code> is an "<code>Applicative</code> morphism", that is,<br />
<haskell><br />
eta :: forall a f g. (Applicative f, Applicative g) => f a -> g a<br />
</haskell><br />
and <code>eta</code> preserves the <code>Applicative</code> operations: <code>eta (pure x) = pure x</code> and <code>eta (x <*> y) = eta x <*> eta y</code>. Then, by parametricity, any instance of <code>Traversable</code> satisfying the above two laws will also satisfy <code>eta . traverse f = traverse (eta . f)</code>.<br />
<br />
==Further reading==<br />
<br />
The <code>Traversable</code> class also had its genesis in [http://www.soi.city.ac.uk/~ross/papers/Applicative.html McBride and Paterson’s <code>Applicative</code> paper],<br />
and is described in more detail in Gibbons and Oliveira, [http://www.comlab.ox.ac.uk/jeremy.gibbons/publications/iterator.pdf The Essence of the Iterator Pattern],<br />
which also contains a wealth of references to related work.<br />
<br />
<code>Traversable</code> forms a core component of Edward Kmett's [http://hackage.haskell.org/package/lens lens library]. Watching [https://vimeo.com/56063074 Edward's talk on the subject] is a highly recommended way to gain better insight into <code>Traversable</code>, <code>Foldable</code>, <code>Applicative</code>, and many other things besides.<br />
<br />
For references on the <code>Traversable</code> laws, see Russell O'Connor's [http://archive.fo/7XcVE mailing list post] (and subsequent thread), and [https://arxiv.org/abs/1202.2919 this paper by Jaskelioff and Rypacek] for a more in-depth discussion. Daniel Mlot also has [http://duplode.github.io/posts/traversable-a-remix.html this very nice blog post] explaining how <code>Traversable</code> arises by considering a variant on the usual Kleisli category of a monad, which also sheds light on where the <code>Traversable</code> laws come from.<br />
<br />
[http://elvishjerricco.github.io/2017/03/23/applicative-sorting.html This blog post by Will Fancher] shows how to use <code>Traversable</code> along with a clever choice of <code>Applicative</code> to efficiently sort any <code>Traversable</code> container.<br />
<br />
=Bifunctor=<br />
<br />
Recall that a <code>Functor</code> is a type of kind <code>* -> *</code> where one can "map" a function over the type parameter. <code>(Either e)</code> is a <code>Functor</code> (with <code>fmap :: (a -> b) -> Either e a -> Either e b</code>), as is <code>((,) e)</code>. But there is something oddly asymmetric about these two examples: in principle, there is no reason we can't map over the <code>e</code> instead of the <code>a</code>, for example, like so: <code>lmap :: (e -> e') -> Either e a -> Either e' a</code>. This observation leads directly to the definition of <code>Bifunctor</code>, a class for types of kind <code>* -> * -> *</code> where one can functorially map over ''both'' type parameters.<br />
<br />
==Definition==<br />
<br />
Here is the type class declaration for <code>Bifunctor</code>, defined<br />
in <code>Data.Bifunctor</code> (since <code>base-4.8</code>, which came with GHC 7.10):<br />
<br />
<haskell><br />
class Bifunctor p where<br />
bimap :: (a -> b) -> (c -> d) -> p a c -> p b d<br />
<br />
first :: (a -> b) -> p a c -> p b c<br />
second :: (b -> c) -> p a b -> p a c<br />
</haskell><br />
<br />
We can infer from the fact that <code>p</code> is applied to two type<br />
arguments that its kind must be <code>* -> * -> *</code>. The most<br />
fundamental method of the <code>Bifunctor</code> class is<br />
<code>bimap</code>, which allows mapping over both type arguments at<br />
once. For example,<br />
<br />
<haskell><br />
bimap (+1) length (4, [1,2,3]) = (5,3)<br />
</haskell><br />
<br />
<code>first</code> and <code>second</code> are also provided for<br />
mapping over only one type argument at a time. One is required to<br />
define either <code>bimap</code>, or both <code>first</code> and<br />
<code>second</code>, since default definitions are provided for each<br />
in terms of the others, namely:<br />
<br />
<haskell><br />
bimap f g = first f . second g<br />
<br />
first f = bimap f id<br />
second g = bimap id g<br />
</haskell><br />
<br />
==Laws==<br />
<br />
The laws for <code>Bifunctor</code> are entirely analogous to the laws<br />
for <code>Functor</code>. First, mapping with the identity function<br />
should have no effect:<br />
<br />
<haskell><br />
bimap id id = id<br />
first id = id<br />
second id = id<br />
</haskell><br />
<br />
Second, mapping with a composition should be the same as a composition<br />
of maps:<br />
<br />
<haskell><br />
bimap (f . g) (h . i) = bimap f h . bimap g i<br />
<br />
first (f . g) = first f . first g<br />
second (f . g) = second f . second g<br />
</haskell><br />
<br />
These composition laws actually come "for free" (that is, by<br />
parametricity) once the identity laws are satisfied. One can also<br />
check that the default implementations of <code>first</code> and<br />
<code>second</code> will satisfy the requisite laws if and only if<br />
<code>bimap</code> does, and vice versa.<br />
<br />
There is one additional law that relates <code>bimap</code>,<br />
<code>first</code>, and <code>second</code>, namely,<br />
<br />
<haskell><br />
bimap f g = first f . second g<br />
</haskell><br />
<br />
However, this law will hold automatically if one defines only<br />
<code>bimap</code>, or only <code>first</code> and<br />
<code>second</code>, using the default implementation for the others.<br />
So you only need to worry about this law if for some reason (''e.g.''<br />
efficiency) you define all three of the methods by hand.<br />
<br />
One might wonder about the symmetric law <code>bimap f g = second g<br />
. first f</code>; it turns out that once <code>bimap f g = first f<br />
. second g</code> is satisfied, the symmetric version [https://byorgey.wordpress.com/2018/03/30/parametricity-for-bifunctor/ also follows from parametricity].<br />
<br />
In summary, there are many laws that can be stated, but most of them<br />
follow automatically from default definitions or from parametricity.<br />
For example, if you define only <code>bimap</code>, then the only law<br />
you actually need to check is <code>bimap id id = id</code>; all the<br />
other laws come for free. Likewise, if you define only<br />
<code>first</code> and <code>second</code>, you only need to check<br />
that <code>first id = id</code> and <code>second id = id</code>.<br />
<br />
==Instances==<br />
<br />
* <code>(,)</code> and <code>Either</code> are instances in the evident way.<br />
<br />
* Some larger tuple constructors are also instances; for example, the instance for <code>(,,)</code> maps over the last two components, leaving the first alone. Why anyone would ever want to use this is unclear.<br />
<br />
* A value of type <code>Const a b</code> (to be discussed more in a later section) consists simply of a value of type <code>a</code>; <code>bimap f g</code> maps <code>f</code> over the <code>a</code> and ignores <code>g</code>.<br />
<br />
=Category=<br />
<br />
<code>Category</code> is a relatively recent addition to the Haskell standard libraries. It generalizes the notion of function composition to general “morphisms”.<br />
<br />
{{note|GHC 7.6.1 changed its rules regarding types and type variables. Now, any operator at the type level is treated as a type ''constructor'' rather than a type ''variable''; prior to GHC 7.6.1 it was possible to use <code>(~&gt;)</code> instead of <code>`arr`</code>. For more information, see [http://archive.fo/weS2f the discussion on the GHC-users mailing list]. For a new approach to nice arrow notation that works with GHC 7.6.1, see [http://archive.fo/HhdvB this message] and also [http://archive.fo/iGx6W this message] from Edward Kmett, though for simplicity I haven't adopted it here.}}<br />
The definition of the <code>Category</code> type class (from<br />
<code>Control.Category</code>; [{{HackageDocs|base|Control-Category}} haddock]) is shown below. For ease of reading, note that I have used an infix type variable <code>`arr`</code>, in parallel with the infix function type constructor <code>(->)</code>. {{noteref}} This syntax is not part of Haskell 2010. The second definition shown is the one used in the standard libraries. For the remainder of this document, I will use the infix type constructor <code>`arr`</code> for <code>Category</code> as well as <code>Arrow</code>.<br />
<br />
<haskell><br />
class Category arr where<br />
id :: a `arr` a<br />
(.) :: (b `arr` c) -> (a `arr` b) -> (a `arr` c)<br />
<br />
-- The same thing, with a normal (prefix) type constructor<br />
class Category cat where<br />
id :: cat a a<br />
(.) :: cat b c -> cat a b -> cat a c<br />
</haskell><br />
<br />
Note that an instance of <code>Category</code> should be a type which takes two type arguments, that is, something of kind <code>* -> * -> *</code>. It is instructive to imagine the type variable <code>cat</code> replaced by the function constructor <code>(->)</code>: indeed, in this case we recover precisely the familiar identity function <code>id</code> and function composition operator <code>(.)</code> defined in the standard <code>Prelude</code>.<br />
<br />
Of course, the <code>Category</code> module provides exactly such an instance of<br />
<code>Category</code> for <code>(->)</code>. But it also provides one other instance, shown below, which should be familiar from the previous discussion of the <code>Monad</code> laws. <code>Kleisli m a b</code>, as defined in the <code>Control.Arrow</code> module, is just a <code>newtype</code> wrapper around <code>a -> m b</code>.<br />
<br />
<haskell><br />
newtype Kleisli m a b = Kleisli { runKleisli :: a -> m b }<br />
<br />
instance Monad m => Category (Kleisli m) where<br />
id :: Kleisli m a a<br />
id = Kleisli return<br />
<br />
(.) :: Kleisli m b c -> Kleisli m a b -> Kleisli m a c<br />
Kleisli g . Kleisli h = Kleisli (h >=> g)<br />
</haskell><br />
<br />
The only laws that <code>Category</code> instances should satisfy are that <code>id</code> should be the identity of <code>(.)</code>, and <code>(.)</code> should be associative. This is kind of like being a monoid, except that, unlike with monoids, not any two values can be composed with <code>(.)</code>---their types have to match up.<br />
<br />
Finally, the <code>Category</code> module exports two additional operators:<br />
<code>(<<<)</code>, which is just a synonym for <code>(.)</code>, and <code>(>>>)</code>, which is <code>(.)</code> with its arguments reversed. (In previous versions of the libraries, these operators were defined as part of the <code>Arrow</code> class.)<br />
<br />
==Further reading==<br />
<br />
The name <code>Category</code> is a bit misleading, since the <code>Category</code> class cannot represent arbitrary categories, but only categories whose objects are objects of <code>Hask</code>, the category of Haskell types. For a more general treatment of categories within Haskell, see the [http://hackage.haskell.org/package/category-extras category-extras package]. For more about category theory in general, see the excellent [http://en.wikibooks.org/wiki/Haskell/Category_theory Haskell wikibook page],<br />
[http://books.google.com/books/about/Category_theory.html?id=-MCJ6x2lC7oC Steve Awodey’s new book], Benjamin Pierce’s [http://books.google.com/books/about/Basic_category_theory_for_computer_scien.html?id=ezdeaHfpYPwC Basic category theory for computer scientists], or [http://folli.loria.fr/cds/1999/esslli99/courses/barr-wells.html Barr and Wells category theory lecture notes]. [http://dekudekuplex.wordpress.com/2009/01/19/motivating-learning-category-theory-for-non-mathematicians/ Benjamin Russell’s blog post]<br />
is another good source of motivation and category theory links. You certainly don’t need to know any category theory to be a successful and productive Haskell programmer, but it does lend itself to much deeper appreciation of Haskell’s underlying theory.<br />
<br />
=Arrow=<br />
<br />
The <code>Arrow</code> class represents another abstraction of computation, in a<br />
similar vein to <code>Monad</code> and <code>Applicative</code>. However, unlike <code>Monad</code><br />
and <code>Applicative</code>, whose types only reflect their output, the type of<br />
an <code>Arrow</code> computation reflects both its input and output. Arrows<br />
generalize functions: if <code>arr</code> is an instance of <code>Arrow</code>, a value of<br />
type <code>b `arr` c</code> can be thought of as a computation which takes values of<br />
type <code>b</code> as input, and produces values of type <code>c</code> as output. In the<br />
<code>(->)</code> instance of <code>Arrow</code> this is just a pure function; in general, however,<br />
an arrow may represent some sort of “effectful” computation.<br />
<br />
==Definition==<br />
<br />
The definition of the <code>Arrow</code> type class, from<br />
<code>Control.Arrow</code> ([{{HackageDocs|base|Control-Arrow}} haddock]), is:<br />
<br />
<haskell><br />
class Category arr => Arrow arr where<br />
arr :: (b -> c) -> (b `arr` c)<br />
first :: (b `arr` c) -> ((b, d) `arr` (c, d))<br />
second :: (b `arr` c) -> ((d, b) `arr` (d, c))<br />
(***) :: (b `arr` c) -> (b' `arr` c') -> ((b, b') `arr` (c, c'))<br />
(&&&) :: (b `arr` c) -> (b `arr` c') -> (b `arr` (c, c'))<br />
</haskell><br />
<br />
{{note|In versions of the <code>base</code><br />
package prior to version 4, there is no <code>Category</code> class, and the<br />
<code>Arrow</code> class includes the arrow composition operator <code>(>>>)</code>. It<br />
also includes <code>pure</code> as a synonym for <code>arr</code>, but this was removed<br />
since it conflicts with the <code>pure</code> from <code>Applicative</code>.}}<br />
<br />
The first thing to note is the <code>Category</code> class constraint, which<br />
means that we get identity arrows and arrow composition for free:<br />
given two arrows <code>g :: b `arr` c</code> and <code>h :: c `arr` d</code>, we can form their<br />
composition <code>g >>> h :: b `arr` d</code> {{noteref}}.<br />
<br />
As should be a familiar pattern by now, the only methods which must be<br />
defined when writing a new instance of <code>Arrow</code> are <code>arr</code> and <code>first</code>;<br />
the other methods have default definitions in terms of these, but are<br />
included in the <code>Arrow</code> class so that they can be overridden with more<br />
efficient implementations if desired.<br />
<br />
Note that <code>first</code> and <code>second</code> conflict with methods of the same name from <code>Data.Bifunctor</code>. If you want to use both for some reason, you will need to import one or both qualified. It used to be common to import <code>Control.Arrow</code> just to get the <code>(->)</code> instance for use in editing pairs using <code>first</code> or <code>second</code>; now it is recommended to import <code>Data.Bifunctor</code> for this purpose instead. (Notice that for the <code>(->)</code> instance of <code>Arrow</code> and the <code>(,)</code> instance of <code>Bifunctor</code>, <code>first</code> and <code>second</code> specialize to the same type.)<br />
<br />
==Intuition==<br />
<br />
Let’s look at each of the arrow methods in turn. [http://www.haskell.org/arrows/ Ross Paterson’s web page on arrows] has nice diagrams which can help<br />
build intuition.<br />
<br />
* The <code>arr</code> function takes any function <code>b -> c</code> and turns it into a generalized arrow <code>b `arr` c</code>. The <code>arr</code> method justifies the claim that arrows generalize functions, since it says that we can treat any function as an arrow. It is intended that the arrow <code>arr g</code> is “pure” in the sense that it only computes <code>g</code> and has no “effects” (whatever that might mean for any particular arrow type).<br />
<br />
* The <code>first</code> method turns any arrow from <code>b</code> to <code>c</code> into an arrow from <code>(b,d)</code> to <code>(c,d)</code>. The idea is that <code>first g</code> uses <code>g</code> to process the first element of a tuple, and lets the second element pass through unchanged. For the function instance of <code>Arrow</code>, of course, <code>first g (x,y) = (g x, y)</code>.<br />
<br />
* The <code>second</code> function is similar to <code>first</code>, but with the elements of the tuples swapped. Indeed, it can be defined in terms of <code>first</code> using an auxiliary function <code>swap</code>, defined by <code>swap (x,y) = (y,x)</code>.<br />
<br />
* The <code>(***)</code> operator is “parallel composition” of arrows: it takes two arrows and makes them into one arrow on tuples, which has the behavior of the first arrow on the first element of a tuple, and the behavior of the second arrow on the second element. The mnemonic is that <code>g *** h</code> is the ''product'' (hence <code>*</code>) of <code>g</code> and <code>h</code>. For the function instance of <code>Arrow</code>, we define <code>(g *** h) (x,y) = (g x, h y)</code>. The default implementation of <code>(***)</code> is in terms of <code>first</code>, <code>second</code>, and sequential arrow composition <code>(>>>)</code>. The reader may also wish to think about how to implement <code>first</code> and <code>second</code> in terms of <code>(***)</code>.<br />
<br />
* The <code>(&&&)</code> operator is “fanout composition” of arrows: it takes two arrows <code>g</code> and <code>h</code> and makes them into a new arrow <code>g &&& h</code> which supplies its input as the input to both <code>g</code> and <code>h</code>, returning their results as a tuple. The mnemonic is that <code>g &&& h</code> performs both <code>g</code> ''and'' <code>h</code> (hence <code>&</code>) on its input. For functions, we define <code>(g &&& h) x = (g x, h x)</code>.<br />
<br />
==Instances==<br />
<br />
The <code>Arrow</code> library itself only provides two <code>Arrow</code> instances, both<br />
of which we have already seen: <code>(->)</code>, the normal function<br />
constructor, and <code>Kleisli m</code>, which makes functions of<br />
type <code>a -> m b</code> into <code>Arrow</code>s for any <code>Monad m</code>. These instances are:<br />
<br />
<haskell><br />
instance Arrow (->) where<br />
arr :: (b -> c) -> (b -> c)<br />
arr g = g<br />
<br />
first :: (b -> c) -> ((b,d) -> (c,d))<br />
first g (x,y) = (g x, y)<br />
<br />
newtype Kleisli m a b = Kleisli { runKleisli :: a -> m b }<br />
<br />
instance Monad m => Arrow (Kleisli m) where<br />
arr :: (b -> c) -> Kleisli m b c<br />
arr f = Kleisli (return . f)<br />
<br />
first :: Kleisli m b c -> Kleisli m (b,d) (c,d)<br />
first (Kleisli f) = Kleisli (\ ~(b,d) -> do c <- f b<br />
return (c,d) )<br />
</haskell><br />
<br />
==Laws==<br />
<br />
{{note|See [http://dx.doi.org/10.1016/S0167-6423(99)00023-4 John Hughes: Generalising monads to arrows]; [http://homepages.inf.ed.ac.uk/wadler/papers/arrows/arrows.pdf Sam Lindley, Philip Wadler, Jeremy Yallop: The arrow calculus]; [http://www.soi.city.ac.uk/~ross/papers/fop.html Ross Paterson: Programming with Arrows].}}<br />
<br />
There are quite a few laws that instances of <code>Arrow</code> should<br />
satisfy {{noteref}}:<br />
<br />
<haskell><br />
arr id = id<br />
arr (h . g) = arr g >>> arr h<br />
first (arr g) = arr (g *** id)<br />
first (g >>> h) = first g >>> first h<br />
first g >>> arr (id *** h) = arr (id *** h) >>> first g<br />
first g >>> arr fst = arr fst >>> g<br />
first (first g) >>> arr assoc = arr assoc >>> first g<br />
<br />
assoc ((x,y),z) = (x,(y,z))<br />
</haskell><br />
<br />
Note that this version of the laws is slightly different than the laws given in the<br />
first two above references, since several of the laws have now been<br />
subsumed by the <code>Category</code> laws (in particular, the requirements that<br />
<code>id</code> is the identity arrow and that <code>(>>>)</code> is associative). The laws<br />
shown here follow those in Paterson’s Programming with Arrows, which uses the<br />
<code>Category</code> class.<br />
<br />
{{note|Unless category-theory-induced insomnolence is your cup of tea.}}<br />
<br />
The reader is advised not to lose too much sleep over the <code>Arrow</code><br />
laws {{noteref}}, since it is not essential to understand them in order to<br />
program with arrows. There are also laws that <code>ArrowChoice</code>,<br />
<code>ArrowApply</code>, and <code>ArrowLoop</code> instances should satisfy; the interested<br />
reader should consult [http://www.soi.city.ac.uk/~ross/papers/fop.html Paterson: Programming with Arrows].<br />
<br />
==ArrowChoice==<br />
<br />
Computations built using the <code>Arrow</code> class, like those built using<br />
the <code>Applicative</code> class, are rather inflexible: the structure of the computation<br />
is fixed at the outset, and there is no ability to choose between<br />
alternate execution paths based on intermediate results.<br />
The <code>ArrowChoice</code> class provides exactly such an ability:<br />
<br />
<haskell><br />
class Arrow arr => ArrowChoice arr where<br />
left :: (b `arr` c) -> (Either b d `arr` Either c d)<br />
right :: (b `arr` c) -> (Either d b `arr` Either d c)<br />
(+++) :: (b `arr` c) -> (b' `arr` c') -> (Either b b' `arr` Either c c')<br />
(|||) :: (b `arr` d) -> (c `arr` d) -> (Either b c `arr` d)<br />
</haskell><br />
<br />
A comparison of <code>ArrowChoice</code> to <code>Arrow</code> will reveal a striking<br />
parallel between <code>left</code>, <code>right</code>, <code>(+++)</code>, <code>(|||)</code> and <code>first</code>,<br />
<code>second</code>, <code>(***)</code>, <code>(&&&)</code>, respectively. Indeed, they are dual:<br />
<code>first</code>, <code>second</code>, <code>(***)</code>, and <code>(&&&)</code> all operate on product types<br />
(tuples), and <code>left</code>, <code>right</code>, <code>(+++)</code>, and <code>(|||)</code> are the<br />
corresponding operations on sum types. In general, these operations<br />
create arrows whose inputs are tagged with <code>Left</code> or <code>Right</code>, and can<br />
choose how to act based on these tags.<br />
<br />
* If <code>g</code> is an arrow from <code>b</code> to <code>c</code>, then <code>left g</code> is an arrow from <code>Either b d</code> to <code>Either c d</code>. On inputs tagged with <code>Left</code>, the <code>left g</code> arrow has the behavior of <code>g</code>; on inputs tagged with <code>Right</code>, it behaves as the identity.<br />
<br />
* The <code>right</code> function, of course, is the mirror image of <code>left</code>. The arrow <code>right g</code> has the behavior of <code>g</code> on inputs tagged with <code>Right</code>.<br />
<br />
* The <code>(+++)</code> operator performs “multiplexing”: <code>g +++ h</code> behaves as <code>g</code> on inputs tagged with <code>Left</code>, and as <code>h</code> on inputs tagged with <code>Right</code>. The tags are preserved. The <code>(+++)</code> operator is the ''sum'' (hence <code>+</code>) of two arrows, just as <code>(***)</code> is the product.<br />
<br />
* The <code>(|||)</code> operator is “merge” or “fanin”: the arrow <code>g ||| h</code> behaves as <code>g</code> on inputs tagged with <code>Left</code>, and <code>h</code> on inputs tagged with <code>Right</code>, but the tags are discarded (hence, <code>g</code> and <code>h</code> must have the same output type). The mnemonic is that <code>g ||| h</code> performs either <code>g</code> ''or'' <code>h</code> on its input.<br />
<br />
The <code>ArrowChoice</code> class allows computations to choose among a finite number of execution paths, based on intermediate results. The possible<br />
execution paths must be known in advance, and explicitly assembled with <code>(+++)</code> or <code>(|||)</code>. However, sometimes more flexibility is<br />
needed: we would like to be able to ''compute'' an arrow from intermediate results, and use this computed arrow to continue the computation. This is the power given to us by <code>ArrowApply</code>.<br />
<br />
==ArrowApply==<br />
<br />
The <code>ArrowApply</code> type class is:<br />
<br />
<haskell><br />
class Arrow arr => ArrowApply arr where<br />
app :: (b `arr` c, b) `arr` c<br />
</haskell><br />
<br />
If we have computed an arrow as the output of some previous<br />
computation, then <code>app</code> allows us to apply that arrow to an input,<br />
producing its output as the output of <code>app</code>. As an exercise, the<br />
reader may wish to use <code>app</code> to implement an alternative “curried”<br />
version, <code>app2 :: b `arr` ((b `arr` c) `arr` c)</code>.<br />
<br />
This notion of being able to ''compute'' a new computation<br />
may sound familiar:<br />
this is exactly what the monadic bind operator <code>(>>=)</code> does. It<br />
should not particularly come as a surprise that <code>ArrowApply</code> and<br />
<code>Monad</code> are exactly equivalent in expressive power. In particular,<br />
<code>Kleisli m</code> can be made an instance of <code>ArrowApply</code>, and any instance<br />
of <code>ArrowApply</code> can be made a <code>Monad</code> (via the <code>newtype</code> wrapper<br />
<code>ArrowMonad</code>). As an exercise, the reader may wish to try<br />
implementing these instances:<br />
<br />
<haskell><br />
class Arrow arr => ArrowApply arr where<br />
app :: (b `arr` c, b) `arr` c<br />
<br />
instance Monad m => ArrowApply (Kleisli m) where<br />
app :: Kleisli m (Kleisli m b c, b) c<br />
app = -- exercise<br />
<br />
newtype ArrowApply a => ArrowMonad a b = ArrowMonad (a () b)<br />
<br />
instance ArrowApply a => Monad (ArrowMonad a) where<br />
return :: b -> ArrowMonad a b<br />
return = -- exercise<br />
<br />
(>>=) :: ArrowMonad a a -> (a -> ArrowMonad a b) -> ArrowMonad a b<br />
(ArrowMonad a) >>= k = -- exercise<br />
</haskell><br />
<br />
==ArrowLoop==<br />
<br />
The <code>ArrowLoop</code> type class is:<br />
<br />
<haskell><br />
class Arrow a => ArrowLoop a where<br />
loop :: a (b, d) (c, d) -> a b c<br />
<br />
trace :: ((b,d) -> (c,d)) -> b -> c<br />
trace f b = let (c,d) = f (b,d) in c<br />
</haskell><br />
<br />
It describes arrows that can use recursion to compute results, and is<br />
used to desugar the <code>rec</code> construct in arrow notation (described<br />
below).<br />
<br />
Taken by itself, the type of the <code>loop</code> method does not seem to tell<br />
us much. Its intention, however, is a generalization of the <code>trace</code><br />
function which is also shown. The <code>d</code> component of the first arrow’s<br />
output is fed back in as its own input. In other words, the arrow<br />
<code>loop g</code> is obtained by recursively “fixing” the second component of<br />
the input to <code>g</code>.<br />
<br />
It can be a bit difficult to grok what the <code>trace</code> function is doing.<br />
How can <code>d</code> appear on the left and right sides of the <code>let</code>? Well,<br />
this is Haskell’s laziness at work. There is not space here for a<br />
full explanation; the interested reader is encouraged to study the<br />
standard <code>fix</code> function, and to read [http://www.soi.city.ac.uk/~ross/papers/fop.html Paterson’s arrow tutorial].<br />
<br />
==Arrow notation==<br />
<br />
Programming directly with the arrow combinators can be painful,<br />
especially when writing complex computations which need to retain<br />
simultaneous reference to a number of intermediate results. With<br />
nothing but the arrow combinators, such intermediate results must be<br />
kept in nested tuples, and it is up to the programmer to remember<br />
which intermediate results are in which components, and to swap,<br />
reassociate, and generally mangle tuples as necessary. This problem<br />
is solved by the special arrow notation supported by GHC, similar to<br />
<code>do</code> notation for monads, that allows names to be assigned to<br />
intermediate results while building up arrow computations. An example<br />
arrow implemented using arrow notation, taken from<br />
Paterson, is:<br />
<br />
<haskell><br />
class ArrowLoop arr => ArrowCircuit arr where<br />
delay :: b -> (b `arr` b)<br />
<br />
counter :: ArrowCircuit arr => Bool `arr` Int<br />
counter = proc reset -> do<br />
rec output <- idA -< if reset then 0 else next<br />
next <- delay 0 -< output + 1<br />
idA -< output<br />
</haskell><br />
<br />
This arrow is intended to<br />
represent a recursively defined counter circuit with a reset line.<br />
<br />
There is not space here for a full explanation of arrow notation; the<br />
interested reader should consult<br />
[http://www.soi.city.ac.uk/~ross/papers/notation.html Paterson’s paper introducing the notation], or his later [http://www.soi.city.ac.uk/~ross/papers/fop.html tutorial which presents a simplified version].<br />
<br />
==Further reading==<br />
<br />
An excellent starting place for the student of arrows is the [http://www.haskell.org/arrows/ arrows web page], which contains an<br />
introduction and many references. Some key papers on arrows include<br />
Hughes’ original paper introducing arrows, [http://dx.doi.org/10.1016/S0167-6423(99)00023-4 Generalising monads to arrows], and [http://www.soi.city.ac.uk/~ross/papers/notation.html Paterson’s paper on arrow notation].<br />
<br />
Both Hughes and Paterson later wrote accessible tutorials intended for a broader<br />
audience: [http://www.soi.city.ac.uk/~ross/papers/fop.html Paterson: Programming with Arrows] and [http://www.cse.chalmers.se/~rjmh/afp-arrows.pdf Hughes: Programming with Arrows].<br />
<br />
Although Hughes’ goal in defining the <code>Arrow</code> class was to<br />
generalize <code>Monad</code>s, and it has been said that <code>Arrow</code> lies “between<br />
<code>Applicative</code> and <code>Monad</code>” in power, they are not directly<br />
comparable. The precise relationship remained in some confusion until<br />
[http://homepages.inf.ed.ac.uk/wadler/papers/arrows-and-idioms/arrows-and-idioms.pdf analyzed by Lindley, Wadler, and Yallop], who<br />
also invented a new calculus of arrows, based on the lambda calculus,<br />
which considerably simplifies the presentation of the arrow laws<br />
(see [http://homepages.inf.ed.ac.uk/wadler/papers/arrows/arrows.pdf The arrow calculus]). There is also a precise technical sense in which [http://just-bottom.blogspot.de/2010/04/programming-with-effects-story-so-far.html <code>Arrow</code> can be seen as the intersection of <code>Applicative</code> and <code>Category</code>].<br />
<br />
Some examples of <code>Arrow</code>s include [https://wiki.haskell.org/Yampa Yampa], the<br />
[http://www.fh-wedel.de/~si/HXmlToolbox/ Haskell XML Toolkit], and the functional GUI library [[Grapefruit]].<br />
<br />
Some extensions to arrows have been explored; for example, the<br />
<code>BiArrow</code>s of Alimarine et al. ([http://wiki.clean.cs.ru.nl/download/papers/2005/alia2005-biarrowsHaskellWorkshop.pdf "There and Back Again: Arrows for Invertible Programming"]), for two-way instead of one-way<br />
computation.<br />
<br />
The Haskell wiki has [[Research papers/Monads and Arrows|links to many additional research papers relating to <code>Arrow</code>s]].<br />
<br />
=Comonad=<br />
<br />
The final type class we will examine is <code>Comonad</code>. The <code>Comonad</code> class<br />
is the categorical dual of <code>Monad</code>; that is, <code>Comonad</code> is like <code>Monad</code><br />
but with all the function arrows flipped. It is not actually in the<br />
standard Haskell libraries, but it has seen some interesting uses<br />
recently, so we include it here for completeness.<br />
<br />
==Definition==<br />
<br />
The <code>Comonad</code> type class, defined in the <code>Control.Comonad</code> module of<br />
the [http://hackage.haskell.org/package/comonad comonad library], is:<br />
<br />
<haskell><br />
class Functor w => Comonad w where<br />
extract :: w a -> a<br />
<br />
duplicate :: w a -> w (w a)<br />
duplicate = extend id<br />
<br />
extend :: (w a -> b) -> w a -> w b<br />
extend f = fmap f . duplicate<br />
</haskell><br />
<br />
As you can see, <code>extract</code> is the dual of <code>return</code>, <code>duplicate</code> is the dual of <code>join</code>, and <code>extend</code> is the dual of <code>(=<<)</code>. The definition of <code>Comonad</code> is a bit redundant, giving the programmer the choice on whether extend or duplicate are implemented; the other operation then has a default implementation.<br />
<br />
A prototypical example of a <code>Comonad</code> instance is:<br />
<br />
<haskell><br />
-- Infinite lazy streams<br />
data Stream a = Cons a (Stream a)<br />
<br />
-- 'duplicate' is like the list function 'tails'<br />
-- 'extend' computes a new Stream from an old, where the element<br />
-- at position n is computed as a function of everything from<br />
-- position n onwards in the old Stream<br />
instance Comonad Stream where<br />
extract :: Stream a -> a<br />
extract (Cons x _) = x<br />
<br />
duplicate :: Stream a -> Stream (Stream a)<br />
duplicate s@(Cons x xs) = Cons s (duplicate xs)<br />
<br />
extend :: (Stream a -> b) -> Stream a -> Stream b<br />
extend g s@(Cons x xs) = Cons (g s) (extend g xs)<br />
-- = fmap g (duplicate s)<br />
</haskell><br />
<br />
==Further reading==<br />
<br />
Dan Piponi explains in a blog post what [http://blog.sigfpe.com/2006/12/evaluating-cellular-automata-is.html cellular automata have to do with comonads]. In another blog post, Conal Elliott has examined [http://conal.net/blog/posts/functional-interactive-behavior/ a comonadic formulation of functional reactive programming]. Sterling Clover’s blog post [http://fmapfixreturn.wordpress.com/2008/07/09/comonads-in-everyday-life/ Comonads in everyday life] explains the relationship between comonads and zippers, and how comonads can be used to design a menu system for a web site.<br />
<br />
Uustalu and Vene have a number of papers exploring ideas related to comonads and functional programming:<br />
* [http://dx.doi.org/10.1016/j.entcs.2008.05.029 Comonadic Notions of Computation]<br />
* [http://www.ioc.ee/~tarmo/papers/sfp01-book.pdf The dual of substitution is redecoration] (Also available as [http://www.cs.ut.ee/~varmo/papers/sfp01-book.ps.gz ps.gz].)<br />
* [http://dx.doi.org/10.1016/j.ic.2005.08.005 Recursive coalgebras from comonads]<br />
* [http://www.fing.edu.uy/~pardo/papers/njc01.ps.gz Recursion schemes from comonads]<br />
* [http://cs.ioc.ee/~tarmo/papers/essence.pdf The Essence of Dataflow Programming].<br />
<br />
Gabriel Gonzalez's [http://www.haskellforall.com/2013/02/you-could-have-invented-comonads.html Comonads are objects] points out similarities between comonads and object-oriented programming.<br />
<br />
The [http://hackage.haskell.org/package/comonad-transformers comonad-transformers] package contains comonad transformers.<br />
<br />
=Acknowledgements=<br />
<br />
A special thanks to all of those who taught me about standard Haskell<br />
type classes and helped me develop good intuition for them,<br />
particularly Jules Bean (quicksilver), Derek Elkins (ddarius), Conal<br />
Elliott (conal), Cale Gibbard (Cale), David House, Dan Piponi<br />
(sigfpe), and Kevin Reid (kpreid).<br />
<br />
I also thank the many people who provided a mountain of helpful<br />
feedback and suggestions on a first draft of the Typeclassopedia: David Amos,<br />
Kevin Ballard, Reid Barton, Doug Beardsley, Joachim Breitner, Andrew<br />
Cave, David Christiansen, Gregory Collins, Mark Jason Dominus, Conal<br />
Elliott, Yitz Gale, George Giorgidze, Steven Grady, Travis Hartwell,<br />
Steve Hicks, Philip Hölzenspies, Edward Kmett, Eric Kow, Serge Le<br />
Huitouze, Felipe Lessa, Stefan Ljungstrand, Eric Macaulay, Rob MacAulay, Simon Meier,<br />
Eric Mertens, Tim Newsham, Russell O’Connor, Conrad Parker, Walt<br />
Rorie-Baety, Colin Ross, Tom Schrijvers, Aditya Siram, C. Smith,<br />
Martijn van Steenbergen, Joe Thornber, Jared Updike, Rob Vollmert,<br />
Andrew Wagner, Louis Wasserman, and Ashley Yakeley, as well as a few<br />
only known to me by their IRC nicks: b_jonas, maltem, tehgeekmeister,<br />
and ziman. I have undoubtedly omitted a few inadvertently, which in<br />
no way diminishes my gratitude.<br />
<br />
Finally, I would like to thank Wouter Swierstra for his fantastic work<br />
editing the Monad.Reader, and my wife Joyia for her patience during<br />
the process of writing the Typeclassopedia.<br />
<br />
=About the author=<br />
<br />
Brent Yorgey ([http://byorgey.wordpress.com/ blog], [http://www.cis.upenn.edu/~byorgey/ homepage]) is (as of November 2011) a fourth-year Ph.D. student in the [http://www.cis.upenn.edu/~plclub/ programming languages group] at the [http://www.upenn.edu University of Pennsylvania]. He enjoys teaching, creating EDSLs, playing Bach fugues, musing upon category theory, and cooking tasty lambda-treats for the denizens of #haskell.<br />
<br />
=Colophon=<br />
<br />
The Typeclassopedia was written by Brent Yorgey and initially published in March 2009. Painstakingly converted to wiki syntax by [[User:Geheimdienst]] in November 2011, after asking Brent’s permission.<br />
<br />
If something like this TeX to wiki syntax conversion ever needs to be done again, here are some vim commands that helped:<br />
<br />
* <nowiki>%s/\\section{\([^}]*\)}/=\1=/gc</nowiki><br />
* <nowiki>%s/\\subsection{\([^}]*\)}/==\1==/gc</nowiki><br />
* <nowiki>%s/^ *\\item /\r* /gc</nowiki><br />
* <nowiki>%s/---/—/gc</nowiki><br />
* <nowiki>%s/\$\([^$]*\)\$/<math>\1\\ <\/math>/gc</nowiki> ''Appending “\ ” forces images to be rendered. Otherwise, Mediawiki would go back and forth between one font for short <nowiki><math></nowiki> tags, and another more TeX-like font for longer tags (containing more than a few characters)""<br />
* <nowiki>%s/|\([^|]*\)|/<code>\1<\/code>/gc</nowiki><br />
* <nowiki>%s/\\dots/.../gc</nowiki><br />
* <nowiki>%s/^\\label{.*$//gc</nowiki><br />
* <nowiki>%s/\\emph{\([^}]*\)}/''\1''/gc</nowiki><br />
* <nowiki>%s/\\term{\([^}]*\)}/''\1''/gc</nowiki><br />
<br />
The biggest issue was taking the academic-paper-style citations and turning them into hyperlinks with an appropriate title and an appropriate target. In most cases there was an obvious thing to do (e.g. online PDFs of the cited papers or CiteSeer entries). Sometimes, however, it’s less clear and you might want to check the<br />
[[Media:Typeclassopedia.pdf|original Typeclassopedia PDF]]<br />
with the<br />
[http://code.haskell.org/~byorgey/TMR/Issue13/typeclassopedia.bib original bibliography file].<br />
<br />
To get all the citations into the main text, I first tried processing the source with TeX or Lyx. This didn’t work due to missing unfindable packages, syntax errors, and my general ineptitude with TeX.<br />
<br />
I then went for the next best solution, which seemed to be extracting all instances of “\cite{something}” from the source and ''in that order'' pulling the referenced entries from the .bib file. This way you can go through the source file and sorted-references file in parallel, copying over what you need, without searching back and forth in the .bib file. I used:<br />
<br />
* <nowiki>egrep -o "\cite\{[^\}]*\}" ~/typeclassopedia.lhs | cut -c 6- | tr "," "\n" | tr -d "}" > /tmp/citations</nowiki><br />
* <nowiki>for i in $(cat /tmp/citations); do grep -A99 "$i" ~/typeclassopedia.bib|egrep -B99 '^\}$' -m1 ; done > ~/typeclasso-refs-sorted</nowiki><br />
<br />
[[Category:Applicative Functor]]<br />
[[Category:Arrow]]<br />
[[Category:Functor]]<br />
[[Category:Monad]]<br />
[[Category:Standard classes]]<br />
[[Category:Standard libraries]]<br />
[[Category:Standard packages]]<br />
[[Category:Standard types]]</div>Ysangkokhttps://wiki.haskell.org/index.php?title=Regular_expressions&diff=63002Regular expressions2019-08-15T19:20:07Z<p>Ysangkok: fix gmane links using archive.fo</p>
<hr />
<div>[[Category:Libraries]]<br />
<br />
== Overview ==<br />
<br />
Chris Kuklewicz has developed a regular expression library for Haskell that has been implemented with a variety of backends. Some of these backends are native Haskell implementations, others are not and rely on external C libraries such libpcre. New users may feel overwhelmed with the various options that are available to them. The following table provides an overview of the various features supported by each backend.<br />
<br />
There are also a number of alternate or complementary regular expression libs, including:<br />
<br />
* Bryan O'Sullivan's text-icu – bindings to the [http://site.icu-project.org/ ICU library], which includes Perl compatible regexes with extended Unicode support. One of few regex libraries working with Text and not String.<br />
* Yoshikuni Jujo's regexpr - Regular expression library like Perl and Ruby's regular expressions<br />
* Don Stewarts's pcre-light - A small, efficient and portable regex library for Perl 5 compatible regular expressions<br />
* Martin Sulzmann's regexpr-symbolic - Equality, containment, intersection among regular expressions via symbolic manipulation<br />
* Matt Morrow's regexqq - A quasiquoter for PCRE regexes<br />
* Uwe Schmidt's hxt-regex-xmlschema - supports full W3C XML Schema regular expressions inclusive all Unicode character sets and blocks. A tutorial is available at [[Regular expressions for XML Schema]].<br />
<br />
{| border="1" cellspacing="0" cellpadding="5" <br />
|+ Feature Matrix of Backends<br />
! Backend<br />
! Grouping?<br />
! POSIX/Perl<br />
! Speed<br />
! Native Impl?<br />
! Stable?<br />
! Lazy?<br />
! Comments<br />
|-<br />
| regex-posix<br />
| Yes<br />
| POSIX<br />
| very slow<br />
| No<br />
| Yes<br />
| No<br />
|<br />
|-<br />
| regex-parsec<br />
| Yes<br />
| POSIX,Perl<br />
| slow<br />
| Yes<br />
| Yes<br />
| ?<br />
|<br />
|-<br />
| regex-tre<br />
| Yes<br />
| POSIX<br />
| fast<br />
| No<br />
| No<br />
| ?<br />
| uses buggy libtre (v0.7.5)<br />
|-<br />
| regex-tdfa<br />
| Yes<br />
| POSIX<br />
| fast<br />
| Yes<br />
| Yes<br />
| Yes<br />
| full Posix compliance<br />
|-<br />
| regex-pcre<br />
| Yes<br />
| Perl<br />
| fast<br />
| No<br />
| Yes<br />
| ?<br />
|<br />
|-<br />
| regex-pcre-builtin<br />
| Yes<br />
| Perl<br />
| fast<br />
| No<br />
| Yes <br />
| ?<br />
|<br />
|-<br />
| regex-dfa<br />
| No<br />
| POSIX<br />
| fast<br />
| Yes<br />
| Yes<br />
| ?<br />
| <br />
|-<br />
| regexpr<br />
| Yes<br />
| Perl<br />
| ?<br />
| Yes<br />
| Yes<br />
| ?<br />
| easier for newcomers from other languages; 0.5.1 leaks memory in some cases<br />
|}<br />
<br />
'''Note:''' speed is something that should be benchmarked by the actual user, since<br />
the story changes so much with the task, new GHC, compiler flags, etc. <br />
The algorithm used may be a useful thing (backtracking vs NFA/DFA).<br />
<br />
All support String, (Seq Char), ByteString, and (except for regex-posix) ByteString.Lazy.<br />
<br />
All are available from [http://hackage.haskell.org/packages/archive/pkg-list.html#cat:Text Hackage] as tar.gz sources and from [http://darcs.haskell.org/packages/regex-unstable/ darcs].<br />
<br />
=== regex-base ===<br />
<br />
This package exports Text.Regex.Base which re-exports Text.Regex.RegexLike and Text.Regex.Context. These do not provide the ability to do matching, but provide the type classes which all the other regex-* backends use.<br />
<br />
The backend packages also import the utility module Text.Regex.Impl to streamline instance declarations.<br />
<br />
The 0.71 version has a "tail" bug in one of the instances of RegexLike:<br />
<haskell><br />
instance (RegexLike a b) => RegexContext a b (MatchResult b) where <br />
</haskell><br />
which I hope to be fixed in ghc 6.6.1. Getting the unstable version of regex-base also fixes this, though you will have to get and re-compile all the other regex-* modules as well.<br />
<br />
The versions of the regex-* backends that come with GHC 6.6 do not re-export the RegexLike classes, so the usage of regex-BACKEND is<br />
<haskell><br />
import Text.Regex.Base<br />
import Text.Regex.BACKEND<br />
</haskell><br />
The versions in unstable are being upgraded to re-export RegexLike, so the usage will be simplified to<br />
<haskell><br />
import Text.Regex.BACKEND<br />
</haskell><br />
<br />
The 0.71 version of regex-base only has Extract instances for [Char] and ByteString. The unstable version also provides instances of ByteString.Lazy and (Seq Char). This Extract support must be accompanied by adding support to each regex-* backend in unstable, and that work is in progress.<br />
<br />
The RegexMaker class in v0.71 had no way to gracefully report errors in parsing the regular expression itself. This was a design mistake and has been extended in the unstable version of regex-base to provide monadic version which can fail gracefully.<br />
<br />
The RegexLike class only provides support for positions in the source text indexed by Int. I am still considering how to provide Int64 support. The best way is probably going to be another class, which will allow for more generalized index type support. Different backends will, by necessity, have different instances for extended index types.<br />
<br />
=== regex-tdfa ===<br />
<br />
Chris Kuklewicz has just released <code>regex-tdfa</code>, (Tagged Deterministic Finite Automata), a new library that works with GHC, the most recent being ghc-6.10.1. It is POSIX compliant and tested against <br />
[http://www2.research.att.com/~astopen/testregex/testregex.html the AT&T tests].<br />
<br />
This is available on hackage at [http://hackage.haskell.org/cgi-bin/hackage-scripts/package/regex-tdfa regex-tdfa] and via [http://darcs.haskell.org/packages/regex-unstable/regex-tdfa/ darcs].<br />
<br />
The [http://darcs.haskell.org/packages/regex-unstable/regex-tdfa/doc/html/regex-tdfa/Text-Regex-TDFA.html haddock documentation] is also on the darcs site.<br />
<br />
This uses a tagged DFA like the TRE c-library to provide efficient Posix matching. It also defaults to true Posix submatch capture (including ambiguous *-operator subpatterns), but this extra effort can be disabled.<br />
<br />
The versions from 0.90 and up use mutable ST arrays to keep track of data during matching and have thus have both decent speed and decent memory performance. Previous versions drove the memory use too high, overworking the garbage collector.<br />
<br />
The versions from 1.0.0 and up improve the algorithm. The search time is now O(N) for text of length N in the worst case, while still providing correct POSIX capturing and while running in bounded space.<br />
<br />
By disabling submatch capture (see the <code>captureGroups</code> field of <code>ExecOptions</code>) this library avoids the extra work and should run faster ("non capture" case, this is also used if there are no parenthesis in the regular expression). By running in single line mode (see the <code>CompOptions</code>) and with a leading ^ anchor this library also avoids extra work and should run faster ("front achored" case). Doing both optimization should run faster still.<br />
<br />
Just testing for a match stops at the shortest found match and should be fast (using matchTest or match/mathM for a Bool output), and this also tries to optimize for the "front anchored" case.<br />
<br />
The major advantage over pcre is avoidance of exponential blowup for certain patterns: asymptotically, the time required to match a pattern against a string is always linear in length of the string. This O(N) scaling is [http://archive.fo/LUPTs now achieved] even in the worst case and when returning the correct Posix captures.<br />
<br />
As of version 1.1.1 the following GNU extensions are recognized, all anchors:<br />
<br />
<pre><br />
\` at beginning of entire text<br />
<br />
\' at end of entire text<br />
<br />
\< at beginning of word<br />
<br />
\> at end of word<br />
<br />
\b at either beginning or end of word<br />
<br />
\B at neither beginning nor end of word <br />
</pre><br />
<br />
The above are controlled by the 'newSyntax' Bool in 'CompOption'.<br />
<br />
=== regex-posix ===<br />
<br />
See [[Regex Posix]] for bug reports relating to your operating system.<br />
<br />
This backend provides a Haskell interface for the "posix" c-library that comes with most operating systems, and is provided by '''include "regex.h"'''. This c-library probably also drives command line utilities such as sed and grep.<br />
<br />
"Posix" is in quotes since it is often not fully Posix compliant and may be buggy (as on OS X, where the bug also affects sed).<br />
<br />
And the c-library has what I call impossibly-slow performance, as in at least 100x slower than other regex engines.<br />
<br />
The goal of regex-tdfa is to create a replacement for regex-posix to accompany a future version of GHC.<br />
<br />
=== regex-compat ===<br />
<br />
This takes regex-posix and presents a Text.Regex api that mirrors the one that came with GHC 6.4.x for compatibility.<br />
<br />
=== regex-pcre ===<br />
<br />
This wraps the pcre c-library from http://www.pcre.org and gives all the Perl regular expression syntax you might want. This is especially efficient with Data.ByteString.<br />
<br />
=== regex-pcre-builtin ===<br />
<br />
This is the same as regex-pcre, but comes bundled with a version of the pcre C library.<br />
<br />
=== pcre-light ===<br />
<br />
Another FFI binding to PCRE; Don Stewart's pcre-light is intended to be "A light regular expression library, using Perl 5 compatible regexes", with support for Strings and strict ByteStrings. It is available on [http://hackage.haskell.org/cgi-bin/hackage-scripts/package/pcre-light Hackage], or through a [http://code.haskell.org/~dons/code/pcre-light/ Darcs repo]; see also the [http://www.haskell.org/pipermail/haskell/2008-January/020120.html original announcement].<br />
<br />
=== regex-tre ===<br />
<br />
This wraps the TRE c-library from http://laurikari.net/tre/ which provides Posix regular expressions. The current 0.7.5 version of TRE is buggy, however, so you should avoid this library unless you test your regular expressions to ensure you avoid the bugs.<br />
<br />
The author of TRE is currently working to fix these bugs.<br />
<br />
Also, the Posix compliance in 0.7.5 fails for *-operators with ambiguous captures.<br />
<br />
=== regex-dfa ===<br />
<br />
This is the only LGPL backend, as it is derived from [http://www.cse.unsw.edu.au/~chak/haskell/ctk/ CTKLight]. The stable version has had a bad bug on *-operators around patterns that could accept zero characters. The unstable version will have this issue fixed.<br />
<br />
This library provides no submatch captures, but is very fast at finding the Posix leftmost longest match.<br />
<br />
=== regex-parsec ===<br />
<br />
This backend can either find the left-biased match like Perl or the longest match like Posix. It uses Parsec as a backtracking matching engine and is quite slow.<br />
<br />
The submatches returned in longest match mode maximize the length of the captured texts instead of the subpatterns, and this is a divergence from the Posix specification.<br />
<br />
==Documentation==<br />
<br />
Coming soonish. There is also a great tutorial for using (=~) and (=~~) at [http://www.serpentine.com/blog/2007/02/27/a-haskell-regular-expression-tutorial/ this blog post.]<br />
<br />
A commentary on regex-posix bugs has been started at [[Regex_Posix]] in support of the regex-posix-unittest package.<br />
<br />
A commentary on the design and internals of such Posix engines has been started at [[Regex_TDFA]] mainly describing the regex-tdfa package.<br />
<br />
==Link to article on DFA==<br />
There is an article by Russ Cox [http://swtch.com/~rsc/regexp/regexp1.html on Thompson Non-Finite Automata] which presents the DFA algorithm and shows it to be faster than backtracking (the method used in perl, ruby, python).<br />
<br />
The original version of the above article is slightly incomplete advocacy. I will explain in the (apples|oranges) section below [[User:ChrisKuklewicz|ChrisKuklewicz]] 15:56, 30 January 2007 (UTC)<br />
<br />
== (apple|orange) ==<br />
<br />
As Haskell is all about making data more strongly typed, I want to make the point that there are two popular Types of regular expressions in existence. Just as all String's are not the same Type, such as some may be escaped or encoded versions or hold data printed in different formats, a regular expressions like "a?a" means two different things depending on its actual Type.<br />
<br />
And this difference is very close to another thing that Haskell and functional programming emphasize : declarative programming (what) as opposed to imperative programming (how).<br />
<br />
I will call the two Types of regular expressions ''Posix'' and ''Perl''.<br />
<br />
;Posix Regular Expressions<br />
:This is the declarative approach to regular expressions. The correct match of a regexp to a string of text starts at the leftmost possible position; there are no valid matches that can start before it. Of the possible matches that start at this leftmost position, the one that matches the longest substring is the correct match.<br />
:How this match is found is immaterial to this definition of the correct match.<br />
:Here and for the rest for the rest of this page I mean Posix to be modern "Posix Extended Regular Expressions" and never the older "Posix Basic Regular Expressions".<br />
<br />
;Perl Regular Expressions<br />
:This is the imperative approach to regular expressions. The correct match of a regexp to a string of text starts at the leftmost possible position; there are no valid matches that can start before it. To choose the correct match that starts at this position match parts of the regexp against the text until the first match is found. Specifically you must try left branches of '|' before right branches, and treat '?' '*' and '+' as greedy. Greedy means to match as many iterations, and only backing off the number of repetitions if no complete match is possible.<br />
:The first match found may not be the longest, and it may not be the shortest. It is the left-biased choice.<br />
:This definition of a correct match is identical description of how a backtracking implementation would operate.<br />
<br />
To find a Perl match you usually do what Perl (and Python, and Java, etc.) do, which is try the left branches and greedy repetition first, then backtrack until the first answer is found. The number of path is the multiplication of alternatives. So "a?" repeated 'n' times has 2<sup>n</sup> paths.<br />
<br />
To find a Posix match you must try all possible matches from a starting point and pick the longest, moving on the next starting point if there was not match. If you must backtrack and check each path separately this will take exponential time. To avoid this you construct an automata (NFA or DFA) and then you can check "a?" repeated n times in polynomial time (I think it is O(n<sup>2</sup>) for NFA, O(n) for DFA). You don't have to use an automata; you can write a (slow) Posix engine using backtracking.<br />
<br />
<br />
Perl has an obvious and easy to implement "right-bias" variant that is the mirror image. And Posix has an obvious and easy to implement "shortest match".<br />
<br />
In Posix, declaring you want to match "a|b" is always exactly the same as "b|a". Where in Perl these can be very different instructions.<br />
<br />
When writing a Perl regexp you may want more imperative control. So there are ''lazy'' variants '??' and '+?' and '*?' which are non-greedy and try the fewest number of repetitions first. And at least Java add ''posessive'' variants '?+' and '++' and '*+' that try the largest number of iterations that locally match, but will not backtrack to fewer repetitions; thus removing many possible paths to try from the search space. And Perl introduced ''lookahead'' assertions, where the engine checks if the future text a point matches or fails to match a nested regular expression. After a while these extensions comprise a whole imperative parsing language expressed in the form a single complicated string. So to make it easier to read Perl introduced comments and a whitespace ignoring mode that let you write better documented regular expressions. And it lets you (especially in Perl 6) embed fragments of Perl into the regular expressions. So Perl regexps give you a tremendous amount of power in how to find the match, which translates into power (for the expert) in defining what the match will be.<br />
<br />
With Perl there is a unique first match, so knowing what the parenthesized subgroups matched is easy. In Posix there can several ambiguous ways to match the same longest answer. Two examples:<br />
* "12" =~ "(..)|(.)(.)" could match<br />
** \0 = "12", \1 = "12", \1 = no match, \2 = no match<br />
** \0 = "12", \1 = no match, \1="1", \2 = "2"<br />
* "12" =~ "(.?)*" could match<br />
** \0 = "12", \1 = "" (empty match)<br />
** \0 = "12", \1 = "2"<br />
And the Posix standard requires a left bias in the first example and the non-empty final iteration in the second example. So "a|b" and "b|a" are distinguishable if there are ambiguous ways to match and these ambiguities affect the captured subgroups.<br />
<br />
About the paper in the above section: It never mentions the difference between longest versus leftmost meaning of regular expressions. Replacing the Perl engine with a Posix DFA will simply break many carefully crafted regular expressions. I do not know if the engine Russ Cox touts that was written 20 years ago by Pike implements Posix or Perl semantics. If it finds the longest match (Posix) then it is no help in replacing the default engine in a language like Perl. If it does efficiently find the left-biased match then it would be possible. The comparison to Ville Laurikari's work is not encouraging in this regard since Ville's system finds the longest match and not the left-biased one.<br />
<br />
== Bounded space Posix proposal ==<br />
<br />
For further discussions, Chris has posted his [[/Bounded space proposal|bounded space proposal]] for Posix algorithms. This is also a part of the discussion at a thread on [http://lambda-the-ultimate.org/node/2064 Lambda The Ultimate].<br />
<br />
== Sample benchmark ==<br />
The benchmark consists of matching "Hello world foo=123 whereas bar=456 Goodbye" against ".*foo=([0-9]+).*bar=([0-9]+).*" (as a lazy bytestring) 1mln times (along the lines of length . filter matchesPat . replicate 1000000).<br />
It has been performed on a 2x2GHz P4 machine, compiled with -O2, ghc 6.10.1.<br />
<br />
regex-pcre: 0.02s<br />
<br />
pcre-light: 0.02s<br />
<br />
regex-tdfa 1.0.0 (no compiler bug): 0.03s<br />
<br />
regex-dfa 0.91: 5.4s<br />
<br />
regex-posix: 20s<br />
<br />
regex-tdfa 1.0.0 (most probably compiler bug): 89s<br />
<br />
In all cases, the pattern is compiled only once.<br />
<br />
WARNING: This result of 97s may be the result of a compiler bug that probably may cause the pattern to be compiled at every match invocation; without that bug, regex-tdfa performs extremely well. Please see ticket http://hackage.haskell.org/trac/ghc/ticket/3059 <br />
<br />
UNWARNING: The code for regex-tdfa 1.0.0 is being improved. In particular the slow 89s is probably real. But it need not be so. The upcoming version runs in less than 0.2 seconds.<br />
<br />
Thus, for patterns as simple as this one, it is appropriate to use pcre.<br />
For patterns where the Perl-style strategy of backtracking causes exponential backtracking blowup, it is appropriate to use regex-dfa or regex-tdfa.</div>Ysangkokhttps://wiki.haskell.org/index.php?title=Haskell_logos/New_logo_ideas&diff=63001Haskell logos/New logo ideas2019-08-15T19:19:31Z<p>Ysangkok: fix gmane links using archive.fo</p>
<hr />
<div>== The great 2009 Haskell logo contest ==<br />
<br />
The Haskell logo has [http://www.willamette.edu/~fruehr/logos/intro.html changed over time], and the current "new" logo reflects the<br />
advanced features of Haskell. However, it is looking rather dated, and doesn't necessarily reflect the mature Haskell we have now.<br />
<br />
So, time to find a new logo. Something reflecting the modern emphasis of<br />
Haskell on purity and simplicity.<br />
<br />
=== Results ===<br />
<br />
The votes (for the first round) are in! You can view the [http://www.cs.cornell.edu/w8/~andru/cgi-perl/civs/results.pl?num_winners=1&id=E_d21b0256a4fd5ed7&algorithm=beatpath poll results] and the [http://community.haskell.org/~eelco/results.html results page (with logos)].<br />
<br />
Congratulations to Darrin Thompson (idea) and Jeff Wheeler (graphical interpretation) for creating the winning logo! The winning logo is available in multiple formats, see [[ThompsonWheelerLogo]].<br />
<br />
=== Contest ===<br />
<br />
Please submit logo-sized (not overly large) versions of your logo with optional text, with a preferably white background (such as for use on haskell.org).<br />
<br />
Please submit your entries here, and attach your name to them please. To be eligible,<br />
they will need to be visible on this page (e.g. uploaded, or link to the image). The image should be freely available (a suitable freely distributable license). Entries not displayed here won't be eligible.<br />
<br />
''The deadline for submissions is December 31, 2008, after which the top few submissions will be voted on by the community to decide a winner!''<br />
<br />
''' Adjectives '''<br />
<br />
<br />
A logo is part of a brand, and a brand is used to project an image. Therefore an important part of this exercise is deciding what image we want to project. An image can be described using a list of adjectives. So here is a sample of adjectives that we might want. This list is not exhaustive: by all means add more if you want them.<br />
<br />
''abstract, academic, accessible, accurate, adventurous, business-like, communal, complicated, dangerous, different, easy, exciting, familiar, friendly, fun, fuzzy, hard, interesting, inventive, precise, productive, profitable, reliable, revolutionary, safe, simple, strange, supportive, warm, welcoming.''<br />
<br />
I suggest that entries are accompanied by the two or three adjectives they are trying to project. [[User:PaulJohnson|PaulJohnson]]<br />
<br />
----<br />
by [[User:rherrmann@gmail.com|Ricardo Herrmann]]<br />
<br />
[[Image:Haskell_hell_heaven.png]]<br />
<p>"Haskell: From Hell to Heaven"</p><br />
<p>Shamelessly took [http://leksah.org Leksah]'s double-lambda idea, created a new version of it in Inkscape and made it aqua-like for the shiny-glossy-2.0 web world.</p><br />
<p>I think the double-lambda was a great idea. Let's kidnap it and make it Haskell's new logo ;-)</p><br />
[[Image:double_lambda.png]], or Times-based, [[Image:haskell_times.png]]<br />
<br />
----<br />
by [[User:Xyzzy]]<br />
<br />
[[Image:Haskell_logo_xyzzy.png]]<br/>Binding the theoretical sky to the solid ground in [http://book.realworldhaskell.org Real World].<br/><br />
----<br />
by [[User:Xyzzy]]<br />
<br />
[[Image:Haskell_nuclear_xyzzy.png]]<br/>Haskell, the warm fuzzy nuclear waste.<br/><br />
----<br />
by [[User:Bori vali]]<br />
<br />
[[Image:01_logo.png]]<br/><br/><br />
[[Image:02_logo.png]]<br/><br/><br />
[[Image:03_Logo.png]]<br/><br/><br />
[[Image:04_Logo.png]]<br/><br/><br />
[[Image:05_Logo.png]]<br/><br/><br />
[[Image:06_Logo.png]]<br/><br/><br />
[[Image:07_Logo.png]]<br/><br/><br />
<br />
bori vali,20:16, 29 December 2008 <br />
----<br />
<br />
My favourite one yet.<br />
<br />
Basic version:<br />
<br />
[[Image:Haskell_logo_falconnl_8_basic.png]]<br />
<br />
And on the ever-popular reflective gradient background:<br />
<br />
[[Image:Haskell_logo_falconnl_8_fancy.png]]<br />
<br />
Explanation:<br />
<br />
- It is a slightly more dynamic version of the standard lambda<br />
<br />
- In the center is a dot, which is the function composition operator<br />
<br />
- It also looks like a Y tilting to the right, which is a reference to the Y combinator.<br />
<br />
- It also looks like a figure running, a reference to Haskell's speed<br />
<br />
--[[User:FalconNL|FalconNL]] 19:44, 28 December 2008 (UTC)<br />
<br />
----<br />
<br />
[[Image:planetary_gears.png]]<br />
<br />
The inspiration for this logo is a set of planetary gears. The gears represent the compositional nature of Haskell (bigger gears made out of smaller gears). The colours of the gears are inspired by the paintings of Piet Mondrian, the well known abstract artist, and hence represent the abstract nature of Haskell. The gears are arranged into a shape which resembles a lambda, but only covertly. <br />
<br />
The image was created in inkscape and an SVG is available.<br />
<br />
[[User:bjpop|bjpop]] Sat 27 Dec 2008 22:44:15 EST<br />
<br />
----<br />
Pure Devil Haskell <br />
<br />
[[Image:Pure_Devil_Haskell.png]]<br />
<br />
The rationality behind my draft: <br />
(1) Haskell is considered powerful but feared. (2) Reversed Biblical logic: condemned to purity to be saved by monads, which according to Leibniz "are arranged by God in a perfect order which ascends to God, the supreme monad". (3) With great respect for Haskell Curry there are other people whom the language owes, thus it is only fair to encourage alternative interpretations for the name. <br />
<br />
--[[User:Jaworski|Jaworski]] 23:51, 25 December 2008 (UTC)<br />
<br />
----<br />
<br />
This ASCII logo connects Haskell to LOLz, for pure win.<br />
<br />
<pre><br />
we<br />
did<br />
it for<br />
the λulz<br />
</pre><br />
<br />
[[User:Jsnx|jsnx]] 21:18, 23 December 2008 (UTC)<br />
<br />
----<br />
<br />
Logo with a leopard in the shape of a lambda. This one is traced from a bitmap, so it doesn't look brilliant. Should this one be chosen a better one can be drawn.<br />
<br />
[[Image:Haskell_logo_ideas_7_falconnl.png]]<br />
<br />
--[[User:FalconNL|FalconNL]] 07:11, 22 December 2008 (UTC)<br />
<br />
----<br />
[[Image:lambdanimal.png|150px]]<br />
[[Image:lambdanimal_nomane.png|150px]]<br />
<br />
Strange Lambdanimal, with or without a mane. [[Media:lambdanimal.svg|SVG (inkscape)]].<br />
<br />
by [[User:Ripounet|Ripounet]] 22:24, 18 December 2008 (UTC)<br />
<br />
----<br />
[http://galois.com/~dons/images/logos/Haskell_logo.png http://galois.com/~dons/images/logos/Haskell_logo.png]<br />
<br />
Dana Herz @ Galois.<br />
<br />
----<br />
[[Image:Haskell-tao.png|Haskell as Taoism]]<br />
<br />
Playing off a recent Haskell-Cafe thread, in which programming languages were compared to religions, and Haskell was equated to Taoism. The slogan makes at least a ''little'' sense: it obviously goes with the logo, and 'Duals' are important to Cat theory, which influences Haskell strongly. [[Media:Haskell-tao.svg|SVG]] available. Font is Lucida Calligraphic, a less ubiquitous calligraphic font might be better.<br />
<br />
--[[User:Rgreayer|Rgreayer]] 15:16, 18 December 2008 (UTC)<br />
----<br />
[[Image:unsafeHaskell.png]]<br />
[[User:Beelsebob|Beelsebob]] 09:09, 18 December 2008 (UTC)<br />
<br />
----<br />
<br />
[[Image:haskell-cjay2.png]]<br />
[[User:Cjay|cjay]] 03:49, 18 December 2008 (UTC)<br />
<br />
<br />
[[Image:haskell-cjay2a.png]]<br />
[[User:Cjay|cjay]] 14:27, 18 December 2008 (UTC)<br />
<br />
<br />
[[Image:haskell-cjay2b.png]]<br />
[[User:Cjay|cjay]] 03:22, 19 December 2008 (UTC)<br />
<br />
<br />
[[Image:haskell-cjay2c.png]]<br />
[[User:Cjay|cjay]] 23:03, 19 December 2008 (UTC)<br />
<br />
<br />
Available as svg [[Media:Haskell-cjay2.svg|1]] [[Media:Haskell-cjay2a.svg|2]] [[Media:Haskell-cjay2b.svg|3]] [[Media:Haskell-cjay2c.svg|4]] (inkscape). Fonts: FreeSerif for lambda, >> and the arrow head; Impact Label for "Haskell" (1&2), SF Alien Encounters Solid (3) (all free).<br />
<br />
----<br />
<br />
My attempt at a new Haskell logo:<br />
<br />
[[Image:Haskell_jdr.png]]<br />
<br />
So I guess the standalone version would then be:<br />
<br />
[[Image:Haskell_h_jdr.png]]<br />
<br />
[http://www.voetsjoeba.com Jeroen De Ridder]<br />
<br />
----<br />
<br />
[http://galois.com/~dons/images/logo-3-curved.png http://galois.com/~dons/images/logo-3-curved.png]<br />
<br />
[http://archive.fo/x3vF5 George Pollard]<br />
<br />
----<br />
<br />
[[Image:Jeff-heard-1.png]]<br />
<br />
[http://archive.fo/9X0XB Jeff Heard]. <br />
<br />
----<br />
<br />
Here's an attempt to depict the polish, elegance, and purity of Haskell by merging the H and lambda into an iconic gem.<br />
<br />
[[Image:Haskell2v3.png]]<br />
<br />
Made in Inkscape, with an SVG available.<br />
<br />
--[[User:Chromakode|Chromakode]] 03:18, 17 December 2008 (UTC)<br />
<br />
:I love that one, hope it wins. But I can't see the lambda merged in it, where is it hidden? [[User:Ripounet|Ripounet]]<br />
<br />
:Thanks for your comment. :)<br />
:The light blue highlight of the H is in the shape of an abstract lambda. [[User:Chromakode|Chromakode]]<br />
<br />
A variation of this logo where the H is made up of two lambdas:<br />
<br />
[[Image:Haskell_logo_ideas_6_falconnl.png]]<br />
<br />
--[[User:FalconNL|FalconNL]] 00:30, 22 December 2008 (UTC)<br />
<br />
----<br />
<br />
All credit goes to Darrin Thompson for posting the ASCII inspiration for this to haskell-cafe. I, Jeff Wheeler, just mocked it up to look<br />
pretty. Here are two interpretations:<br />
<br />
[http://media.nokrev.com/junk/haskell-logos/logo1.png http://media.nokrev.com/junk/haskell-logos/logo1.png]<br />
<br />
[http://media.nokrev.com/junk/haskell-logos/logo2.png http://media.nokrev.com/junk/haskell-logos/logo2.png]<br />
<br />
Two with rounded edges:<br />
<br />
[http://media.nokrev.com/junk/haskell-logos/logo8.png http://media.nokrev.com/junk/haskell-logos/logo8.png]<br />
<br />
[http://media.nokrev.com/junk/haskell-logos/logo9.png http://media.nokrev.com/junk/haskell-logos/logo9.png]<br />
<br />
Here's a icon-sized version:<br />
<br />
[http://media.nokrev.com/junk/haskell-logos/logo4.png http://media.nokrev.com/junk/haskell-logos/logo4.png]<br />
<br />
The first two without an background:<br />
<br />
[http://media.nokrev.com/junk/haskell-logos/logo6.png http://media.nokrev.com/junk/haskell-logos/logo6.png] [http://media.nokrev.com/junk/haskell-logos/logo7.png http://media.nokrev.com/junk/haskell-logos/logo7.png]<br />
<br />
--[[User:Jeffwheeler|Jeffwheeler]] 02:42, 17 December 2008 (UTC)<br />
:Great work, very professional. I hope this one gets chosen. Is it also available as SVG? [[User:Fintanstele|Fintanstele]]<br />
----<br />
Mix and match<br />
<br />
[http://community.haskell.org/~hexpuem/logo_contest/haskell_7.png http://community.haskell.org/~hexpuem/logo_contest/haskell_7.png]<br />
<br />
[[User:NHA|NHA]]<br />
----<br />
More mix and match, borrowing bind-lambda icon, star/flower idea, and font/verbiage from other submissions...(Raspoutine Classic font, [[Media:Haskell-Symstar.svg|SVG]] available).<br />
[[Image:Haskell-Symstar.png|Haskell - Logo variant]]<br />
<br />
--[[User:Rgreayer|Rgreayer]] 21:39, 17 December 2008 (UTC)<br />
----<br />
I really like the logo above. Here are some variations. The font name is ModeNine.<br />
<br />
<br />
[[Image:Haskellvariations1.jpg|Haskell - Logo Variations A]]<br />
<br />
[[Image:Haskellvariations2.jpg|Haskell - Logo Variations B]]<br />
<br />
--[[User:Reified|Reified]] 14:48, 17 December 2008 (UTC)<br />
<br />
----<br />
<br />
A different logo idea, using toddler's letter blocks to convey the simplicity of Haskell. Exact block look and font used can be changed,<br />
but this is the basic idea.<br />
<br />
[[Image:Haskell_logo_ideas_4_falconnl.png]]<br />
<br />
--[[User:FalconNL|FalconNL]] 23:29, 16 December 2008 (UTC)<br />
<br />
----<br />
<br />
[[Image:Stupidb123logo.jpg]]<br />
<br />
--[[User:Stupidb123|Stupidb123]] 12:40, 16 December 2008 (UTC)<br />
<br />
----<br />
"The lightbulb lady" (concept: a lady/lightbulb made out of an inverted lambda, hope it catches...).<br />
Font: Museo Sans 500 (free of charge, add to the cart [http://new.myfonts.com/fonts/exljbris/museo-sans/500/ here]).<br />
<br />
[[Image:The_lady.png]]<br />
<br />
-- [[User:eu-prleu-peupeu]]<br />
----<br />
Just another version of the initial spreadshirt variant. <br />
The black background is now part of the logo. The text should be optional.<br />
<br />
[[Image:haskell_spreadshirt_logo.png|400px]]<br />
<br />
[[User:Frosch03|Frosch03]] 11:41, 16 December 2008 (UTC)<br />
<br />
----<br />
<br />
Made with Inkscape. The source in SVG is available [http://www.gburri.org/bordel/logo_haskell_gburri.svg here]. Font : [http://www.dafont.com/raspoutine.font?nb_ppp=50&text=Haskell Raspoutine (free)].<br />
<br />
The idea is to hide a lambda into an elegant and colored logo.<br />
<br />
Adjectives : ''elegant'', ''fun'', ''simple''<br />
<br />
[[Image:haskel_logo_preview_gburri.png]]<br />
<br />
[[Image:haskel_logo_preview_gburri_special.png]]<br />
<br />
[[User:Gburri|Gburri]] 09:58, 16 December 2008 (UTC)<br />
<br />
----<br />
<br />
Lambdas in a circle, forming a flower. I wanted it to be easy to draw, be subtle and look nice for haskellers and non-haskellers alike. Created in inkscape using free fonts.<br />
<br />
[[Image:Haskell-flower3.png]]<br />
<br />
--[[User:Tanimoto|tanimoto]] 05:39, 19 December 2008 (UTC)<br />
<br />
----<br />
<br />
A different take on the lambda-in-a-circle logo that looks less like the Half Life logo. Probably fits better than the monadic sequence<br />
operator in my other submission.<br />
<br />
[[Image:Haskell_logo_ideas_2_falconnl.png]]<br />
<br />
Update:<br />
Slight change and added letters, this time in the free Fonce Sans [http://liquisoft.deviantart.com/art/Fonce-Sans-Regular-Trial-25092730]<br />
font. I like Officina better, but if the font has to be free this is a reasonable substitute.<br />
<br />
[[Image:Haskell_logo_idea_3_falconnl.png]]<br />
<br />
--[[User:FalconNL|FalconNL]] 08:34, 16 December 2008 (GMT +1)<br />
<br />
----<br />
<br />
Very quick attempt:<br />
<br />
[[Image:BurkeLibbey_Haskell.png]]<br />
<br />
The main font is [http://www.josbuivenga.demon.nl/diavlo.html Diavlo] (free). The lambda is in Candara, which I believe ships with Vista<br />
and/or XP. Not sure of the licensing there. If there's significant interest in this, I'll redo it as a vector graphic.<br />
<br />
-- [[User:Burke|Burke]] 02:33, 16 December 2008 (UTC)<br />
<br />
----<br />
<br />
On behalf of the Ministry of Safety and Happiness I would like to promote the meme suggesting that Haskell is the programming language of<br />
choice for the Illuminati.<br />
<br />
[[Image:Haskell proceed.png]]<br />
<br />
--[[User:CznpyHrnjwczky|CznpyHrnjwczky]] 05:31, 16 December 2008 (UTC)<br />
<br />
----<br />
<br />
More of a mascotte, though she could be used in a logo as well.<br />
<br />
This is Monica Monad, and she's a Warm Fuzzy Thing. Just giving a face to SPJ's alternative name for monads :)<br />
<br />
Her main purpose would be to present tutorials.<br />
<br />
[[Image:Monica_monad_falconnl.png]]<br />
<br />
--[[User:FalconNL|FalconNL]] 00:52, 16 December 2008 (GMT +1)<br />
<br />
----<br />
<br />
A slightly different take on the Haskell logo, as the lambda-in-a-circle looks a bit too much like the Half Life logo for my taste. This<br />
one references monads instead of lambda calculus. Three possible slogans, emphasizing the fun that comes from programming in Haskell.<br />
Number 2 and 3 also reference function composition. Number 3 is my personal favourite.<br />
<br />
[[Image:Haskell_logo_ideas_falconnl.png]]<br />
<br />
Update: a combination of my two logos on a t-shirt. This time with function arrows to indicate the causal relationships: because Haskell is<br />
pure, it's simple. Because it's simple, it's fun.<br />
<br />
[[Image:Haskell_logo_ideas_tshirt_falconnl.png]]<br />
<br />
--[[User:FalconNL|FalconNL]] 22:58, 15 December 2008 (GMT +1)<br />
<br />
: Yummy. What's the font? Is it free? [[User:Porges|Porges]] 21:59, 15 December 2008 (UTC)<br />
: Unfortunately, no. The font is called Officina Sans. Is that a problem? [[User:FalconNL|FalconNL]] 00:02, 16 December 2008 (GMT +1)<br />
<br />
: I like this t-shirt a lot, but I'd change 2 things: change "simple" to "lazy" (I think "pure -> lazy -> fun" is more provocative), and change the lambda to ">>" (there are too many languages with lambda logos already). When can I place my order? :-) --[[User:Warren|Warren]] 16:32, 23 December 2008 (UTC)<br />
<br />
----<br />
<br />
Simple, clean:<br />
<br />
[http://hpsg.fu-berlin.de/~rsling/img/haskell-shirt.jpeg http://hpsg.fu-berlin.de/~rsling/img/haskell-shirt.jpeg]<br />
<br />
I really like this t-shirt logo, by the way. Gets my vote so far. — [[User:Chrisdone|Chrisdone]] 00:18, 15 December 2008 (UTC)<br />
<br />
----<br />
<br />
Minor tweak to the above:<br />
<br />
[[Image:HaskellLogo-v2.png]]<br />
<br />
----<br />
<br />
Minor modification of the t-shirt logo, the lambda was a bit skewed in my opinion:<br />
<br />
[[Image:tshirt-logo-mod.png]]<br />
<br />
And another modification of the same theme:<br />
<br />
[[Image:tshirt-logo-mod-inv.png]]<br />
<br />
--[[User:Sebastiaan|Sebastiaan]] 13:29, 15 December 2008 (UTC)<br />
: I really like this one. A font other than Arial would be nice ;) [[User:Porges|Porges]] 21:25, 15 December 2008 (UTC)<br />
<br />
[[Image:HaskellLogoTShirtWhite.png]] -- [[User:Chrisdone|Chrisdone]] 23:19, 15 December 2008 (UTC)<br />
<br />
<br />
<br />
----<br />
<br />
Some ideas. Supposed to resemble a lambda abstraction. I realise there are no formal parameters. ---- [[User:Chrisdone|Chrisdone]] 00:12,<br />
15 December 2008 (UTC)<br />
<br />
[http://chrisdone.com/haskell-blah.png http://chrisdone.com/haskell-blah-thumb.png]<br />
<br />
----<br />
<br />
Here's another one; lambda is Gentium SIL, Haskell is MgOpen Cosmetica, tagline is MgOpen Canonica Italic. [[User:Porges|Porges]] 21:25, 15<br />
December 2008 (UTC)<br />
<br />
[[Image:Haskell Logo.png]]<br />
<br />
----<br />
<br />
Another take. A bit simpler, more symmetrical.<br />
<br />
[[Image:haskelllogobeshers.png]]<br />
<br />
----<br />
<br />
[[Image:Haskell-logo.png]]<br />
<br />
The logo uses Kautiva Bold as (non-free) font.<br />
<br />
--[[User:Eelco|Eelco]] 07:43, 15 December 2008 (UTC)<br />
<br />
This one is dedicated to Derek Elkins, to sooth his eyes after having them hurt on the previous logo:<br />
<br />
[[Image:Haskell-logo-funny.png]]<br />
<br />
--[[User:Eelco|Eelco]] 08:53, 15 December 2008 (UTC)<br />
: Makes sense. Comic Sans is the *Official Font of Haskell*, after all.<br />
<br />
----<br />
[[Image:HaskellLogoTDavie.png]]<br />
<br />
[[Image:HaskellLogoTDavie.pdf]] (vector pdf version)<br />
<br />
[[Image:HaskellLogoTDavie2.png]]<br />
<br />
[[User:Beelsebob|Beelsebob]] 08:32, 15 December 2008 (UTC)<br />
<br />
---- <br />
<br />
[http://community.haskell.org/~hexpuem/logo_contest/haskell_0.png http://community.haskell.org/~hexpuem/logo_contest/haskell_0.png]<br />
<br />
[http://community.haskell.org/~hexpuem/logo_contest/haskell_1.png http://community.haskell.org/~hexpuem/logo_contest/haskell_1.png]<br />
<br />
[http://community.haskell.org/~hexpuem/logo_contest/haskell_2.png http://community.haskell.org/~hexpuem/logo_contest/haskell_2.png]<br />
<br />
[http://community.haskell.org/~hexpuem/logo_contest/haskell_3.png http://community.haskell.org/~hexpuem/logo_contest/haskell_3.png]<br />
<br />
<br />
[http://community.haskell.org/~hexpuem/logo_contest/hasksun4.png http://community.haskell.org/~hexpuem/logo_contest/hasksun4.png]<br />
<br />
[http://community.haskell.org/~hexpuem/logo_contest/hasksun6.png http://community.haskell.org/~hexpuem/logo_contest/hasksun6.png]<br />
<br />
[[User:NHA|NHA]]<br />
----<br />
<br />
<br />
Logo fun using Blender:<br />
<br />
[[Image:HsLogosMB.png|center|Haskell Logo idea with lambda as mascot]]<br />
<br />
I tried to give the lambda sign an ''alive'' feeling. --[[User:GokhanSan|GokhanSan]] 12:49, 15 December 2008 (UTC)<br />
: Middle one looks a bit too much like the ghostbusters logo :D [[User:Porges|Porges]] 21:25, 15 December 2008 (UTC)<br />
:: Hmm, I wonder if it's the choice of colors. Then again, with a minor alteration, we get a FreeBSD icon candidate:<br />
[[Image:HsLogoMB-BSD.png|beastie]] ;-) --[[User:GokhanSan|GokhanSan]] 08:52, 16 December 2008 (UTC)<br />
<br />
----<br />
<br />
[[Image:HaskellLogoIdea05.gif]]<br />
<br />
Not sure about the colour. I tried to pick the purple from the current logo. Although the lower lambda is rotated there is<br />
[http://poinikastas.csad.ox.ac.uk/browseGlyphs.shtml historic precedence] for other forms of the letter. The lambda takes the angle from<br />
the 'k'. Font is News Gothic. Feel free to play with the concept. [[User:Rk|Rk]] 11:13, 16 December 2008 (UTC)<br />
<br />
----<br />
<br />
<br />
More vectorial Haskell logo concepts. Using inkscape and the [http://inde-graphics.deviantart.com/art/advent-font-57338302 advent font] (CC at-nc-nd, by Andreas K.)<br />
<br />
[[Image:Haskell_infinitylambda.png]][[Image:Haskell_3qhalfinfinitylambda.png]]<br />
<br />
[[Image:Icon_inf.png]][[Image:Icon_lambda.png]]<br />
<br />
Vectorial images (svg):<br />
<br />
[http://haskell.org/sitewiki/images/8/86/Haskell_infinitylambda.svg 1]<br />
[http://haskell.org/sitewiki/images/6/66/Haskell_3qhalfinfinitylambda.svg 2]<br />
[http://haskell.org/sitewiki/images/d/df/Haskell_halfinfinitylambda.svg 3]<br />
<br />
Update: Added glossy styles.<br />
<br />
* [[User:alvivi|alvivi]] 19:28, 15 December 2008 (UTC)<br />
<br />
----<br />
<br />
[[Image:Haskell-pure.png|haskell::pure]]<br />
<br />
--[[User:Rgreayer|Rgreayer]] 20:44, 15 December 2008 (UTC)<br />
<br />
----<br />
<br />
Find a font where 'k' looks like a reverse lambda (after removing the "stalk"). For example:<br />
<br />
[[Image:Kaskell.png|Kaskell]]<br />
<br />
Note this example uses Monotype Corsiva which is not a free font. If the basic approach looks good, we can find a similar free font that<br />
works.<br />
<br />
--[[User:Orenbenkiki|OrenBenKiki]] 01:40, 16 December 2008 (UTC)<br />
<br />
----<br />
<br />
[http://community.haskell.org/~hexpuem/logo_contest/haskell_5.png http://community.haskell.org/~hexpuem/logo_contest/haskell_5.png]<br />
<br />
----<br />
<br />
[[Image:Haskell.png|Haskellll]]<br />
<br />
Illustrator, vector art available, apologies to GokhanSan<br />
<br />
--[[User:Mpeter|Mpeter]] 10:18, 15 December 2008 (UTC)<br />
<br />
----<br />
<br />
<br />
[http://community.haskell.org/~hexpuem/logo_contest/haskell_6.png http://community.haskell.org/~hexpuem/logo_contest/haskell_6.png]<br />
<br />
----<br />
<br />
[[Image:Haskell3.png|Haskell]]<br />
[[Image:Haskell4.png|Haskell]]<br />
<br />
Inkscape, vector art available.<br />
<br />
--[[User:Chromakode|Chromakode]] 07:14, 16 December 2008 (UTC)<br />
<br />
----<br />
<br />
I'll probably regret this...<br />
<br />
[[Image:NarleyYeeaaahh.jpg|Haskell - Narwals, YEEAAAAHH!!]]<br />
<br />
(Created with PAINT.NET)<br />
<br />
--[[User:Reified|Reified]] 07:20, 16 December 2008 (UTC)<br />
:It's a fun one but I erroneously read " Chaskell YEEAAAHH!! " [[User:Ripounet|Ripounet]]<br />
----<br />
<br />
The general idea is that it's just "Haskell" but with w lambda instead of the a. The font here is Myriad Pro but this would work with any<br />
good sans-serif font. It's color-agnostic, so it can be easily printer, presented as white on black or changed to a different color.<br />
<br />
[[Image:Haskell_logo_bonus.png]]<br />
<br />
[[Image:Haskell_logo_bonus2.png]]<br />
<br />
--[[User:BONUS|BONUS]] 14:40, 16 December 2008 (UTC)<br />
<br />
----<br />
<br />
[[image:Axman6-logo-1.0.png]]<br />
<br />
In black:<br />
<br />
[[Image:Axman6-logo-1.1.png]]<br />
<br />
[[Image:Axman6-logo-1.1-small.png]]<br />
<br />
--[[User:Axman6|Axman6]] 15:16, 16 December 2008 (UTC)<br />
<br />
----<br />
<br />
[[image:Haskell_girl.jpg]]<br />
<br />
<br />
Oh, didn't know png's would work.<br />
--[[User:Tindrum|Tindrum]] 17:12, 16 December 2008 (UTC)<br />
<br />
----<br />
<br />
[[image:Haskell_logo.png]]<br />
<br />
It is mutually recursive...<br />
Here is the [[Media:Haskell logo.svg|svg]].<br />
<br />
Second version:<br />
<br />
[[image:Haskell2_logo.png]]<br />
<br />
And the [[Media:Haskell2 logo.svg|svg]].<br />
<br />
--[[User:Trontonic|Trontonic]] 20:39, 16 December 2008 (UTC)<br />
<br />
----<br />
This is a variation on my [http://t-shirts.cafepress.com/item/lambda-revolution-fitted-tshirt/96543210 Cafepress t-shirt]. The PNG is<br />
generated from an Inkscape SVG.<br />
<br />
[[Image:Haskell-logo-revolution.png]]<br />
<br />
Adjectives: revolutionary<br />
<br />
[[User:PaulJohnson|PaulJohnson]] 21:08, 16 December 2008 (UTC)<br />
<br />
----<br />
<br />
[[Image:haskell-cjay.png]]<br />
<br />
Available as [[Media:Haskell-cjay.svg|svg]] (inkscape). Fonts: FreeSerif for lambda and >>. Bitstream Vera and FreeMono for other (afaik<br />
all free to use)<br />
<br />
[[User:Cjay|cjay]] 22:45, 16 December 2008 (UTC)<br />
<br />
----<br />
<br />
http://conal.net/Pan/Gallery/haskell-powered%20on%20white%20tiled%20360.png<br />
<br />
One I made with [http://conal.net/Pan/Gallery Pan] (purely functional image synthesis in Haskell) some years back. See also the<br />
[http://conal.net/Pan/Gallery/haskell-powered%20on%20white%20tiled%20720.png 720 square version]. I have a few sizes up to 2250 pixels<br />
square.<br />
<br />
[[User:Conal|Conal]] 03:40, 17 December 2008 (UTC)<br />
<br />
----<br />
<br />
[[image:Haskell_lambda.png]]<br />
<br />
Just kidding :P<br />
<br />
--[[User:Trontonic|Trontonic]] 05:04, 17 December 2008 (UTC)<br />
<br />
----<br />
''' Cale Gibbard '''<br />
[[Image:Haskell-logo-6up.png]]<br />
<br />
[http://haskell.org/haskellwiki/Image:Haskell-logo-6up.svg Inkscape SVG]<br />
<br />
I originally had no specific mountain in mind, but Don Stewart pointed out that this might be representative of Mt. Hood in Portland, Oregon, where Haskell was named.<br />
<br />
Regardless, I thought a summit, bathed in the pure mountain air would be a decent symbol for Haskell, the peak of contemporary programming. :)<br />
<br />
[[User:CaleGibbard|CaleGibbard]] 05:55, 17 December 2008 (UTC)<br />
:Here's a modified version with a slightly funkier font :) I think that it matches the lines of the image better... [[User:Porges|Porges]] 03:14, 18 December 2008 (UTC)<br />
<br />
[[Image:Testhask.png]]<br />
----<br />
<br />
Probably not a good choice for a logo:<br />
<br />
[[Image:Hazard lambda cracked 2.png]]<br />
<br />
----<br />
<br />
[[Image:Haskell_Ribbons.png]]<br />
<br />
[http://slipgate.za.net/~korpse/misc/Haskell_Ribbons.svg SVG]<br />
<br />
Simplicity.<br />
<br />
(It is possible that the font may need to be replaced with a free alternative.)<br />
<br />
[[User:Jonathanj|JonathanJ]] 16:34, 17 December 2008 (UTC)<br />
<br />
----<br />
<br />
[[Image:Haskelllogosmax.png]]<br />
<br />
Available as SVG.<br />
<br />
[[User:MaxRabkin|MaxRabkin]] 05:37, 18 December 2008 (UTC)<br />
<br />
----<br />
<br />
[[Image:DoHaskell.png]]<br />
<br />
Another variation for the cognicenti:<br />
<br />
[[Image:JustHaskell.png]]<br />
<br />
--[[User:Warren|Warren]] 07:26, 18 December 2008 (UTC)<br />
<br />
----<br />
<br />
A slight variation of the ">\=" logo:<br />
<br />
[[Image:haskell-logo-doublef.png]]<br />
<br />
Not that it's worth much:). Available as [[Media:haskell-logo-doublef.svg|SVG]].<br />
<br />
[[User:Doublef|DoubleF]] 07:36, 18 December 2008 (UTC)<br />
<br />
----<br />
<br />
[[Image:haskell-apankrat.png]]<br />
<br />
The idea for this [http://en.wikipedia.org/wiki/Wordmark_(graphic_identity) wordmark] is to modify ''A'' to resemble λ and through this tie together the "Haskell" to the "Lambda". Modified ''A'' also works well as a standalone logo:<br />
<br />
[[Image:haskell-symbol-apankrat.png]]<br />
<br />
Note that ''any'' logo based on the unmodified λ symbol may look ambiguous to the people outside of Haskell community. While the λ in the context of programming languages is clearly associated with functional programming, it ''is'' a lowercase Greek L and so it's reasonable for an outsider to associate it with '''L'''isp, and not Haskell.<br />
<br />
PS. I just scrolled up and saw BONUS'es entry (14:40, 16 December 2008). While its idea is close, I think using pure λ in place of an A doesn't work because it effectively turn the name into H-L-skell.<br />
<br />
[[User:Apankrat|Apankrat]] 07:38, 18 December 2008 (UTC)<br />
<br />
<br />
----<br />
A very simple logo, made with inkscape, using math fonts, with various grades (B&W, grays, fill color & gradient) and backgrounds<br />
[[Image:Simple_haskell.png]]<br />
<br />
SVG available here:<br />
[[Image:Simple haskell.svgz]]<br />
<br />
[[User:Aubanel|Aubanel]] 18:08, 18 December 2008 (UTC)<br />
<br />
<br />
<br />
----<br />
<br />
[[Image:g3634.png]]<br />
<br />
Available as Inkscape [[Media:dessin.svg|SVG]]<br />
<br />
[[Image:g4441.png]]<br />
<br />
Available as Inkscape [[Media:dessin2.svg|SVG]]<br />
<br />
[[User:runrun|runrun]] 18 December 2008<br />
<br />
----<br />
<br />
[[Image:Haskell-logo2-max.png]]<br />
<br />
Contact me for SVG. Font is not currently free, but I designed it, so this can change if it becomes "the Haskell font". I think it shows some of the elegance that Haskell has. If you like the font but can put it with a better logo, go ahead. --[[User:MaxRabkin|MaxRabkin]] 04:53, 19 December 2008 (UTC)<br />
<br />
----<br />
<br />
[[Image:sgf.png]]<br />
<br />
I think the best way to represent the pure, functional nature of Haskell is with a pure and functional logo! Something modernist, minimalist, clean and simple. I'd prefer not to put highlights of the language's syntax in the logo - that's remarkably concrete for a language good at abstraction. Even lambdas etc. should be slightly hidden - those who know what it's about can see them, and everyone else doesn't think 'what's that funny symbol?'. For the font, again, something functional like a light Helvetica or Univers.<br />
<br />
So, I thought I'd have a go at a few variations. I'm not convinced it's worked, but there you go. I've shamelessly ripped off tanimoto's idea. [[User:Sgf|Sgf]] 08:13, 19 December 2008 (UTC)<br />
<br />
* Sgf, I really like your logos and I think you captured my idea much better than I could do. I especially like the red one, a bit Escher-esque. I wonder if we could turn the blue one into something that looks more like a snowflake than it currently does. Thanks. [[User:Tanimoto|tanimoto]] 10:43, 19 December 2008 (UTC)<br />
<br />
* I also like the blue and the red logo. The resemblance of a snowflake fits the purity of the language. Perhaps you could give the lambda's more volume to make it more plate-like? [[User:Felix|Felix]]<br />
<br />
* Thanks for the comments. I'm going to be offline for about a week, so I'm not going to have a chance to knock up further variations soon, much as I would like to. So, if you have the time, feel free to generate variations from the [[Media:sgf.svg|Inkscape SVG]]. Otherwise, I'll have a go when I get back. Cheers, [[User:Sgf|Sgf]] 01:48, 20 December 2008 (UTC)<br />
<br />
[[Image:Sgf-logo-blue.png|Sgf-logo-blue]]<br />
<br />
Sgf's red logo changed to blue and with the Fonce Sans font that FalconNL has used for another logo. [[User:Felix|Felix]] 2008-12-21<br />
<br />
And another variation of Sgf's logo, this time using negative instead of positive space.<br />
<br />
[[Image:Haskell_logo_ideas_5_falconnl.png]]<br />
<br />
--[[User:FalconNL|FalconNL]] 18:13, 21 December 2008 (UTC)<br />
<br />
[[Image:sgf2.png]]<br />
<br />
A few more exploratory variants: I've had a go at closing up the center of the 'snowflake' to make it, well, snowflakier. I've tried pairing this variant up with a conservative-looking serifed font, something functional but less heavily modernist. Then I created a variant which attempts to go for a bit more of a drawn look, to combine the geometric design with some handcrafting, hinting at a combination of the pure, abstract language, but also the lively user community. I paired that with Futura, as a slightly quirky geometric sans serif. - [[User:Sgf|Sgf]] 22:39, 29 December 2008 (UTC)<br />
<br />
----<br />
<br />
[[Image:SgfRk05.gif]]<br />
<br />
Some more variants of Sgf's idea. I've uploaded the SVG version too but you'll need the fonts for it to display correctly.[[User:Rk|Rk]]<br />
----<br />
<br />
Yet another variation on tanimoto and sgf's themes, with influences from others. The intent here is fun, pure, simple, complete, intriguing, and a bit paradoxical. (The loose relation to the Cabal logo was unexpected.) Font is Free Sans, but I'd look for better if I had a bit more time.<br />
<br />
[[Image:Hs_logos_sereven.png]]<br />
<br />
The compiler sits at the core in negative space, its form suggested by what is built on and around it. Also in negative space, lambdas and reflected lambdas link the golden base library to others, pure primary colours available ready to be combined. Libraries become dimensional as they fit together like puzzle pieces. At each layer they form a whole, complete, yet extensible in all directions.<br />
<br />
[[User:sereven|sereven]] 12:24, 22 December 2008 (UTC)<br />
<br />
----<br />
λλλ<br />
<br />
Haskell The Revenge of the Nerds<br />
<br />
---<br />
<br />
[[Image:Ouroborous-oval.png|Ouroboros oval]]<br />
<br />
Paulo Tanimoto on the mailing list suggested something based on [http://www.example.com Orouboros]. Here is the [[Media:Ouroborous-oval.svg|Inkscape SVG]].<br />
<br />
Adjectives: abstract, friendly<br />
<br />
[[User:PaulJohnson|PaulJohnson]]<br />
<br />
----<br />
<br />
How about using one of the mythical birds in lambda calculus? Specifically, the ones from the article [http://users.bigpond.net.au/d.keenan/Lambda/ To Dissect a Mockingbird]. Some of the examples:<br />
<br />
http://users.bigpond.net.au/d.keenan/Lambda/Graphical_lambda2.gif (Mockingbird)<br />
<br />
http://users.bigpond.net.au/d.keenan/Lambda/Graphical_lambda6.gif (Omega bird)<br />
<br />
http://users.bigpond.net.au/d.keenan/Lambda/Graphical_lambda15.gif<br />
<br />
Since Haskell is centered around the idea of lambdas, I thought this would be a cool idea. Plus, they have qualities similar to Haskell: exotic, mysterious, abstract... [[User:Aviator|Aviator]] 12:35, 21 December 2008 (UTC)<br />
<br />
----<br />
<br />
[[Image:Origami-lamdba-supernova-warp.png|The Haskell Origami Lambda's Warp from the Supernova]]<br />
<br />
This is an H composed of two identical vertically tiled lambdas warping from a supernova. It symbolizes the warp of the Haskell-lambda away from the O of object-orientation (symbolized by the supernova).<br />
<br />
Created in Inkscape, then adjusted in GIMP. This was my first try at using both tools. I have never done graphic design before.<br />
<br />
If I have time, I may submit a revised version.<br />
<br />
Abstract. Different. Inventive.<br />
<br />
by [[User:DekuDekuplex|Benjamin L. Russell]] 22:17, 22 December 2008 (Tokyo Time)<br />
<br />
----<br />
<br />
[[Image:ClassyHLogo.png]]<br />
<br />
I created the current, apparently-much-loathed purple-and-green Haskell logo back in<br />
2004 at John Peterson's request. I actually sent him several designs, and I must admit <br />
I rather liked this one better, myself. I later included it on some of the<br />
CafePress merchandise as the "classy Haskell logo". It's main virtues are that it's <br />
sparse and abstract; it's specifically inspired by those hood ornaments you see on <br />
fancy cars (no relation to Andy Gill's Hood debugger).<br />
<br />
The fancy typeface goes a little against the grain of "sparse and abstract", but it's<br />
of course independent from the logo itself.<br />
<br />
The simplicity of the logo proper (modulo the shadow and the typeface) makes it easy to <br />
reproduce in SVG and the like.<br />
<br />
(For a brief time, this logo was available on CafePress in the form of a frisbee, er, <br />
"flying disc", but they stopped carrying the item. It has been available for a while <br />
on shirts and perhaps mugs as well.)<br />
<br />
Anyway, perhaps it will appeal to others over the current one as much as it did to me.<br />
<br />
by [[User:FritzRuehr|Fritz Ruehr]]<br />
<br />
----<br />
<br />
[[Image:Haskell_logo_by_neoneye_small.png]]<br />
<br />
Im not really a haskell coder, however i do find it a fun challenge to make a haskell logo.<br />
<br />
by [[User:Neoneye|Simon Strandgaard]]<br />
<br />
----<br />
<br />
[[Image:HHH.png]]<br />
<br />
Lambda, Is now grown up.<br />
<br />
by [[User:GreyLensman|Ray]]<br />
<br />
----<br />
<br />
[[Image:HlSlEll.png]]<br />
<br />
As proposed by FalconNL, "Pure->simple->fun(ctional)". Incorporates >>=,->,=>,::,lambda if you look hard enough. Think of the H-lambda logo as a 3D object with three legs that looks like an H from one perspective, a lambda from a perpendicular perspective, and a lowercase h from below. Feel free to [[Media:HlSlEll.svg|improve away]]...<br />
<br />
----<br />
[[Image:horizontal-logo.png]]<br />
<br />
[[Image:vertical-logo.png]]<br />
<br />
<br />
The diamond shape represents purity and strength. The logo is clean, simple, modern and to the point.<br />
<br />
I think the text should be in lowercase because it makes the name "haskell" friendlier and less threatening. See the logos of [http://www.xerox.com xerox], [http://www.att.com at&t], [http://www.intel.com intel] and even [http://www.python.org/ python] for examples of that.<br />
<br />
In regard to the adjectives, I'd say: ''friendly, modern, interesting.''<br />
<br />
by --[[User:Aparcero|Aparcero]] 23:13, 31 December 2008 (UTC)<br />
<br />
----<br />
<br />
[[Image:CarLogoHask.png]]<br />
<br />
[[Image:CarLogoHaskSmall.png]]<br />
<br />
It's a few days late but I made this years ago and thought it was relevant now... By the way note that the four circles are like the double colon :: "has type" syntax in Haskell and the empty space between the circles forms the capital H. The silver bevel effect is just a Photoshop filter and can be applied to any logo.<br />
<br />
I'm quite impressed with many of these logos on the page. Wow, Haskellers!<br />
<br />
Cheers,<br />
<br />
[[User:JaredUpdike|JaredUpdike]] 22:26, 2 January 2009 (UTC)<br />
<br />
----<br />
[[Image:Haskell2.png]]<br />
<br />
[[Image:Haskell2ico.png]]<br />
<br />
In general I'm not too keen on the use of lambda's at all, but couldn't resist the group pressure. I made it a while ago, but seems to resemble OrenBenKiki's lambda/'h' idea. <br />
<br />
[[User:Arvid|Arvid]] 23:22, 2 January 2009 (UTC)<br />
<br />
----<br />
[[Image:HaskellAmbigram.png]]<br />
<br />
I know I'm past the deadline, but I think somebody mentioned ambigrams on the mailing list. I don't think this is great as it stands, but the combination of unusual symmetry and funky font indicate Haskell's mathematical roots and fun atmosphere.<br />
--[[User:MaxRabkin|MaxRabkin]] 02:50, 20 January 2009 (UTC)<br />
<br />
----<br />
<br />
Way past the deadline, but I made this today:<br />
<br />
<pre style="font-family: monospace, Courier; font-size: 75%; line-height: 100%; text-align: center;"><br />
_____ ______ <br />
\ \\ \ <br />
\ \\ \ <br />
\ \\ \ _____________ <br />
\ \\ \\ \ <br />
\ \\ \\____________\ <br />
\ \\ \ _____________ <br />
/ // \\ \ <br />
/ // \\____________\<br />
/ // /\ \ <br />
/ // / \ \ <br />
/ // / \ \ <br />
/____//____/ \____\ <br />
_ _ _ _ _ <br />
| | | | | | | | | <br />
| |__| | __ _ ___| | _____| | | <br />
| __ |/ _` / __| |/ / _ \ | | <br />
| | | | (_| \__ \ < __/ | | <br />
|_| |_|\__,_|___/_|\_\___|_|_| <br />
</pre><br />
And I put it on my blog, Ascii Art and Haiku [http://www.asciiartandhaiku.com/].<br />
<br />
--[[User:anchpop|anchpop]]</div>Ysangkokhttps://wiki.haskell.org/index.php?title=Haskell_in_industry&diff=63000Haskell in industry2019-08-15T19:18:15Z<p>Ysangkok: fix gmane links using archive.fo</p>
<hr />
<div>__NOTOC__<br />
<br />
Haskell has a diverse range of use commercially, from aerospace and defense, to finance, to web startups, hardware design firms and a lawnmower manufacturer. This page collects resources on the industrial use of Haskell.<br />
<br />
* The main user conference for industrial Haskell use is CUFP - the [http://cufp.org/ Commercial Users of Functional Programming Workshop].<br />
* The [http://industry.haskell.org Industrial Haskell Group] supports commercial users.<br />
* There is a well-maintained (as of 2018) [https://github.com/erkmos/haskell-companies github repository] that collects information on companies using Haskell.<br />
* [http://commercialhaskell.com/ The commercial Haskell group] is a special interest group for companies and individuals interested in commercial usage of Haskell.<br />
<br />
The Reddit page [https://www.reddit.com/r/haskell/comments/377zyc/72_wouldbe_commercial_haskell_users_what_haskell/ 72 would-be commercial Haskell users: what Haskell success stories we need to see] has several stories of commercial Haskell users.<br />
<br />
== Haskell in Industry ==<br />
<br />
Many companies have used Haskell for a range of projects, including:<br />
<br />
* [http://cufp.galois.com/2007/abstracts.html#CyrilSchmidt ABN AMRO] Amsterdam, The Netherlands<br />
<blockquote><br />
ABN AMRO is an international bank headquartered in Amsterdam. For its<br />
investment banking activities it needs to measure the counterparty risk<br />
on portfolios of financial derivatives. </blockquote><br />
::ABN AMRO's [http://cufp.galois.com/2007/abstracts.html#CyrilSchmidt CUFP talk].<br />
<br />
* Aetion Technologies LLC, Columbus, Ohio<br />
<blockquote><br />
Aetion was a defense contractor in operation from 1999 to 2011, whose applications use artificial intelligence. Rapidly changing priorities make it important to minimize the code impact of changes, which suits Haskell well. Aetion developed three main projects in<br />
Haskell, all successful. Haskell's concise code was perhaps most important for<br />
rewriting: it made it practicable to throw away old code occasionally. DSELs<br />
allowed the AI to be specified very declaratively. <br />
</blockquote><br />
::Aetion's [http://cufp.galois.com/2006/slides/GaryMorris.pdf CUFP talk].<br />
<br />
* Alcatel-Lucent<br />
<blockquote><br />
A consortium of groups, including Alcatel-Lucent, have used Haskell to prototype narrowband software radio systems, running in (soft) real-time.<br />
</blockquote><br />
::Alcatel-Lucent's [http://cufp.org/conference/sessions/2011/fourteen-days-haskell-real-time-programming-projec CUFP talk]<br />
<br />
* [http://www.allstontrading.com/ Allston Trading]<br />
<blockquote><br />
Headquartered in Chicago, Illinois, Allston Trading, LLC is a premier high frequency market maker in over 40 financial exchanges, in 20 countries, and in nearly every conceivable product class. Allston makes some use of Haskell for their trading infrastructure.<br />
</blockquote><br />
<br />
* [http://www.alphaheavy.com/ Alpha Heavy Industries]<br />
<blockquote><br />
Alpha Heavy Industries is an alternative asset manager dedicated to producing superior returns through quantitative methods. They use Haskell as their primary implementation language.<br />
</blockquote><br />
<br />
* [http://www.amgen.com/ Amgen] Thousand Oaks, California<br />
<blockquote><br />
Amgen is a human therapeutics company in the biotechnology industry. Amgen pioneered the development of novel products based on advances in recombinant DNA and molecular biology and launched the biotechnology industry’s first blockbuster medicines.<br />
<br />
Amgen uses Haskell;<br />
<br />
* To rapidly build software to implement mathematical models and other complex, mathematically oriented applications<br />
* Provide a more mathematically rigorous validation of software<br />
* To break developers out of their software development rut by giving them a new way to think about software.<br />
</blockquote><br />
::Amgen's [http://cufp.galois.com/2008/abstracts.html#BalabanDavid CUFP talk].<br />
<br />
* [http://www.ansemond.com/ Ansemond LLC]<br />
<blockquote><br />
"Find It! Keep It! is a Mac Web Browser that lets you keep the pages you<br />
visit in a database. A list of these pages is shown in the 'database<br />
view'. "<br />
</blockquote><br />
<br />
* [http://antiope.com/ Antiope] Fair Haven, New Jersey<br />
<blockquote><br />
Antiope Associates provides custom solutions for wireless communication<br />
and networking problems. Our team has expertise in all aspects of<br />
wireless system design, from the physical and protocol layers to complex<br />
networked applications. Antiope Associates relies on a number of<br />
advanced techniques to ensure that the communication systems we design<br />
are reliable and free from error. We use custom simulation tools<br />
developed in Haskell, to model our hardware designs..<br />
</blockquote><br />
::Antiope's [http://cufp.galois.com/2008/slides/WrightGregory.pdf CUFP talk].<br />
<br />
* [http://antiope.com/ Antiope] Fair Haven, New Jersey<br />
<blockquote><br />
Antiope Associates provides custom solutions for wireless communication<br />
and networking problems. Our team has expertise in all aspects of<br />
wireless system design, from the physical and protocol layers to complex<br />
networked applications. Antiope Associates relies on a number of<br />
advanced techniques to ensure that the communication systems we design<br />
are reliable and free from error. We use custom simulation tools<br />
developed in Haskell, to model our hardware designs..<br />
</blockquote><br />
::Antiope's [http://cufp.galois.com/2008/slides/WrightGregory.pdf CUFP talk].<br />
<br />
* Applicative, Sydney (Australia)<br />
<blockquote><br />
Applicative has created a Haskell IDE for macOS called "[http://haskellformac.com Haskell for Mac]". It offers playgrounds to interactively work with Haskell code right next to the source files: you can draw and preview images, animations, HTML pages and more. You can also build full-fledged applications with it.<br />
</blockquote><br />
<br />
* [http://www.att.com AT&amp;T]<br />
<blockquote><br />
Haskell is being used in the Network Security division to automate processing of internet abuse complaints. Haskell has allowed us to easily meet very tight deadlines with reliable results.<br />
</blockquote><br />
<br />
* [http://www.baml.com/ Bank of America Merril Lynch]<br />
<blockquote>Haskell is being used for backend data transformation and loading.</blockquote><br />
<br />
* [http://www.haskell.org/communities/12-2007/html/report.html#sect7.1.2 Barclays Capital Quantitative Analytics Group]<br />
<blockquote><br />
Barclays Capital's Quantitative Analytics group is using Haskell to<br />
develop an embedded domain-specific functional language (called FPF)<br />
which is used to specify exotic equity derivatives. These derivatives,<br />
which are naturally best described in terms of mathematical functions,<br />
and constructed compositionally, map well to being expressed in an<br />
embedded functional language. This language is now regularly being used<br />
by people who had no previous functional language experience.<br />
</blockquote><br />
::[http://lambda-the-ultimate.org/node/3331 Simon Frankau et al's JFP paper on their use of Haskell]<br />
::[http://www.reddit.com/r/haskell/comments/1p70l3/barclays_are_hiring_haskell_developers_in_london/ Read their 2013 job advertisement]<br />
<br />
* BAE Systems<br />
<blockquote><br />
As part of the SAFE project, BAE has built a collection of compilers, interpreters, simulators, and EDSLs almost entirely in Haskell.<br />
</blockquote><br />
::[http://cufp.org/conference/sessions/2013/tom-hawkins-bae-systems-redesigning-computer-secur CUFP 2013 talk]<br />
<br />
* [http://bazqux.com BazQux Reader]<br />
<blockquote><br />
BazQux Reader is a commercial RSS reader. Its feeds and comments crawler and a part of web-server are implemented in Haskell.<br />
</blockquote><br />
<br />
* [http://better.io Better]<br />
<blockquote><br />
Better, formerly known as Erudify, is a learning company built around the mission of making people better. We are an unusual mix of a software company, a consulting firm, and a creative agency. This tight integration enables us to deliver innovative, high-quality courses to our customers.<br />
<br />
Founded in 2012, Better is based in Zurich, Switzerland and New York, USA. Better is fully invested in Haskell; Most parts of our back-end system (web-servers and learning logic) are written in Haskell. Haskell is also used in most parts of our front-end system. <br />
</blockquote><br />
<br />
* [http://www.bcode.com/ bCODE Pty Ltd] Sydney Australia<br />
<blockquote><br />
bCode Pty Ltd is a small venture capital-funded startup using Ocaml and a bit of Haskell in Sydney Australia.<br />
</blockquote><br />
<br />
* [http://bdellium.com/ Bdellium] Hawaii, United States<br />
<blockquote><br />
Bdellium develops software systems that enable companies in the financial industry to deliver new customer services that grow their business. Bdellium uses Haskell for heavy lifting analysis in back end infrastructure.<br />
</blockquote><br />
<br />
* [http://www.betterteam.com/ Betterteam] Remote<br />
<br />
<blockquote><br />
Betterteam is a recruitment platform for small businesses and growing teams. It allows employers to post their jobs to hundreds of job boards, manage candidates, and add a careers section to their website. <br />
<br />
Betterteam's backend applications are 100% Haskell and the frontend web application is written in PureScript.<br />
</blockquote><br />
<br />
* [http://www.bluespec.com/ Bluespec, Inc.] Waltham, Massachusetts<br />
<br />
<blockquote><br />
Developing a modern integrated circuit (ASIC or FPGA) is an enormously<br />
expensive process involving specification, modeling (to choose and fix the<br />
architecture), design (to describe what will become silicon) and verification<br />
(to ensure that it meets the specs), all before actually committing anything to<br />
silicon (where the cost of a failure can be tens of millions of dollars).<br />
Bluespec, Inc. is a three year-old company that provides language facilities,<br />
methodologies, and tools for this purpose, within the framework of the IEEE<br />
standard languages SystemVerilog and SystemC, but borrowing ideas heavily from<br />
Term Rewriting Systems and functional programming languages like Haskell. In<br />
this talk, after a brief technical overview to set the context, we will<br />
describe our tactics and strategies, and the challenges we face, in introducing<br />
declarative programming ideas into this field, both externally (convincing<br />
customers about the value of these ideas) and internally (using Haskell for our<br />
tool implementation). <br />
</blockquote><br />
<br />
::Bluespec's [http://cufp.galois.com/2006/abstracts.html#RishiyurNikhil CUFP talk].<br />
<br />
* [http://bu.mp/ Bump]<br />
<blockquote><br />
Bump use a Haskell-based server, [http://github.com/jamwt/Angel Angel], for process supervisor for all their backend systems, and [http://devblog.bu.mp/post/40786229350/haskell-at-bump for other infrastructure tasks].<br />
</blockquote><br />
::Haskell at [http://fpcomplete.com/downloads/bump-fp-complete-study.pdf Bump]<br />
<br />
* Capital IQ<br />
<blockquote><br />
We have been using functional programming here at S&P Capital IQ in Scala, Haskell, and our homegrown reporting language Ermine, since 2008 for financial analytics.<br />
</blockquote><br />
::[http://cufp.org/conference/sessions/2013/edward-kmett-sp-capital-iq-functional-reporting Capital IQ's CUFP 2013 talk]<br />
<br />
* [http://chordify.net Chordify]<br />
<blockquote><br />
Chordify is a free online music service that transforms music, from YouTube, Deezer, SoundCloud or uploaded files, into chords. There's an ICFP experience report explaining how Haskell is used for this:<br />
<br />
José Pedro Magalhães and W. Bas de Haas. [http://dreixel.net/research/pdf/fmmh.pdf Functional Modelling of Musical Harmony: an Experience Report]. In Proceedings of the 16th ACM SIGPLAN International Conference on Functional Programming (ICFP'11), pp. 156–162, ACM, 2011.<br />
</blockquote><br />
<br />
* [http://www.circos.com Circos Brand Karma] Singapore<br />
<blockquote><br />
Brand Karma provides services to brand owners to measure online sentiments towards their brands.<br />
Haskell is used in building parts of the product, specifically for back-end job scheduling and brand matching.<br />
</blockquote><br />
<br />
* [https://circuithub.com CircuitHub]<br />
<blockquote><br />
CircuitHub aims to be the AWS for manufacturing, enabling hardware companies and makers to instantly quote designs and scale from prototype to production. We are also proud to host a large collection of open hardware designs. CircuitHub uses Haskell for our core services and algorithms.<br />
</blockquote><br />
<br />
* [http://www.credit-suisse.com/ Credit Suisse Global Modeling and Analytics Group] London, UK; New York City, New York<br />
<br />
<blockquote><br />
GMAG, the quantitative modeling group at Credit Suisse, has been using Haskell<br />
for various projects since the beginning of 2006, with the twin aims of<br />
improving the productivity of modelers and making it easier for other people<br />
within the bank to use GMAG models. Current projects include: Further work on<br />
tools for checking, manipulating and transforming spreadsheets; a<br />
domain-specific language embedded in Haskell for implementing reusable<br />
components that can be compiled into various target forms (see the video presentation: [http://www.londonhug.net/2008/08/11/video-paradise-a-dsel-for-derivatives-pricing/ Paradise, a DSEL for Derivatives Pricing]).<br />
</blockquote><br />
<br />
::Credit Suisse's [http://cufp.galois.com/2006/abstracts.html#HowardMansell CUFP talk].<br />
<br />
* [https://www.cryptact.com/ Cryptact] Tokyo, Japan<br />
<br />
<blockquote><br />
Cryptact provides a platform for cryptocurrency investors based on our expertise in finance and technology, and is exploring the potential of Haskell in our backend services.<br />
</blockquote><br />
<br />
* [http://detexify.kirelabs.org/classify.html Detexify]<br />
<br />
<blockquote><br />
Detexify is an online handwriting recognition system, whose backend is written in Haskell. <br />
</blockquote><br />
<br />
* [http://fynder.io Fynder]<br />
<blockquote><br />
Fynder is an online booking platform.<br />
<br />
We use Haskell and clojurescript, all stitched together with nixos<br />
</blockquote><br />
<br />
::See more in their original [http://hackerjobs.co.uk/jobs/2013/9/27/digital-logistics-haskell-developer job posting].<br />
<br />
* [http://www.db.com/ Deutsche Bank Equity Proprietary Trading, Directional Credit Trading]<br />
<br />
<blockquote><br />
The Directional Credit Trading group used Haskell as the primary<br />
implementation language for its software infrastructure.<br />
</blockquote><br />
<br />
::Deutsche Bank's [http://cufp.galois.com/2008/abstracts.html#PolakowJeff CUFP talk].<br />
<br />
* [https://www.thitp.de/ Dr. Peter & Alexander Thiemann GbR]<br />
<blockquote><br />
Dr. Peter & Alexander Thiemann GbR is a software consultancy with strong focus on functional development with Haskell and hardware-software systems.<br />
</blockquote><br />
<br />
* [http://archive.fo/WEa4K Eaton] Cleveland, Ohio<br />
<br />
<blockquote><br />
Design and verification of hydraulic hybrid vehicle systems<br />
</blockquote><br />
<br />
::Eaton's [http://cufp.galois.com/2008/abstracts.html#HawkinsTom CUFP talk]<br />
::Eaton's [http://www.haskell.org/pipermail/haskell-cafe/2009-April/060602.html experiences using a Haskell DSL]<br />
<br />
* [Ericsson AB]<br />
<blockquote><br />
Ericsson uses Haskell for the implementation of Feldspar, an EDSL for digital signal processing algorithms.<br />
</blockquote><br />
<br />
::Ericsson's [http://hackage.haskell.org/package/feldspar-compiler Feldspar compiler]<br />
<br />
* [http://extensibl.com/ extensibl]<br />
<blockquote><br />
New Zealand-based company. Provides a variety of software development, consulting, operational support services worldwide. Both Haskell and Ur/Web are actively used for commercial projects.<br />
</blockquote><br />
<br />
* [http://facebook.com Facebook]<br />
<br />
<blockquote><br />
Facebook uses some Haskell internally for tools. [http://github.com/facebook/lex-pass/tree/master lex-pass] is a tool for programmatically manipulating a PHP code base via Haskell.<br />
</blockquote><br />
<br />
:: Facebook's [http://cufp.galois.com/2009/abstracts.html#ChristopherPiroEugeneLetuchy CUFP talk]<br />
:: Facebook's [http://skillsmatter.com/podcast/home/simon-marlow HaXL system] is [https://code.facebook.com/projects/854888367872565/haxl/ open source]<br />
<br />
* [http://www.factisresearch.com/ Factis Research]<br />
<blockquote><br />
Factis research, located in Freiburg, Germany, co-develops [http://www.checkpad.de Checkpad], a mobile electronic health record. Our client software runs under iOS, web browsers and Windows. The server components are implemented in 95% in Haskell. <br />
</blockquote><br />
<br />
<br />
* [http://fortytools.com fortytools gmbh]<br />
<blockquote><br />
Located in Hamburg, Germany, we are developing web-based productivity tools for invoicing, customer management, resource scheduling and time tracking. While using Javascript for building rich frontend application in the browser, we use Haskell to implement the REST backends. Additionally, we do occasional project/client work as well.<br />
</blockquote><br />
<br />
:: Oh, and of course we develop and maintain [http://hayoo.info Hayoo!] :)<br />
<br />
<br />
* [http://www.functor.se/ Functor AB], Stockholm, Sweden<br />
<blockquote><br />
Functor AB offers new tools for ground-breaking static analysis with pre-test case generation of programs to eliminate defects and bugs in software very early in development. <br />
<br />
Functor collaborates with the JET fusion reactor run by EFDA CCFE. JET is currently the largest reactor in the world of its kind. At Functor, almost all development is done in Haskell but also to some extent also C and Scala.<br />
</blockquote><br />
<br />
:: See more in the Functor AB [http://alpmestan.com/posts/2012-10-23-haskell-job-opening-at-functor.html job advertisement]<br />
<br />
* [http://www.funktional.info/index.php?id=7&L=1 Funktionale Programmierung Dr. Heinrich Hördegen], Munich, Germany<br />
<blockquote><br />
We develop software prototypes according to the Pareto principle: After spending only 20 percent of budget, we aim to provide already 80 percent of the software's functionality. We can realize this by constructing a 2080-software-prototype that we can further develop into a full-fledged solution...<br />
</blockquote><br />
<br />
* [http://www.galois.com/ Galois, Inc] Portland, Oregon<br />
<br />
<blockquote><br />
Galois designs and develops high confidence software for critical applications.<br />
Our innovative approach to software development provides high levels of<br />
assurance, yet its scalability enables us to address the most complex problems.<br />
We have successfully engineered projects under contract for corporations and<br />
government clients in the demanding application areas of security, information<br />
assurance and cryptography. <br />
</blockquote><br />
<br />
::Galois' [http://cufp.galois.com/2007/abstracts.html#JohnLaunchbury 2007 CUFP talk]<br />
::Galois' [http://cufp.org/conference/sessions/2011/theorem-based-derivation-aes-implementation 2011 CUFP talk]<br />
::Galois' [http://corp.galois.com/blog/2009/4/27/engineering-large-projects-in-haskell-a-decade-of-fp-at-galo.html retrospective on 10 years of industrial Haskell use]<br />
<br />
* [http://google.com Google]<br />
<br />
<blockquote><br />
Haskell is used on a small number of internal projects in Google, for internal IT infrastructure support, and the open-source [http://code.google.com/p/ganeti/ Ganeti] project. Ganeti is a tool for managing clusters of<br />
virtual servers built on top of Xen and KVM.<br />
</blockquote><br />
<br />
::Google's [http://k1024.org/~iusty/papers/icfp10-haskell-reagent.pdf ICFP 2010 experience report on Haskell]<br />
::Video from ICFP [http://vimeo.com/12849320 Project Ganeti at Google]<br />
<br />
* [http://glyde.com/ Glyde]<br />
<br />
<blockquote><br />
Glyde uses OCaml and Haskell for a few projects. Glyde uses Haskell for our client-side template source-to-source translator, which converts HAML-like view templates into JS code.<br />
</blockquote><br />
<br />
* [http://groupcommerce.com Group Commerce]<br />
<blockquote><br />
Group Commerce uses Haskell to drive the main component of their advertising infrastructure: a Snap Framework based web server. Haskell enabled quicker development, higher reliability, and better maintainability than other languages, without having to sacrifice performance.<br />
</blockquote><br />
<br />
* [http://hasura.io/ Hasura]<br />
<blockquote><br />
Hasura is a BaaS/PaaS focussed on keeping things DRY and letting you write custom code with the tools you love. We're building a micro-service platform christened Hasura.io (alpha release scheduled in summer 2015), and we used Haskell as the core programming language to build it. <br />
</blockquote><br />
<br />
* [http://humane-software.com Humane Software]<br />
<blockquote>We develop enterprise systems with de-coupled, asynchronous Haskell backends and Javascript UIs.<br><br />
For our current customer, an Internet connectivity provider, we wrote a solution for monitoring multiple remote machines and analyzing gigabytes of traffic samples. Haskell proved an excellent tool for the job. <br />
We were able to replace legacy systems in a granular, piece-by-piece manner, while delivering new features.</blockquote><br />
<br />
* [http://hustlerturf.com Hustler Turf Equipment] Hesston, Kansas<br />
<blockquote><br />
Designs, builds, and sells lawn mowers. We use quite a bit of Haskell, especially as a "glue language" for tying together data from different manufacturing-related systems. We also use it for some web apps that are deployed to our dealer network. There are also some uses for it doing sysadmin<br />
automation, such as adding/removing people from LDAP servers and the like<br />
</blockquote><br />
<br />
* [http://iba-cg.de/haskell.html iba Consulting Gesellschaft] - Intelligent business architecture for you. Leipzig, Germany<br />
<br />
<blockquote><br />
iba CG develops software for large companies: <br />
* risk analysis and reporting solution for power supply company; <br />
* contract management, assert management, booking and budgeting software for one of the worldwide leading accounting firm.<br />
</blockquote><br />
<br />
* [http://www.imvu.com IMVU, Inc]<br />
<br />
<blockquote><br />
IMVU, Inc. is a social entertainment company connecting users through 3D avatar-based experiences. See the blog article [http://engineering.imvu.com/2014/03/24/what-its-like-to-use-haskell/ What it's like to use Haskell]<br />
</blockquote><br />
<br />
* [http://www.ics-ag.de/ Informatik Consulting Systems AG]<br />
<br />
<blockquote><br />
ICS AG developed a simulation and testing tool which based on a DSL (Domain Specific Language). The DSL is used for the description of architecture and behavior of distributed system components (event/message based, reactive). The compiler was written in Haskell (with target language Ada). The test system is used in some industrial projects.<br />
</blockquote><br />
<br />
* [http://intel.com Intel]<br />
<blockquote><br />
Intel has developed a Haskell compiler as part of their research on multicore parallelism at scale.<br />
</blockquote><br />
<br />
:: Read the Intel Research paper on [http://www.leafpetersen.com/leaf/publications/hs2013/hrc-paper.pdf compiler]<br />
<br />
* [http://www.ivu.de/uk/products/public-transport/ IVU Traffic Technologies AG]<br />
<blockquote><br />
The rostering group at IVU Traffic Technologies AG has been using Haskell to check rosters for compliance with EC regulations.<br />
<br />
Our implementation is based on an embedded DSL to combine the regulation’s single rules into a solver that not only decides on instances but, in the case of a faulty roster, finds an interpretation of the roster that is “favorable” in the sense that the error messages it entails are “helpful” in leading the dispatcher to the resolution of the issue at hand.<br />
<br />
The solver is both reliable (due to strong static typing and referential transparency — we have not experienced a failure in three years) and efficient (due to constraint propagation, a custom search strategy, and lazy evaluation).<br />
<br />
Our EC 561/2006 component is part of the IVU.crew software suite and as such is in wide-spread use all over Europe, both in planning and dispatch. So the next time you enter a regional bus, chances are that the driver’s roster was checked by Haskell.<br />
</blockquote><br />
<br />
* [http://www.janrain.com JanRain]<br />
<blockquote><br />
JanRain uses Haskell for network and web software. Read more about [http://www.janrain.com/blogs/haskell-janrain Haskell at JanRain] and in their [http://corp.galois.com/blog/2011/3/8/tech-talk-haskell-and-the-social-web.html tech talk at Galois]. JanRain's "[http://www.janrain.com/products/capture Capture]" user API product is built on Haskell's Snap webframework.<br />
</blockquote><br />
<br />
:: See Janrain's [http://corp.galois.com/blog/2011/4/22/tech-talk-video-haskell-and-the-social-web.html technical talk about their use of Snap]<br />
<br />
* [http://joyridelabs.de/game/ Joyride Laboratories]<br />
<br />
<blockquote><br />
Joyride Laboratories is an independent game development studio, founded in 2009 by Florian Hofer and Sönke Hahn. Their first game, "Nikki and the Robots" was released in 2011.<br />
</blockquote><br />
<br />
* [http://keera.co.uk Keera Studios]<br />
<br />
<blockquote><br />
Keera Studios Ltd is a European game development studio that develops mobile, desktop and web apps.<br />
<br />
* Games: The mobile game Magic Cookies! was written in Haskell and released in 2015 [https://play.google.com/store/apps/details?id=uk.co.keera.games.magiccookies for Android] and 2017 [https://itunes.apple.com/us/app/magic-cookies/id1244709871 for iOS]. Other games include [http://github.com/ivanperez-keera/haskanoid Haskanoid], also available [https://www.facebook.com/keerastudios/photos/pb.300854939930039.-2207520000.1432793728./973879669294226/?type=3&theater for Android], and a multi-platform Graphic Adventure library and engine with [https://www.facebook.com/keerastudios/photos/pb.300854939930039.-2207520000.1432793728./971050386243821/?type=3&theater Android and iOS support] and an [https://www.facebook.com/keerastudios/photos/pb.300854939930039.-2207520000.1432793728./1078495588832633/?type=3&theater IDE].<br />
<br />
* Reactive Programming and GUIs: Keera Studios is also the maintainer of [http://github.com/keera-studios/keera-hails Keera Hails], an Open-Source reactive rapid application development framework with backends for Android and iOS's native GUI toolkits, Web DOM via GHCJS, Gtk+, Wx and Qt. With Hails, it is possible to write Haskell applications with UIs that work both for mobile and desktop.<br />
<br />
Keera Studios' Gale IDE (a game IDE), [https://github.com/keera-studios/keera-posture Keera Posture] (a open-source posture monitor using the webcam) and other mobile apps are also developed using Hails.<br />
<br />
See the [http://facebook.com/keerastudios Facebook page] for details on iOS & Android games and apps and ongoing development.<br />
<br />
</blockquote><br />
<br />
* [http://kinoubi.xyz kinoubi]<br />
<blockquote><br />
At kinoubi we believe in high quality code, that just works. We use software quality metrics to achieve an exceptional level of quality. Our main programming language is Haskell because of its elegance and philosophy of functional purity. It is what we believe in, it is our name: 'kinoubi' means 'functional elegance' in Japanese. Our code is produced for a range of different domains including data mining and machine learning.<br />
</blockquote><br />
<br />
* [https://lifted.software/rHSWiki/ Lifted Software UG], Berlin, Germany<br />
<blockquote><br />
Lifted has developed a macOS application "[https://lifted.software/rHSWiki/ JSON Class Generator]" that allows the user to specify data types (classes/enums) in a visual editor. These models can then be exported to Objective-C source code, which is capable of serializing/deserializing the instances to/from JSON. When parsing JSON, the structures are validated against the specification and errors are reported. The generated code comes with handy implementations for methods like -description, -isEqual:, -copy, -hash and more, that are boring to write and tedious to keep updated by hand.<br />
</blockquote><br />
<br />
* [http://linkqlo.com/ Linkqlo]<br />
<blockquote><br />
Linkqlo Inc is a Palo Alto-based technology startup that is building a pioneering mobile community to connect people with better fitting clothes. We’re solving an industry-wide pain point for both consumers and fashion brands in retail shopping, sizing and fitting, just like Paypal took on the online payment challenge in 1999. We started deploying Haskell as the backend language recently in August 2015, in an effort to eventually replace all PHP endpoint APIs with Haskell ones. <br />
</blockquote><br />
<br />
::Linkqlo's [http://linkqlo.com/app iOS app from App Store]<br />
<br />
* [http://www.linspire.com/ Linspire]<br />
<br />
<blockquote><br />
Linspire, Inc. has used functional programming since its inception in 2001,<br />
beginning with extensive use of O'Caml, with a steady shift to Haskell as its<br />
implementations and libraries have matured. Hardware detection, software<br />
packaging and CGI web page generation are all areas where we have used<br />
functional programming extensively. Haskell's feature set lets us replace much<br />
of our use of little languages (e.g., bash or awk) and two-level languages (C<br />
or C++ bound to an interpreted language), allowing for faster development,<br />
better code sharing and ultimately faster implementations. Above all, we value<br />
static type checking for minimizing runtime errors in applications that run in<br />
unknown environments and for wrapping legacy programs in strongly typed<br />
functions to ensure that we pass valid arguments. <br />
</blockquote><br />
<br />
::Linspire's [http://cufp.galois.com/2006/abstracts.html#CliffordBeshers CUFP talk]<br />
::Linspire's experience report on using [http://portal.acm.org/citation.cfm?doid=1291151.1291184 functional programming to manage a Linux distribution]<br />
<br />
* [https://lumiguide.eu/ LumiGuide]<br />
<blockquote><br />
LumiGuide is an innovative software company which specialises in smart parking and guidance systems for both bicycles and cars. LumiGuide developed and installed the [https://bicycledutch.wordpress.com/2015/06/09/bicycle-parking-guidance-system-in-utrecht/ P-route Bicycle system] for the City of Utrecht in 2015. This system guides cyclists via digital, street-level displays to available parking space in a number of parking facilities in the city centre. Utrecht is the first city in the world that has a system like this. The detection technology is based on optical sensors which are independent of the bicycle stands. The sensors are mounted to the ceiling in indoor facilities and mounted to poles in outdoor facilities. Every minute, one sensor detects 40 to 60 parking places at the same time in either single- or two-tier bicycle stands as well as (stand-less) free parking places. Bicycles that exceed the maximum parking duration ('orphaned' bicycles) are also detected and the system will automatically keep a log of pictures of the orphaned bicycle which can be used as evidence when the orphaned bicycle is removed by a facility operator. The usage of the facility can be monitored with web-based control software. LumiGuide also develops the indoor and outdoor digital displays which can be controlled using the web-based control software.<br />
<br />
We are extensively using Haskell and NixOS.<br />
</blockquote><br />
<br />
* [http://www.microsoft.com/ Microsoft]<br />
<blockquote><br />
Microsoft uses Haskell for its production serialization system, [https://github.com/Microsoft/bond Bond]. Bond is broadly used at Microsoft in high scale services. Microsoft Research has, separately, been a key sponsor of Haskell development since the late 1990s.<br />
</blockquote><br />
<br />
* [http://www.mitre.org/ MITRE]<br />
<blockquote><br />
MITRE uses Haskell for, amongst other things, the [http://hackage.haskell.org/package/cpsa analysis of cryptographic protocols].<br />
</blockquote><br />
<br />
* [http://nytimes.com The New York Times]<br />
<blockquote><br />
A team at the New York Times used Haskell's parallel array library to process images from 2013 New York Fashion Week. Haskell was chosen based on its fast numerical arrays packages, and ease of parallelization.<br />
</blockquote><br />
:: [http://source.mozillaopennews.org/en-US/articles/model-analysis/ Model analysis]<br />
:: [http://www.infoq.com/presentations/haskell-newsroom-nyt Haskell in the Newsroom]<br />
<br />
* [http://ertos.nicta.com.au/research/sel4/ NICTA]<br />
<blockquote><br />
NICTA has used Haskell as part of a project to verify the L4 microkernel.<br />
</blockquote><br />
::[http://www.drdobbs.com/embedded/222400553 Read the Dr. Dobbs article on using Haskell and formal methods to verify a kernel]<br />
<br />
* [http://www.gb.nrao.edu NRAO]<br />
<blockquote><br />
NRAO has used Haskell to implement the core science algorithms for the Robert C. Byrd Green Bank Telescope (GBT) Dynamic Scheduling System ([http://www.gb.nrao.edu/dss DSS]).<br />
::Source code available on [https://github.com/nrao/antioch GitHub].<br />
</blockquote><br />
<br />
* [http://www.ns-sol.co.jp NS Solutions(NSSOL)] Tokyo, Japan<br />
<blockquote><br />
NS Solutions has employed Haskell since 2008 to develop its software<br />
packages including "BancMeasure", a mark-to-market accounting software<br />
package for financial institutions, "BancMeasure for IFRS" and<br />
"Mamecif", a data analysis package.<br />
"BancMeasure" and "Mamecif" are registered trademarks of NS Solutions Corporation in JAPAN.<br />
</blockquote><br />
<br />
* [http://www.nvidia.com/content/global/global.php NVIDIA]<br />
<blockquote><br />
At NVIDIA, we have a handful of in-house tools that are written in Haskell<br />
</blockquote><br />
<br />
* [http://blog.openomy.com/2008/01/case-study-using-haskell-and-happs-for.html Openomy]<br />
<br />
<blockquote><br />
Openomy's API v2.0 is developed in Haskell, using the<br />
[http://www.happs.org/ HAppS] web platform.<br />
</blockquote><br />
<br />
* [http://www.oblomov.com Oblomov]<br />
<br />
<blockquote><br />
Oblomov Systems is a one-person software company based in Utrecht, The Netherlands. Founded in 2009, Oblomov has since then been working on a number of Haskell-related projects. The main focus lies on web-applications and (web-based) editors. Haskell has turned out to be extremely useful for implementing web servers that communicate with JavaScript clients or iPhone apps.<br />
</blockquote><br />
<br />
:: [http://haskell.org/communities/05-2010/html/report.html#oblomov Oblomov's HCAR submission].<br />
<br />
* [http://www.patch-tag.com Patch-Tag: hosting for Darcs]<br />
<blockquote><br />
Need somewhere to put your Darcs code? Try us.<br />
<br />
Patch-Tag is built with [http://happstack.com happstack], the continuation of the project formerly known as HAppS.<br />
</blockquote><br />
<br />
* [http://www.peerium.com Peerium, Inc] Cambridge, Massachusetts<br />
<blockquote><br />
At Peerium, we're striving to bring a new level of quality and efficiency to online communication and collaboration within virtual communities, social networks, and business environments. We believe that a new environment that supports the effortless sharing of both information and software will enable a level of online cooperation far beyond current Web-based technologies -- modern programming techniques will enable the creation of more robust and more powerful programs within these environments. To this end, we're building a new software platform for direct, real-time communication and collaboration within graphically rich environments. Peerium is located in the heart of Harvard Square in Cambridge, Massachusetts.<br />
</blockquote><br />
<br />
* [http://www.picussecurity.com Picus Security] Ankara, Turkey<br />
<blockquote><br />
There are lots of IT security products currently used in enterprises to protect customers from cyber threats. How do we ensure about their effectiveness? At this point we have an idea. An idea that we believe will change the entire ecosystem of security operations which we call 'Verified Security' by continuously assessing security controls and remediating them. At Picus Security, we're extensively using Haskell from the starting point of the project. Our backend completely written in Haskell which consists of REST API, distributed haskell nodes and attacker modules. <br />
</blockquote><br />
<br />
* [http://www.planit9.com/ PlanIt9]<br />
<br />
<blockquote><br />
PlanIt9 is a Yesod-based web application for defining, planning, scheduling and tracking tasks. It's designed to be fast, simple, collaborative and cost effective. We're currently signing up users for our beta program.<br />
</blockquote><br />
<br />
* [https://github.com/plumlife Plumlife]<br />
<blockquote><br />
Plum is replacing light switches with Lightpads; a capacitive touch dimmer that is internet connected, clusters with other Lightpads in the home for group control... Haskell composes our cloud services and Erlang is used for the embedded software in the Lightpads (hot-code reloading, easy node clustering, etc...).<br />
...<br />
We use Haskell extensively for all of our cloud services software at Plumlife ... Amazing language and ecosystem.<br />
</blockquote><br />
<br />
* [http://www.qualcomm.com/ Qualcomm, Inc]<br />
<br />
<blockquote><br />
Qualcomm uses Haskell to generate Lua bindings to the BREW platform <br />
</blockquote><br />
<br />
* [http://blog.sqreamtech.com/2013/09/using-haskell-at-sqream-technologies/ SQream]<br />
<br />
<blockquote><br />
At SQream, we use Haskell for a large part of our code. We use Haskell for the compiler, which takes SQL statements and turns them into low level instructions for the high performance CUDA runtime. We also use Haskell for rapid prototyping and for many auxiliary utilities.<br />
</blockquote><br />
<br />
* [http://cufp.org/conference/sessions/2013/jeff-epstein-parallel-scientific-building-scalable Parallel Scientific], Boulder, Colorado.<br />
<br />
<blockquote><br />
We are using Haskell to develop an ultra-scalable high-availability resource management system for big clusters (millions of nodes). A key element of the design is to provide scalable and reliable mechanisms for communicating failures and coordinating recovery transitions. <br />
</blockquote><br />
<br />
:: See Parallel Scientific's [http://cufp.org/conference/sessions/2013/jeff-epstein-parallel-scientific-building-scalable CUFP talk]<br />
<br />
* [http://www.renci.org/ Renaissaince Computing Institute], Chapel Hill, North Carolina<br />
<blockquote><br />
The Renaissance Computing Institute (RENCI), a multi-institutional organization, brings together multidisciplinary experts and advanced technological capabilities to address pressing research issues and to find solutions to complex problems that affect the quality of life in North Carolina, our nation and the world.<br />
<br />
Research scientists at RENCI have used Haskell for a number of projects, including [http://vis.renci.org/jeff/2009/08/26/open-sourcing-the-big-board/ The Big Board].<br />
</blockquote><br />
<br />
::RENCI's [http://cufp.galois.com/2009/abstracts.html#JeffersonHeard CUFP talk].<br />
<br />
* [https://www.relexsolutions.com RELEX Solutions] in Helsinki, Finland<br />
<br />
<blockquote><br />
RELEX uses Haskell (and Nix) in production for several internal tools and systems.<br />
</blockquote><br />
<br />
* [https://ruevoisine.fr ruevoisine.fr]<br />
<br />
<blockquote><br />
<p>This rental ads website uses Haskell both on client and server.</p><br />
<p>Web server is written in Erlang (Yaws) however app is nearly all Haskell.</p><br />
<p>Js code is produced, minified and bundled from Haskell.</p><br />
</blockquote><br />
<br />
* [http://samplecount.com Samplecount]<br />
<br />
<blockquote><br />
Samplecount develops mobile, location-aware sound and music applications. They are currently using Haskell for prototyping their server-side soundscape streaming components and as a cross-platform build tool for their mobile applications and frameworks.<br />
</blockquote><br />
<br />
* [http://sankelsoftware.com Sankel Software] Albuquerque, New Mexico<br />
<br />
<blockquote><br />
Sankel Software has been using Haskell since 2002 for both prototyping and deployment for technologies ranging from CAD/CAM to gaming and computer animation. We specialize in the development of user-friendly, large, long-term applications that solve difficult and conceptually intricate problems.<br />
</blockquote><br />
<br />
* [https://scrive.com/gb/en Scrive] <br />
<br />
<blockquote><br />
Scrive is a service for e-signing tenders, contracts, and other documents. We help our clients close deals faster, decrease their administrative burden, and improve their customers’ experience.<br />
</blockquote><br />
<br />
* [https://www.cee.siemens.com/web/at/en/csb/cvc/Pages/home.aspx Siemens Convergence Creators GmbH Austria]<br />
<br />
<blockquote><br />
Siemens CVC uses Haskell since a few years in the space domain. Starting with small tools like data conversion and automation of scripting tasks over installers we use Haskell currently for Space Protocol Proxies to allow connect different space systems (e.g. Cortex to NCTRS or SLE to NCTRS with COP-1 handling). The main use is currently a Simulator implemented in Haskell which handles parts of NCTRS (or SSB), the ground station and parts of the satellite to be able to make closed-loop tests for the SCOS-2000 based Mission Control System. It is in use for testing and debugging of the Mission Control System and for checking implementation of new features. It has served for various, currently active missions and also is in use for some missions to come.<br />
</blockquote><br />
<br />
* [http://www.signalicorp.com/index.htm Signali] Portland, Oregon<br />
<br />
<blockquote><br />
Signali Corp is a new custom hardware design company. Our chief products<br />
are custom IP cores targeted for embedded DSP and cryptographic<br />
applications. Our specialty is the design and implementation of<br />
computationally intensive, complex algorithms. The interfaces to each<br />
core are modular and can be very efficiently modified for your specific<br />
application. System-level integration and validation is crucial and is<br />
the majority of investment in a product.<br />
</blockquote><br />
<br />
* [http://www.soostone.com Soostone] New York, NY<br />
<br />
<blockquote><br />
Soostone is an advanced analytics technology provider specializing in algorithmic optimization opportunities in marketing, pricing, advertising, sales and product management. As the preferred language, Haskell is used intensively at Soostone in numerous applications including customized machine learning algorithms, models/simulations, real-time decision-making engines, DSL/EDSLs, web applications and high volume APIs.<br />
</blockquote><br />
<br />
* [http://www.standardchartered.com/home/en/index.html Standard Chartered]<br />
<br />
<blockquote><br />
Standard Chartered has a large group using Haskell for all aspects of its wholesale banking business.<br />
</blockquote><br />
<br />
* [http://www.stackbuilders.com Stack Builders]<br />
<br />
<blockquote><br />
Stack Builders is a software consultancy based in New York, with its largest office in Quito, Ecuador. They build web, mobile and real-time applications for clients in industries including the automotive industry, finance, and social media and marketing. They have assisted clients in multiple industries with both legacy and greenfield projects in Haskell.<br />
</blockquote><br />
<br />
* [http://www.starling-software.com/en/index.html Starling Software] Tokyo, Japan<br />
<blockquote><br />
Starling Software are developing a commercial automated options trading system <br />
in Haskell, and are migrating other parts of their software suite to<br />
Haskell.<br />
</blockquote><br />
<br />
::Starling Software's [http://www.starling-software.com/misc/icfp-2009-cjs.pdf experience building real time trading systems in Haskell] <br />
<br />
<br />
* [http://www.sensor-sense.nl Sensor Sense] Nijmegen, The Netherlands<br />
<br />
<blockquote><br />
Sensor Sense is offering high technology systems for gas measurements in the ''ppbv'' down to ''pptv'' range. We use Haskell for the embedded control software of our trace gas detectors.<br />
</blockquote><br />
<br />
:: For more information see Senor Sense's [http://www.reddit.com/r/haskell/comments/1clkjb/job_opening_for_haskell_developer_in_nijmegen_nl/ position advertisement]<br />
<br />
* [http://www.silk.co Silk] Amsterdam, The Netherlands<br />
<br />
<blockquote><br />
Silk investigates and develops new ways of creating and consuming online content. Their [http://www.silk.co/ Silk] application makes it easy to filter and visualize large amounts of information.<br />
</blockquote><br />
<br />
:: Silk's blog on [http://engineering.silk.co/post/31920990633/why-we-use-haskell/ why they use Haskell]<br />
:: A [http://thenextweb.com/eu/2011/04/28/filter-and-visualize-data-in-seconds-with-silk/ review of Silk]<br />
<br />
* [http://skedge.me/ Skedge Me]<br />
<blockquote><br />
skedge.me is an online scheduling platform that allows businesses to completely automate the process of making appointments, such as customer visits, job interviews, and tutoring sessions.<br />
</blockquote><br />
<br />
:: See more in their [http://cufp.org/conference/sessions/2013/ryan-trinkle-skedgeme-enterprise-appointment-sched CUFP talk]<br />
:: See their 2014 [http://functionaljobs.com/jobs/8712-haskell-developer-at-skedgeme job advertisement]<br />
<br />
* [http://www.suite-sol.com/ Suite Solutions]<br />
<blockquote><br />
Suite Solutions provides products and solutions in support of large sets of technical documentation based on [http://en.wikipedia.org/wiki/Darwin_Information_Typing_Architecture DITA] for general technical documentation, and other more specialized XML and SGML formats for specific industries such as the aerospace industry. Many of Suite Solutions' products and solutions, such as the featured products [http://www.suite-sol.com/pages/solutions/suitehelp.html SuiteHelp] and [http://www.suite-sol.com/pages/solutions/suite-social-kb.html SuiteShare], are written in Haskell.<br />
</blockquote><br />
<br />
* [http://www.sumall.com/ SumAll] New York, New York<br />
<blockquote><br />
SumAll aggregates various public streams of data such as various social network data into useful analytics, reports and insights. We are in process of rewriting our entire data-processing backend in Haskell. What attracted us to the language is its disciplined and uncompromising approach to solving hard problems and managing complexity. We truly believe that the language and ecosystem is ready for prime time and will give us competitive advantage in the industry. <br />
</blockquote><br />
<br />
* [http://www.symbiont.io Symbiont.io] New York, NY<br />
<br />
<blockquote><br />
Symbiont is a New York-based startup that is using smart contracts and blockchain technology to radically improve financial market back-office infrastructure. Haskell is currently used at Symbiont for its network management tooling, and there are plans to expand the use of the language to transaction processing and other backend services. <br />
</blockquote><br />
<br />
* [http://www.tabula.com/ Tabula.com]<br />
<blockquote><br />
Tabula is a privately held fabless semiconductor company developing 3-D Programmable Logic Devices. Haskell is used for internal compiler toolchains related to hardware design.<br />
</blockquote><br />
<br />
* [https://www.tramcloud.net/ TramCloud GmbH]<br />
<blockquote><br />
TramCloud builds measurement devices and analytics platforms for tram operators. Most software is written in Haskell.<br />
</blockquote><br />
<br />
* [https://www.tripshot.com/ Tripshot, Inc.] San Jose, California<br />
<blockquote><br />
All-In-One Transportation Management Software<br />
</blockquote><br />
<br />
* [http://tsurucapital.com Tsuru Capital] Tokyo, Japan<br />
<blockquote><br />
Tsuru Capital is operating an automated options trading system written in Haskell.<br />
</blockquote><br />
<br />
::[http://haskell.org/communities/05-2010/html/report.html#sect7.6 Tsuru Capital's HCAR submission]<br />
<br />
* [http://tupil.com/ Tupil] Utrecht, The Netherlands<br />
<br />
<blockquote><br />
Tupil is a Dutch company that built software for clients, written in Haskell. Tupil used Haskell for the speed in development and resulting software quality. The company is founded by Chris Eidhof and Eelco Lempsink. Currently they build iPhone/iPad applications in Objective-C.<br />
</blockquote><br />
<br />
:: Tupil's experience building [http://blog.tupil.com/building-commercial-haskell-applications/ commercial web apps in Haskell]<br />
<br />
* [https://www.uffizio.ch/ Uffizio GmbH] Switzerland<br />
<br />
<blockquote><br />
Uffizio is a one-person company in Switzerland that uses Haskell for building correct, maintainable and fast e-commerce web applications as well as internal tools.<br />
</blockquote><br />
<br />
* [http://www.wagonhq.com Wagon] San Francisco, California<br />
<br />
<blockquote><br />
Wagon is a modern SQL editor: a better way for analysts and engineers to write queries, visualize results, and share data & charts.<br />
</blockquote><br />
<br />
::We’re a team of functional programmers writing apps and services in Haskell (and Javascript). We love to teach and learn functional programming; our team is humble, hard working, and fun. Read our engineering blog to learn more about our [http://www.wagonhq.com/blog/engineering-at-wagon stack], how we combine [http://www.wagonhq.com/blog/electron-at-wagon Haskell, React, and Electron], and what it’s like [http://www.wagonhq.com/blog/first-two-weeks-haskell-wagon working at a Haskell-powered startup].<br />
<br />
::We're hiring Haskell engineers based in San Francisco, [http://www.wagonhq.com/jobs learn more about the roles and our team]!<br />
<br />
* [https://www.xoken.org Xoken Labs] Bangalore, India<br />
<br />
<blockquote><br />
Xoken Labs is building a decentralized platform based on blockchain technology.<br />
</blockquote><br />
<br />
::Xoken Labs is a technology company committed to revolutionize financial services via secure distributed P2P solutions, effectively addressing challenges pertaining to trade, trust & ownership. The Xoken project aims to create a next-gen decentralized smart economy. We believe in distributed, innovative teams and love to push the frontiers of distributed ledger technology.<br />
<br />
::We're hiring Haskellers!<br />
::[https://www.xoken.org/careers/ https://www.xoken.org/careers/]<br />
<br />
If you're using Haskell commercially, please add your details here.<br />
<br />
== The Industrial Haskell Group ==<br />
<br />
The [http://industry.haskell.org/ Industrial Haskell Group (IHG)] is an organisation to support the needs of commercial users of the Haskell programming language. <br />
<br />
== Jobs and recruitment ==<br />
<br />
[[Jobs|Haskell jobs]] on the HaskellWiki.<br />
<br />
[http://www.haskellers.com/jobs Jobs at Haskellers.com].<br />
<br />
== Consultants ==<br />
<br />
[[Consultants]]<br />
<br />
== Commercial Users of Functional Programming Workshop ==<br />
<br />
[http://www.galois.com/cufp/ Commercial Users of Functional Programming]<br />
<br />
The goal of [http://www.galois.com/cufp/ CUFP] is to build a community<br />
for users of functional programming languages and technology, be they<br />
using functional languages in their professional lives, in an open<br />
source project (other than implementation of functional languages), as a<br />
hobby, or any combination thereof. In short: anyone who uses functional<br />
programming as a means, but not an end.<br />
<br />
[[Category:Community]]</div>Ysangkokhttps://wiki.haskell.org/index.php?title=Old_news&diff=62999Old news2019-08-15T19:17:53Z<p>Ysangkok: fix gmane links using archive.fo</p>
<hr />
<div>__TOC__<br />
<br />
<br />
__TOC__<br />
<br />
==News from 2008==<br />
<br />
''2008-02-23''<br />
<br />
<ul><li><p><em>ArrayRef 0.1.2</em>. Uploaded by Gwern Branwen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/ArrayRef-0.1.2 ArrayRef]: Unboxed references, dynamic arrays and more.</p></li><br />
<br />
<li><p><em>zlib 0.4.0.4</em>. Uploaded by Duncan Coutts.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/zlib-0.4.0.4 zlib]: Compression and decompression in the gzip and zlib formats.</p></li><br />
<br />
<li><p><em>hetris 0.1</em>. Uploaded by Gwern Branwen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hetris-0.1 hetris]: Text Tetris.</p></li><br />
<br />
<li><p><em>bzlib 0.4.0.3</em>. Uploaded by Duncan Coutts.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/bzlib-0.4.0.3 bzlib]: Compression and decompression in the bzip2 format.</p></li><br />
<br />
<li><p><em>HAppS-Server 0.9.2</em>. Uploaded by David Himmelstrup.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HAppS-Server-0.9.2 HAppS-Server]: Web related tools and services..</p></li><br />
<br />
<li><p><em>HAppS-State 0.9.2</em>. Uploaded by David Himmelstrup.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HAppS-State-0.9.2 HAppS-State]: Event-based distributed state..</p></li><br />
<br />
<li><p><em>HAppS-Data 0.9.2</em>. Uploaded by David Himmelstrup.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HAppS-Data-0.9.2 HAppS-Data]: HAppS data manipulation libraries.</p></li><br />
<br />
<li><p><em>HAppS-IxSet 0.9.2</em>. Uploaded by David Himmelstrup.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HAppS-IxSet-0.9.2 HAppS-IxSet]: Added by DavidHimmelstrup, Fri Feb 22 15:18:20 PST 2008..</p></li><br />
<br />
<li><p><em>HAppS-Util 0.9.2</em>. Uploaded by David Himmelstrup.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HAppS-Util-0.9.2 HAppS-Util]: Web framework.</p></li><br />
<br />
<li><p><em>Ranged-sets 0.2.0</em>. Uploaded by Paul Johnson.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Ranged-sets-0.2.0 Ranged-sets]: Ranged sets for Haskell.</p></li><br />
<br />
<li><p><em>halfs 0.2</em>. Uploaded by Gwern Branwen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/halfs-0.2 halfs]: Haskell File System.</p></li><br />
<br />
<li><p><em>sessions 2008.2.22</em>. Uploaded by Matthew Sackman.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/sessions-2008.2.22 sessions]: Session Types for Haskell.</p></li><br />
<br />
<li><p><em>infix 0.1</em>. Uploaded by Gwern Branwen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/infix-0.1 infix]: Infix expression re-parsing (for HsParser library).</p></li><br />
<br />
<li><p><em>reify 0.1</em>. Uploaded by Gwern Branwen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/reify-0.1 reify]: Serialize data.</p></li><br />
<br />
<li><p><em>highWaterMark 0.1</em>. Uploaded by Gwern Branwen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/highWaterMark-0.1 highWaterMark]: Memory usage statistics.</p></li><br />
<br />
<li><p><em>hinvaders 0.1</em>. Uploaded by Gwern Branwen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hinvaders-0.1 hinvaders]: Space Invaders.</p></li><br />
<br />
<li><p><em>baskell 0.1</em>. Uploaded by Gwern Branwen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/baskell-0.1 baskell]: An interpreter for a small functional language.</p></li><br />
<br />
<li><p><em>control-event 0.2</em>. Uploaded by Thomas DuBuisson.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/control-event-0.2 control-event]: Event scheduling system..</p></li><br />
<br />
<li><p><em>nymphaea 0.1</em>. Uploaded by Gwern Branwen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/nymphaea-0.1 nymphaea]: An interactive GUI for manipulating L-systems.</p></li><br />
<br />
<li><p><em>hopenssl 1.0</em>. Uploaded by Peter Simons.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hopenssl-1.0 hopenssl]: FFI bindings to OpenSSL's EVP digest interface.</p></li><br />
<br />
<li><p><em>Monadius 0.91</em>. Uploaded by Gwern Branwen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Monadius-0.91 Monadius]: 2-D arcade scroller.</p></li><br />
<br />
<li><p><em>postmaster 0.1</em>. Uploaded by Peter Simons.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/postmaster-0.1 postmaster]: Postmaster ESMTP Server.</p></li><br />
<br />
<li><p><em>hsyslog 1.2</em>. Uploaded by Peter Simons.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hsyslog-1.2 hsyslog]: FFI interface to syslog(3) from POSIX.1-2001..</p></li><br />
<br />
<li><p><em>hsemail 1.2</em>. Uploaded by Peter Simons.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hsemail-1.2 hsemail]: Internet Message Parsers.</p></li><br />
<br />
<li><p><em>hsdns 1.3</em>. Uploaded by Peter Simons.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hsdns-1.3 hsdns]: Asynchronous DNS Resolver.</p></li><br />
<br />
<li><p><em>funcmp 1.1</em>. Uploaded by Peter Simons.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/funcmp-1.1 funcmp]: Functional MetaPost.</p></li><br />
<br />
<li><p><em>streamproc 1.1</em>. Uploaded by Peter Simons.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/streamproc-1.1 streamproc]: Stream Processer Arrow.</p></li><br />
<br />
<li><p><em>pugs-HsSyck 0.41</em>. Uploaded by Gwern Branwen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/pugs-HsSyck-0.41 pugs-HsSyck]: Fast, lightweight YAML loader and dumper.</p></li><br />
<br />
<li><p><em>HsSyck 0.42</em>. Uploaded by Gwern Branwen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HsSyck-0.42 HsSyck]: Fast, lightweight YAML loader and dumper.</p></li><br />
<br />
<li><p><em>mohws 0.1</em>. Uploaded by Gwern Branwen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/mohws-0.1 mohws]: Modular Haskell Web Server.</p></li><br />
<br />
<li><p><em>HsJudy 0.1</em>. Uploaded by Gwern Branwen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HsJudy-0.1 HsJudy]: Judy bindings, and some nice APIs.</p></li><br />
<br />
<li><p><em>probability 0.2.1</em>. Uploaded by Henning Thielemann.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/probability-0.2.1 probability]: Probabilistic Functional Programming.</p></li><br />
<br />
<li><p><em>dsp 0.2.1</em>. Uploaded by Henning Thielemann.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/dsp-0.2.1 dsp]: Haskell Digital Signal Processing.</p></li><br />
<br />
<li><p><em>pugs-hsregex 1.0</em>. Uploaded by Gwern Branwen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/pugs-hsregex-1.0 pugs-hsregex]: Haskell PCRE binding.</p></li><br />
<br />
<li><p><em>ListLike 1.0.1</em>. Uploaded by John Goerzen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/ListLike-1.0.1 ListLike]: Generic support for list-like structures.</p></li><br />
<br />
<li><p><em>SDL-gfx 0.5.2</em>. Uploaded by David Himmelstrup.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/SDL-gfx-0.5.2 SDL-gfx]: Binding to libSDL_gfx.</p></li><br />
<br />
<li><p><em>SDL-ttf 0.5.2</em>. Uploaded by David Himmelstrup.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/SDL-ttf-0.5.2 SDL-ttf]: Binding to libSDL_ttf.</p></li><br />
<br />
<li><p><em>SDL-mixer 0.5.2</em>. Uploaded by David Himmelstrup.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/SDL-mixer-0.5.2 SDL-mixer]: Binding to libSDL_mixer.</p></li><br />
<br />
<li><p><em>SDL-image 0.5.2</em>. Uploaded by David Himmelstrup.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/SDL-image-0.5.2 SDL-image]: Binding to libSDL_image.</p></li><br />
<br />
<li><p><em>SDL 0.5.2</em>. Uploaded by David Himmelstrup.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/SDL-0.5.2 SDL]: Binding to libSDL.</p></li><br />
<br />
<li><p><em>DeepArrow 0.2</em>. Uploaded by Conal Elliott.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/DeepArrow-0.2 DeepArrow]: Arrows for "deep application".</p></li><br />
<br />
<li><p><em>GuiTV 0.4</em>. Uploaded by Conal Elliott.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/GuiTV-0.4 GuiTV]: GUIs for Tangible Values.</p></li><br />
<br />
<li><p><em>Shellac-compatline 0.9</em>. Uploaded by Robert Dockins.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Shellac-compatline-0.9 Shellac-compatline]: "compatline" backend module for Shellac.</p></li><br />
<br />
<li><p><em>WordNet 0.1.2</em>. Uploaded by Max Rabkin.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/WordNet-0.1.2 WordNet]: Haskell interface to the WordNet database.</p></li><br />
<br />
<li><p><em>lazyarray 0.1.3</em>. Uploaded by Milan Straka.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/lazyarray-0.1.3 lazyarray]: Efficient implementation of lazy monolithic arrays (lazy in indexes)..</p></li><br />
<br />
<li><p><em>GenI 0.16.1</em>. Uploaded by Eric Kow.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/GenI-0.16.1 GenI]: A natural language generator (specifically, an FB-LTAG surface realiser).</p></li><br />
<br />
<li><p><em>libGenI 0.16.1</em>. Uploaded by Eric Kow.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/libGenI-0.16.1 libGenI]: A natural language generator (specifically, an FB-LTAG surface realiser).</p></li><br />
<br />
<li><p><em>alsa-midi 0.3.1</em>. Uploaded by Henning Thielemann.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/alsa-midi-0.3.1 alsa-midi]: Bindings for the ALSA sequencer API (MIDI stuff).</p></li><br />
<br />
<li><p><em>midi 0.0.5</em>. Uploaded by Henning Thielemann.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/midi-0.0.5 midi]: Handling of MIDI messages and files.</p></li><br />
<br />
<li><p><em>event-list 0.0.6</em>. Uploaded by Henning Thielemann.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/event-list-0.0.6 event-list]: Event lists with relative or absolute time stamps.</p></li><br />
<br />
<li><p><em>numeric-quest 0.1.1</em>. Uploaded by Henning Thielemann.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/numeric-quest-0.1.1 numeric-quest]: Math and quantum mechanics.</p></li><br />
<br />
<li><p><em>markov-chain 0.0.2</em>. Uploaded by Henning Thielemann.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/markov-chain-0.0.2 markov-chain]: Markov Chains for generating random sequences with a user definable behaviour..</p></li><br />
<br />
<li><p><em>hmp3 1.5.1</em>. Uploaded by Don Stewart.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hmp3-1.5.1 hmp3]: An ncurses mp3 player written in Haskell.</p></li><br />
<br />
<li><p><em>TypeIlluminator 0.0</em>. Uploaded by Gwern Branwen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/TypeIlluminator-0.0 TypeIlluminator]: TypeIlluminator is a prototype tool exploring debugging of type errors/.</p></li><br />
<br />
<li><p><em>Takusen 0.7</em>. Uploaded by Don Stewart.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Takusen-0.7 Takusen]: Database library with left-fold interface, for PostgreSQL, Oracle, SQLite, ODBC..</p></li><br />
<br />
<li><p><em>carray 0.1.2</em>. Uploaded by Jed Brown.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/carray-0.1.2 carray]: A C-compatible array library..</p></li><br />
<br />
<li><p><em>jack 0.5</em>. Uploaded by Henning Thielemann.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/jack-0.5 jack]: Bindings for the JACK Audio Connection Kit.</p></li><br />
<br />
<li><p><em>non-negative 0.0.1</em>. Uploaded by Henning Thielemann.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/non-negative-0.0.1 non-negative]: Non-negative numbers.</p></li><br />
<br />
<li><p><em>RJson 0.3.3</em>. Uploaded by Alex Drummond.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/RJson-0.3.3 RJson]: A reflective JSON serializer/parser..</p></li><br />
<br />
<li><p><em>clevercss 0.1.1</em>. Uploaded by Georg Brandl.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/clevercss-0.1.1 clevercss]: A CSS preprocessor.</p></li><br />
<br />
<li><p><em>fft 0.1.1</em>. Uploaded by Jed Brown.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/fft-0.1.1 fft]: Bindings to the FFTW library..</p></li><br />
<br />
<li><p><em>storable-complex 0.1</em>. Uploaded by Jed Brown.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/storable-complex-0.1 storable-complex]: Storable instance for Complex.</p></li><br />
<br />
<li><p><em>winerror 0.1</em>. Uploaded by Felix Martini.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/winerror-0.1 winerror]: Error handling for foreign calls to the Windows API..</p></li><br />
<br />
<li><p><em>linkchk 0.0.2</em>. Uploaded by Gwern Branwen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/linkchk-0.0.2 linkchk]: linkchk is a network interface link ping monitor..</p></li><br />
<br />
<li><p><em>popenhs 1.0.0</em>. Uploaded by Gwern Branwen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/popenhs-1.0.0 popenhs]: popenhs is a popen-like library for Haskell..</p></li><br />
<br />
<li><p><em>Flippi 0.0.3</em>. Uploaded by Gwern Branwen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Flippi-0.0.3 Flippi]: Wiki.</p></li><br />
<br />
<li><p><em>DisTract 0.2.5</em>. Uploaded by Gwern Branwen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/DisTract-0.2.5 DisTract]: Distributed Bug Tracking System.</p></li><br />
<br />
<li><p><em>goa 3.0</em>. Uploaded by Gwern Branwen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/goa-3.0 goa]: GHCi bindings to lambdabot.</p></li><br />
<br />
<li><p><em>hinstaller 2008.2.16</em>. Uploaded by Gwern Branwen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hinstaller-2008.2.16 hinstaller]: Installer wrapper for Haskell applications.</p></li><br />
<br />
<li><p><em>GeoIp 0.1</em>. Uploaded by Stephen Cook.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/GeoIp-0.1 GeoIp]: Pure bindings for the MaxMind IP database..</p></li><br />
<br />
<li><p><em>hpodder 1.1.2</em>. Uploaded by John Goerzen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hpodder-1.1.2 hpodder]: Podcast Aggregator (downloader).</p></li><br />
<br />
<li><p><em>wxcore 0.10.2</em>. Uploaded by Eric Kow.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/wxcore-0.10.2 wxcore]: wxHaskell core.</p></li><br />
<br />
<li><p><em>wx 0.10.2</em>. Uploaded by Eric Kow.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/wx-0.10.2 wx]: wxHaskell.</p></li><br />
<br />
<li><p><em>flow2dot 0.3</em>. Uploaded by Dmitry Astapov.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/flow2dot-0.3 flow2dot]: Generates sequence diagrams from textual descriptions.</p></li><br />
<br />
<li><p><em>strict-concurrency 0.2</em>. Uploaded by Donald Stewart.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/strict-concurrency-0.2 strict-concurrency]: Strict concurrency abstractions.</p></li><br />
<br />
<li><p><em>TV 0.4</em>. Uploaded by Conal Elliott.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/TV-0.4 TV]: Tangible Values -- composable interfaces.</p></li><br />
<br />
<li><p><em>geniconvert 0.15</em>. Uploaded by Eric Kow.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/geniconvert-0.15 geniconvert]: Conversion utility for the GenI generator.</p></li><br />
<br />
<li><p><em>ctemplate 0.1</em>. Uploaded by Adam Langley.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/ctemplate-0.1 ctemplate]: Binding to the Google ctemplate library.</p></li><br />
<br />
<li><p><em>arrows 0.4</em>. Uploaded by Ross Paterson.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/arrows-0.4 arrows]: Arrow classes and transformers.</p></li><br />
<br />
<li><p><em>lhs2tex 1.13</em>. Uploaded by Andres Loeh.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/lhs2tex-1.13 lhs2tex]: Preprocessor for typesetting Haskell sources with LaTeX.</p></li><br />
<br />
<li><p><em>NGrams 1.1</em>. Uploaded by Justin Bailey.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/NGrams-1.1 NGrams]: Simple application for calculating n-grams using Google..</p></li><br />
<br />
<li><p><em>lambdabot 4.1</em>. Uploaded by Gwern Branwen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/lambdabot-4.1 lambdabot]: A multi-talented IRC bot.</p></li><br />
<br />
<li><p><em>HsOpenSSL 0.4</em>. Uploaded by Masatake Daimon.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HsOpenSSL-0.4 HsOpenSSL]: (Part of) OpenSSL binding for Haskell.</p></li><br />
<br />
<li><p><em>network-minihttp 0.1</em>. Uploaded by Adam Langley.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/network-minihttp-0.1 network-minihttp]: A very minimal webserver.</p></li><br />
<br />
<li><p><em>ZFS 0.0</em>. Uploaded by Gwern Branwen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/ZFS-0.0 ZFS]: Oleg's Zipper FS.</p></li><br />
<br />
<li><p><em>fst 0.9</em>. Uploaded by Gwern Branwen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/fst-0.9 fst]: Finite state transducers.</p></li><br />
<br />
<li><p><em>haskell-in-space 0.1</em>. Uploaded by Gwern Branwen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/haskell-in-space-0.1 haskell-in-space]: 'Asteroids' arcade games..</p></li><br />
<br />
<li><p><em>unix-pty-light 0.1</em>. Uploaded by Stuart Cook.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/unix-pty-light-0.1 unix-pty-light]: POSIX pseudo-terminal support.</p></li><br />
<br />
<li><p><em>bot 0.1</em>. Uploaded by Conal Elliott.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/bot-0.1 bot]: bots for functional reactive programming.</p></li><br />
<br />
<li><p><em>Hedi 0.1</em>. Uploaded by Paolo Veronelli.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Hedi-0.1 Hedi]: Line oriented editor.</p></li><br />
<br />
<li><p><em>network-bytestring 0.1.1.2</em>. Uploaded by Johan Tibell.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/network-bytestring-0.1.1.2 network-bytestring]: Fast and memory efficient low-level networking.</p></li><br />
<br />
<li><p><em>leksah 0.1.1</em>. Uploaded by Juergen NicklischFranken.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/leksah-0.1.1 leksah]: Haskell IDE written in Haskell.</p></li><br />
<br />
<li><p><em>nano-hmac 0.2.0</em>. Uploaded by Hitesh Jasani.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/nano-hmac-0.2.0 nano-hmac]: Bindings to OpenSSL HMAC..</p></li><br />
<br />
<li><p><em>monadenv 0.0-2005-02-14</em>. Uploaded by Gwern Branwen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/monadenv-0.0-2005-02-14 monadenv]: Added by GwernBranwen, Sun Feb 10 20:15:11 PST 2008..</p></li><br />
<br />
<li><p><em>blockio 0.0-2006-02-03</em>. Uploaded by Gwern Branwen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/blockio-0.0-2006-02-03 blockio]: Block-oriented I/O Driver.</p></li><br />
<br />
<li><p><em>child 0.0-2005-02-14</em>. Uploaded by Gwern Branwen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/child-0.0-2005-02-14 child]: Added by GwernBranwen, Sun Feb 10 19:35:20 PST 2008..</p></li><br />
<br />
<li><p><em>highlighting-kate 0.2.1</em>. Uploaded by John MacFarlane.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/highlighting-kate-0.2.1 highlighting-kate]: Syntax highlighting.</p></li></ul><br />
<br />
''2008-02-10''<br />
<br />
<ul><li><p><em>WordNet 0.1.1</em>. Uploaded by Max Rabkin.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/WordNet-0.1.1 WordNet]: Haskell interface to the WordNet database.</p></li><br />
<br />
<li><p><em>lazysmallcheck 0.1</em>. Uploaded by Gwern Branwen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/lazysmallcheck-0.1 lazysmallcheck]: A library for demand-driven testing of Haskell programs.</p></li><br />
<br />
<li><p><em>DrIFT 2.2.3</em>. Uploaded by Gwern Branwen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/DrIFT-2.2.3 DrIFT]: Program to derive type class instances.</p></li><br />
<br />
<li><p><em>highlighting-kate 0.2</em>. Uploaded by John MacFarlane.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/highlighting-kate-0.2 highlighting-kate]: Syntax highlighting.</p></li><br />
<br />
<li><p><em>leksah 0.1</em>. Uploaded by Juergen NicklischFranken.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/leksah-0.1 leksah]: Genuine Haskell Face.</p></li><br />
<br />
<li><p><em>frag 1.1</em>. Uploaded by Gwern Branwen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/frag-1.1 frag]: 3-D First Person Shooter (FPS).</p></li><br />
<br />
<li><p><em>GoogleChart 0.2</em>. Uploaded by Evan Martin.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/GoogleChart-0.2 GoogleChart]: Generate web-based charts using the Google Chart API.</p></li><br />
<br />
<li><p><em>HFuse 0.1</em>. Uploaded by Gwern Branwen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HFuse-0.1 HFuse]: HFuse is a binding for the Linux FUSE library.</p></li><br />
<br />
<li><p><em>GoogleChart 0.1</em>. Uploaded by Evan Martin.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/GoogleChart-0.1 GoogleChart]: Generate web-based charts using the Google Chart API.</p></li><br />
<br />
<li><p><em>Finance-Quote-Yahoo 0.5.0</em>. Uploaded by Brad Clawsie.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Finance-Quote-Yahoo-0.5.0 Finance-Quote-Yahoo]: Obtain quote data from finance.yahoo.com.</p></li><br />
<br />
<li><p><em>binary-strict 0.3.0</em>. Uploaded by Adam Langley.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/binary-strict-0.3.0 binary-strict]: Binary deserialisation using strict ByteStrings.</p></li><br />
<br />
<li><p><em>Stream 0.2.3</em>. Uploaded by Wouter Swierstra.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Stream-0.2.3 Stream]: A library for manipulating infinite lists..</p></li><br />
<br />
<li><p><em>Finance-Treasury 0.1.1</em>. Uploaded by Stephen Lihn.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Finance-Treasury-0.1.1 Finance-Treasury]: Obtain Treasury yield curve data.</p></li><br />
<br />
<li><p><em>Hedi 0.1</em>. Uploaded by Paolo Veronelli.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Hedi-0.1 Hedi]: Line oriented editor.</p></li><br />
<br />
<li><p><em>newports 1.1</em>. Uploaded by Brad Clawsie.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/newports-1.1 newports]: List ports newer than N days on a FreeBSD system.</p></li><br />
<br />
<li><p><em>Finance-Treasury 0.1</em>. Uploaded by Stephen Lihn.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Finance-Treasury-0.1 Finance-Treasury]: Obtain Treasury yield curve data.</p></li><br />
<br />
<li><p><em>GPLib 0.0</em>. Uploaded by Gwern Branwen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/GPLib-0.0 GPLib]: Generic library for genetic programming.</p></li><br />
<br />
<li><p><em>nano-hmac 0.1.1</em>. Uploaded by Hitesh Jasani.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/nano-hmac-0.1.1 nano-hmac]: Bindings to OpenSSL HMAC..</p></li><br />
<br />
<li><p><em>multiset 0.1</em>. Uploaded by Twan VanLaarhoven.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/multiset-0.1 multiset]: The Data.MultiSet container type.</p></li><br />
<br />
<li><p><em>hpodder 1.1.0</em>. Uploaded by John Goerzen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hpodder-1.1.0 hpodder]: Podcast Aggregator (downloader).</p></li><br />
<br />
<li><p><em>bimap 0.2.1</em>. Uploaded by Stuart Cook.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/bimap-0.2.1 bimap]: Bidirectional mapping between two key types.</p></li><br />
<br />
<li><p><em>monadLib 3.4.4</em>. Uploaded by Iavor Diatchki.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/monadLib-3.4.4 monadLib]: A collection of monad transformers..</p></li><br />
<br />
<li><p><em>IOSpec 0.2</em>. Uploaded by Wouter Swierstra.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/IOSpec-0.2 IOSpec]: A pure specification of the IO monad..</p></li><br />
<br />
<li><p><em>bimap 0.2</em>. Uploaded by Stuart Cook.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/bimap-0.2 bimap]: Bidirectional mapping between two key types.</p></li><br />
<br />
<li><p><em>strictify 0.1</em>. Uploaded by Sterling Clover.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/strictify-0.1 strictify]: Find a local optimum of strictness annotations..</p></li><br />
<br />
<li><p><em>heap 0.2.2</em>. Uploaded by Stephan Friedrichs.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/heap-0.2.2 heap]: Heaps in Haskell.</p></li><br />
<br />
<li><p><em>LDAP 0.6.4</em>. Uploaded by John Goerzen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/LDAP-0.6.4 LDAP]: Haskell binding for C LDAP API.</p></li><br />
<br />
<li><p><em>HStringTemplate 0.2</em>. Uploaded by Sterling Clover.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HStringTemplate-0.2 HStringTemplate]: StringTemplate implementation in Haskell..</p></li><br />
<br />
<li><p><em>RJson 0.3.2</em>. Uploaded by Alex Drummond.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/RJson-0.3.2 RJson]: A reflective JSON serializer/parser..</p></li><br />
<br />
<li><p><em>network-dns 0.1.1</em>. Uploaded by Adam Langley.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/network-dns-0.1.1 network-dns]: A pure Haskell, asyncronous DNS client library.</p></li><br />
<br />
<li><p><em>lcs 0.2</em>. Uploaded by Ian Lynagh.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/lcs-0.2 lcs]: Find longest common sublist of two lists.</p></li><br />
<br />
<li><p><em>tracker 0.1</em>. Uploaded by Will Thompson.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/tracker-0.1 tracker]: Client library for Tracker metadata database, indexer and search tool.</p></li><br />
<br />
<li><p><em>CC-delcont 0.2</em>. Uploaded by Dan Doel.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/CC-delcont-0.2 CC-delcont]: Delimited continuations and dynamically scoped variables.</p></li><br />
<br />
<li><p><em>control-timeout 0.1.2</em>. Uploaded by Adam Langley.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/control-timeout-0.1.2 control-timeout]: Timeout handling.</p></li><br />
<br />
<li><p><em>network-dns 0.1</em>. Uploaded by Adam Langley.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/network-dns-0.1 network-dns]: A pure Haskell, asyncronous DNS client library.</p></li><br />
<br />
<li><p><em>binary-strict 0.2.4</em>. Uploaded by Adam Langley.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/binary-strict-0.2.4 binary-strict]: Binary deserialisation using strict ByteStrings.</p></li><br />
<br />
<li><p><em>heap 0.1.1</em>. Uploaded by Stephan Friedrichs.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/heap-0.1.1 heap]: Heaps in Haskell.</p></li><br />
<br />
<li><p><em>HCL 1.3</em>. Uploaded by Justin Bailey.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HCL-1.3 HCL]: High-level library for building command line interfaces..</p></li><br />
<br />
<li><p><em>yi 0.3</em>. Uploaded by Jean PhilippeBernardy.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/yi-0.3 yi]: The Haskell-Scriptable Editor.</p></li><br />
<br />
<li><p><em>binary-strict 0.2.3</em>. Uploaded by Adam Langley.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/binary-strict-0.2.3 binary-strict]: Binary deserialisation using strict ByteStrings.</p></li><br />
<br />
<li><p><em>heap 0.1</em>. Uploaded by Stephan Friedrichs.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/heap-0.1 heap]: Heaps in Haskell.</p></li><br />
<br />
<li><p><em>pureMD5 0.1.2</em>. Uploaded by Thomas DuBuisson.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/pureMD5-0.1.2 pureMD5]: MD5 implementations that should become part of a ByteString Crypto package..</p></li><br />
<br />
<li><p><em>RJson 0.3.1</em>. Uploaded by Alex Drummond.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/RJson-0.3.1 RJson]: A reflective JSON serializer/parser..</p></li><br />
<br />
<li><p><em>template 0.1.1.1</em>. Uploaded by Johan Tibell.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/template-0.1.1.1 template]: Simple string substitution.</p></li><br />
<br />
<li><p><em>network-bytestring 0.1.1.1</em>. Uploaded by Johan Tibell.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/network-bytestring-0.1.1.1 network-bytestring]: Fast and memory efficient low-level networking.</p></li><br />
<br />
<li><p><em>ftphs 1.0.4</em>. Uploaded by John Goerzen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/ftphs-1.0.4 ftphs]: FTP Client and Server Library.</p></li><br />
<br />
<li><p><em>mersenne-random-pure64 0.1.1</em>. Uploaded by Donald Stewart.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/mersenne-random-pure64-0.1.1 mersenne-random-pure64]: Generate high quality pseudorandom numbers purely using a Mersenne Twister.</p></li><br />
<br />
<li><p><em>Diff 0.1</em>. Uploaded by Sterling Clover.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Diff-0.1 Diff]: O(ND) diff algorithm in haskell..</p></li><br />
<br />
<li><p><em>crack 0.1</em>. Uploaded by Trevor Elliott.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/crack-0.1 crack]: A haskell binding to cracklib.</p></li><br />
<br />
<li><p><em>miniplex 0.3.3</em>. Uploaded by Lukas Mai.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/miniplex-0.3.3 miniplex]: simple 1-to-N interprocess communication.</p></li><br />
<br />
<li><p><em>colock 0.2.2</em>. Uploaded by Lukas Mai.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/colock-0.2.2 colock]: thread-friendly file locks that don't block the entire program.</p></li><br />
<br />
<li><p><em>mersenne-random-pure64 0.1</em>. Uploaded by Donald Stewart.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/mersenne-random-pure64-0.1 mersenne-random-pure64]: Generate high quality pseudorandom numbers purely using a Mersenne Twister.</p></li><br />
<br />
<li><p><em>network-rpca 0.0.1</em>. Uploaded by Adam Langley.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/network-rpca-0.0.1 network-rpca]: A cross-platform RPC library.</p></li><br />
<br />
<li><p><em>xmonad-contrib 0.6</em>. Uploaded by Spencer Janssen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/xmonad-contrib-0.6 xmonad-contrib]: Third party extensions for xmonad.</p></li><br />
<br />
<li><p><em>xmonad 0.6</em>. Uploaded by Spencer Janssen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/xmonad-0.6 xmonad]: A tiling window manager.</p></li><br />
<br />
<li><p><em>codec-libevent 0.1.2</em>. Uploaded by Adam Langley.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/codec-libevent-0.1.2 codec-libevent]: Cross-platform structure serialisation.</p></li><br />
<br />
<li><p><em>bytestringparser 0.3</em>. Uploaded by Bryan OSullivan.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/bytestringparser-0.3 bytestringparser]: Combinator parsing with Data.ByteString.Lazy.</p></li><br />
<br />
<li><p><em>HStringTemplate 0.2</em>. Uploaded by Sterling Clover.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HStringTemplate-0.2 HStringTemplate]: StringTemplate implementation in Haskell..</p></li><br />
<br />
<li><p><em>value-supply 0.1</em>. Uploaded by Iavor Diatchki.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/value-supply-0.1 value-supply]: A library for generating values without having to thread state..</p></li><br />
<br />
<li><p><em>derive 0.1.1</em>. Uploaded by Neil Mitchell.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/derive-0.1.1 derive]: A program and library to derive instances for data types.</p></li><br />
<br />
<li><p><em>control-timeout 0.1.1</em>. Uploaded by Adam Langley.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/control-timeout-0.1.1 control-timeout]: Timeout handling.</p></li><br />
<br />
<li><p><em>mkcabal 0.4.1</em>. Uploaded by Donald Stewart.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/mkcabal-0.4.1 mkcabal]: Generate cabal files for a Haskell project.</p></li><br />
<br />
<li><p><em>regexpr 0.2.9</em>. Uploaded by Yoshikuni Jujo.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/regexpr-0.2.9 regexpr]: regular expression like Perl/Ruby in Haskell.</p></li><br />
<br />
<li><p><em>mtlparse 0.0.0.5</em>. Uploaded by Yoshikuni Jujo.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/mtlparse-0.0.0.5 mtlparse]: parse library use mtl package.</p></li><br />
<br />
<li><p><em>cgi 3001.1.5.2</em>. Uploaded by Bjorn Bringert.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/cgi-3001.1.5.2 cgi]: A library for writing CGI programs.</p></li><br />
<br />
<li><p><em>xhtml 3000.0.2.2</em>. Uploaded by Bjorn Bringert.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/xhtml-3000.0.2.2 xhtml]: An XHTML combinator library.</p></li><br />
<br />
<li><p><em>harpy 0.4</em>. Uploaded by Martin Grabmueller.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/harpy-0.4 harpy]: Runtime code generation for x86 machine code.</p></li><br />
<br />
<li><p><em>editline 0.2</em>. Uploaded by Judah Jacobson.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/editline-0.2 editline]: Bindings to the editline library (libedit)..</p></li><br />
<br />
<li><p><em>hmatrix 0.2.0.0</em>. Uploaded by Alberto Ruiz.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hmatrix-0.2.0.0 hmatrix]: Linear algebra and numerical computations.</p></li><br />
<br />
<li><p><em>regexpr 0.2.8</em>. Uploaded by Yoshikuni Jujo.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/regexpr-0.2.8 regexpr]: regular expression like Perl/Ruby in Haskell.</p></li><br />
<br />
<li><p><em>pcre-light 0.3</em>. Uploaded by Donald Stewart.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/pcre-light-0.3 pcre-light]: A small, efficient and portable regex library for Perl 5 compatible regular expressions.</p></li><br />
<br />
<li><p><em>mersenne-random 0.1</em>. Uploaded by Donald Stewart.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/mersenne-random-0.1 mersenne-random]: Generate high quality pseudorandom numbers using a SIMD Fast Mersenne Twister.</p></li><br />
<br />
<li><p><em>AvlTree 2.4</em>. Uploaded by Adrian Hey.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/AvlTree-2.4 AvlTree]: Balanced binary trees using AVL algorithm..</p></li><br />
<br />
<li><p><em>fec 0.1.1</em>. Uploaded by Adam Langley.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/fec-0.1.1 fec]: Forward error correction of ByteStrings.</p></li><br />
<br />
<li><p><em>COrdering 2.1</em>. Uploaded by Adrian Hey.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/COrdering-2.1 COrdering]: An algebraic data type similar to Prelude Ordering..</p></li><br />
<br />
<li><p><em>i18n 0.3</em>. Uploaded by Eugene Grigoriev.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/i18n-0.3 i18n]: Internationalization for Haskell.</p></li><br />
<br />
<li><p><em>binary-strict 0.2.2</em>. Uploaded by Adam Langley.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/binary-strict-0.2.2 binary-strict]: Binary deserialisation using strict ByteStrings.</p></li><br />
<br />
<li><p><em>regexpr 0.2.6</em>. Uploaded by Yoshikuni Jujo.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/regexpr-0.2.6 regexpr]: regular expression like Perl/Ruby in Haskell.</p></li><br />
<br />
<li><p><em>RJson 0.2</em>. Uploaded by Alex Drummond.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/RJson-0.2 RJson]: A reflective JSON serializer/parser..</p></li><br />
<br />
<li><p><em>regexpr 0.2.5</em>. Uploaded by Yoshikuni Jujo.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/regexpr-0.2.5 regexpr]: regular expression like Perl/Ruby in Haskell.</p></li><br />
<br />
<li><p><em>fec 0.1</em>. Uploaded by Adam Langley.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/fec-0.1 fec]: Forward error correction of ByteStrings.</p></li><br />
<br />
<li><p><em>dataenc 0.10.2</em>. Uploaded by Magnus Therning.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/dataenc-0.10.2 dataenc]: Data encoding library.</p></li><br />
<br />
<li><p><em>regexpr 0.2.3</em>. Uploaded by Yoshikuni Jujo.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/regexpr-0.2.3 regexpr]: regular expression like Perl/Ruby in Haskell.</p></li><br />
<br />
<li><p><em>regexpr 0.2.2</em>. Uploaded by Yoshikuni Jujo.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/regexpr-0.2.2 regexpr]: regular expression like Perl/Ruby in Haskell.</p></li><br />
<br />
<li><p><em>reactive 0.3</em>. Uploaded by Conal Elliott.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/reactive-0.3 reactive]: Simple foundation for functional reactive programming.</p></li><br />
<br />
<li><p><em>regexpr 0.2.1</em>. Uploaded by Yoshikuni Jujo.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/regexpr-0.2.1 regexpr]: regular expression like Perl/Ruby in Haskell.</p></li><br />
<br />
<li><p><em>djinn 2008.1.18</em>. Uploaded by Lennart Augustsson.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/djinn-2008.1.18 djinn]: Generate Haskell code from a type.</p></li><br />
<br />
<li><p><em>Etherbunny 0.3</em>. Uploaded by Nicholas Burlett.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Etherbunny-0.3 Etherbunny]: A network analysis toolkit for Haskell.</p></li><br />
<br />
<li><p><em>regexpr 0.2.0</em>. Uploaded by Yoshikuni Jujo.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/regexpr-0.2.0 regexpr]: regular expression like Perl/Ruby in Haskell.</p></li><br />
<br />
<li><p><em>RJson 0.1</em>. Uploaded by Alex Drummond.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/RJson-0.1 RJson]: A reflective JSON serializer/parser..</p></li><br />
<br />
<li><p><em>RJson 0.1</em>. Uploaded by Alex Drummond.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/RJson-0.1 RJson]: A reflective JSON serializer/parser..</p></li><br />
<br />
<li><p><em>regexpr 0.1.7</em>. Uploaded by Yoshikuni Jujo.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/regexpr-0.1.7 regexpr]: regular expression like Perl/Ruby in Haskell.</p></li><br />
<br />
<li><p><em>reactive 0.2</em>. Uploaded by Conal Elliott.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/reactive-0.2 reactive]: Simple foundation for functional reactive programming.</p></li><br />
<br />
<li><p><em>srcinst 0.8.10</em>. Uploaded by John Goerzen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/srcinst-0.8.10 srcinst]: Build and install Debian packages completely from source.</p></li><br />
<br />
<li><p><em>dfsbuild 1.0.2</em>. Uploaded by John Goerzen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/dfsbuild-1.0.2 dfsbuild]: Build Debian From Scratch CD/DVD images.</p></li><br />
<br />
<li><p><em>darcs-buildpackage 0.5.12</em>. Uploaded by John Goerzen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/darcs-buildpackage-0.5.12 darcs-buildpackage]: Tools to help manage Debian packages with Darcs.</p></li><br />
<br />
<li><p><em>anydbm 1.0.5</em>. Uploaded by John Goerzen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/anydbm-1.0.5 anydbm]: Interface for DBM-like database systems.</p></li><br />
<br />
<li><p><em>HDBC-sqlite3 1.1.4.0</em>. Uploaded by John Goerzen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HDBC-sqlite3-1.1.4.0 HDBC-sqlite3]: Sqlite v3 driver for HDBC.</p></li><br />
<br />
<li><p><em>HDBC-postgresql 1.1.4.0</em>. Uploaded by John Goerzen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HDBC-postgresql-1.1.4.0 HDBC-postgresql]: PostgreSQL driver for HDBC.</p></li><br />
<br />
<li><p><em>HDBC-odbc 1.1.4.0</em>. Uploaded by John Goerzen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HDBC-odbc-1.1.4.0 HDBC-odbc]: ODBC driver for HDBC.</p></li><br />
<br />
<li><p><em>magic 1.0.7</em>. Uploaded by John Goerzen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/magic-1.0.7 magic]: Interface to C file/magic library.</p></li><br />
<br />
<li><p><em>ListLike 1.0.1</em>. Uploaded by John Goerzen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/ListLike-1.0.1 ListLike]: Generic support for list-like structures.</p></li><br />
<br />
<li><p><em>LDAP 0.6.3</em>. Uploaded by John Goerzen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/LDAP-0.6.3 LDAP]: Haskell binding for C LDAP API.</p></li><br />
<br />
<li><p><em>hg-buildpackage 1.0.4</em>. Uploaded by John Goerzen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hg-buildpackage-1.0.4 hg-buildpackage]: Tools to help manage Debian packages with Mercurial.</p></li><br />
<br />
<li><p><em>HDBC 1.1.4</em>. Uploaded by John Goerzen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HDBC-1.1.4 HDBC]: Haskell Database Connectivity.</p></li><br />
<br />
<li><p><em>HSH 1.2.5</em>. Uploaded by John Goerzen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HSH-1.2.5 HSH]: Library to mix shell scripting with Haskell programs.</p></li><br />
<br />
<li><p><em>editline 0.1</em>. Uploaded by Judah Jacobson.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/editline-0.1 editline]: Bindings to the editline library (libedit)..</p></li><br />
<br />
<li><p><em>pureMD5 0.1.1</em>. Uploaded by Thomas DuBuisson.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/pureMD5-0.1.1 pureMD5]: MD5 implementations that should become part of a ByteString Crypto package..</p></li><br />
<br />
<li><p><em>hmp3 1.4</em>. Uploaded by Donald Stewart.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hmp3-1.4 hmp3]: An ncurses mp3 player written in Haskell.</p></li><br />
<br />
<li><p><em>binary-strict 0.2.1</em>. Uploaded by Adam Langley.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/binary-strict-0.2.1 binary-strict]: Binary deserialisation using strict ByteStrings.</p></li><br />
<br />
<li><p><em>GLFW 0.3</em>. Uploaded by Paul Liu.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/GLFW-0.3 GLFW]: A binding for GLFW, An OpenGL Framework.</p></li><br />
<br />
<li><p><em>hbeat 0.1.1</em>. Uploaded by Tim Docker.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hbeat-0.1.1 hbeat]: A simple step sequencer GUI..</p></li><br />
<br />
<li><p><em>hackage2hwn 0.2.1</em>. Uploaded by Donald Stewart.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hackage2hwn-0.2.1 hackage2hwn]: Convert hackage = Hackage RSS feeds to Haskell Weekly News format.</p></li><br />
<br />
<li><p><em>tagsoup 0.4</em>. Uploaded by Neil Mitchell.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/tagsoup-0.4 tagsoup]: Parsing and extracting information from (possibly malformed) HTML documents.</p></li><br />
<br />
<li><p><em>HaXml 1.19.2</em>. Uploaded by Malcolm Wallace.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HaXml-1.19.2 HaXml]: Utilities for manipulating XML documents.</p></li><br />
<br />
<li><p><em>Emping 0.3.1</em>. Uploaded by Hans VanThiel.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Emping-0.3.1 Emping]: derives heuristic rules from nominal data.</p></li><br />
<br />
<li><p><em>hbeat 0.1</em>. Uploaded by Tim Docker.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hbeat-0.1 hbeat]: A simple step sequencer GUI..</p></li><br />
<br />
<li><p><em>Imlib 0.1.1</em>. Uploaded by Cale Gibbard.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Imlib-0.1.1 Imlib]: Added by CaleGibbard, Sun Jan 13 22:26:59 PST 2008..</p></li><br />
<br />
<li><p><em>pcre-light 0.2</em>. Uploaded by Donald Stewart.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/pcre-light-0.2 pcre-light]: A small, efficient and portable regex library for Perl 5 compatible regular expressions.</p></li><br />
<br />
<li><p><em>YamlReference 0.8</em>. Uploaded by Oren BenKiki.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/YamlReference-0.8 YamlReference]: YAML reference implementation.</p></li><br />
<br />
<li><p><em>ContArrow 0.0.4</em>. Uploaded by Evgeny Jukov.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/ContArrow-0.0.4 ContArrow]: Control.Arrow.Transformer.Cont.</p></li><br />
<br />
<li><p><em>ContArrow 0.0.3</em>. Uploaded by Evgeny Jukov.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/ContArrow-0.0.3 ContArrow]: Control.Arrow.Transformer.Cont.</p></li><br />
<br />
<li><p><em>mkcabal 0.4</em>. Uploaded by Donald Stewart.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/mkcabal-0.4 mkcabal]: Generate cabal files for a Haskell project.</p></li><br />
<br />
<li><p><em>pcre-light 0.1</em>. Uploaded by Donald Stewart.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/pcre-light-0.1 pcre-light]: A lightweight binding to PCRE.</p></li><br />
<br />
<li><p><em>YamlReference 0.7</em>. Uploaded by Oren BenKiki.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/YamlReference-0.7 YamlReference]: YAML reference implementation.</p></li><br />
<br />
<li><p><em>Crypto 4.1.0</em>. Uploaded by Dominic Steinitz.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Crypto-4.1.0 Crypto]: DES, Blowfish, AES, TEA, SHA1, MD5, RSA, BubbleBabble,<br />
Hexdump, Support for Word128, Word192 and Word256 and Beyond, PKCS5<br />
Padding, Various Encryption Modes e.g. Cipher Block Chaining all in one package..</p></li><br />
<br />
<li><p><em>containers 0.1.0.1</em>. Uploaded by Ross Paterson.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/containers-0.1.0.1 containers]: Assorted concrete container types.</p></li><br />
<br />
<li><p><em>ConfigFile 1.0.4</em>. Uploaded by John Goerzen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/ConfigFile-1.0.4 ConfigFile]: Configuration file reading & writing.</p></li><br />
<br />
<li><p><em>MissingH 1.0.0</em>. Uploaded by John Goerzen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/MissingH-1.0.0 MissingH]: Large utility library.</p></li><br />
<br />
<li><p><em>hslogger 1.0.4</em>. Uploaded by John Goerzen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hslogger-1.0.4 hslogger]: Versatile logging framework.</p></li><br />
<br />
<li><p><em>hslogger 1.0.2</em>. Uploaded by John Goerzen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hslogger-1.0.2 hslogger]: Versatile logging framework.</p></li><br />
<br />
<li><p><em>BerkeleyDB 0.3</em>. Uploaded by John McCall.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/BerkeleyDB-0.3 BerkeleyDB]: Bindings for Berkeley DB v1.x.</p></li><br />
<br />
<li><p><em>BitSyntax 0.3.2</em>. Uploaded by Adam Langley.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/BitSyntax-0.3.2 BitSyntax]: A module to aid in the (de)serialisation of binary data.</p></li><br />
<br />
<li><p><em>Hashell 0.15</em>. Uploaded by Gwern Branwen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Hashell-0.15 Hashell]: Simple shell written in Haskell.</p></li><br />
<br />
<li><p><em>binary-strict 0.2</em>. Uploaded by Adam Langley.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/binary-strict-0.2 binary-strict]: Binary deserialisation using strict ByteStrings.</p></li><br />
<br />
<li><p><em>Shu-thing 1.1</em>. Uploaded by Gwern Branwen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Shu-thing-1.1 Shu-thing]: A vector shooter game.</p></li><br />
<br />
<li><p><em>zlib 0.4.0.2</em>. Uploaded by Duncan Coutts.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/zlib-0.4.0.2 zlib]: Compression and decompression in the gzip and zlib formats.</p></li><br />
<br />
<li><p><em>i18n 0.2</em>. Uploaded by Eugene Grigoriev.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/i18n-0.2 i18n]: Internationalization for Haskell.</p></li><br />
<br />
<li><p><em>pandoc 0.46</em>. Uploaded by John MacFarlane.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/pandoc-0.46 pandoc]: Conversion between markup formats.</p></li><br />
<br />
<li><p><em>hscolour 1.9</em>. Uploaded by Malcolm Wallace.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hscolour-1.9 hscolour]: Colourise Haskell code..</p></li><br />
<br />
<li><p><em>regex-pcre 0.94.1</em>. Uploaded by ChrisKuklewicz.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/regex-pcre-0.94.1 regex-pcre]: Replaces/Enhances Text.Regex.</p></li><br />
<br />
<li><p><em>regex-posix 0.93.1</em>. Uploaded by Chris Kuklewicz.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/regex-posix-0.93.1 regex-posix]: Replaces/Enhances Text.Regex.</p></li><br />
<br />
<li><p><em>regex-base 0.93.1</em>. Uploaded by Chris Kuklewicz.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/regex-base-0.93.1 regex-base]: Replaces/Enhances Text.Regex.</p></li><br />
<br />
<li><p><em>regex-compat 0.91</em>. Uploaded by Chris Kuklewicz.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/regex-compat-0.91 regex-compat]: Replaces/Enhances Text.Regex.</p></li><br />
<br />
<li><p><em>haddock 2.0.0.0</em>. Uploaded by David Waern.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/haddock-2.0.0.0 haddock]: Added by DavidWaern</p></li></ul><br />
<br />
''2008-01-05''<br />
<br />
<ul><li><p><em>GHC 6.8.2</em>. The GHC Team<br />
[http://www.haskell.org/ghc/download_ghc_682.html announced] the release of GHC 6.8.2, featuring optimisation improvements, improvements to ghci and fixes to standalone deriving.</p></li><br />
<br />
<li><p><em>nhc98 1.2 released</em>. Malcolm Wallace<br />
[http://archive.fo/gBd5y announced] the release of nhc98 1.2.<br />
1.20 is a refreshed release with many of the current core library packages included, and a variety of small bugfixes since the last release. It successfully compiles and runs more programs from the nobench suite than jhc, hbc, Hugs, or yhc. It generates an interpreted bytecode that, on the whole runs faster than that generated by Hugs or yhc, and in many cases is also faster than ghci. Although nhc98 is written in Haskell, you don't need an existing Haskell compiler on your platform to build nhc98 - a C compiler will do. Hence, it is portable to almost any unix-like machine with a 32-bit compatibility mode. Many useful build tools come included: hmake (the inspiration for ghc --make), hi (interactive read-eval-print, like Hugs or ghci), cpphs (Haskell-aware replacement for cpp) and hsc2hs (preprocessor for FFI code)</p></li><br />
<br />
<li><p><em>darcs 2.0.0pre2</em>. David Roundy<br />
[http://archive.fo/JPvR4 announced] the availability of the second prerelease of [http://darcs.net darcs two], darcs 2.0.0pre2. This release fixes several severe performance bugs that were present in the first prerelease. These issues were identified and fixed thanks to the helpful testing of Simon Marlow and Peter Rockai. We also added support for compilation under ghc 6.4, so even more users should be able to test this release.</p></li><br />
<br />
<li><p><em>The Monad.Reader Issue 9: SoC special</em>. Wouter Swierstra<br />
[http://archive.fo/w0QFo announced] a new issue of The Monad.Reader, a 'Summer of Code Special' - it consists of three articles from student participants of Google's Summer of Code, describing the projects they worked on.</p></li><br />
<br />
<li><p><em>What's happening with Haskell? The 13th HCAR</em>. Andres Loeh<br />
[http://www.haskell.org/communities/ announced] the 13th edition of the Haskell Communities and Activities Report</p></li><br />
<br />
<li><p><em>Teach yourself gtk2hs in 21 hours</em>. Hans van Thiel <br />
[http://archive.fo/8qbgJ announced] a Gtk2Hs basics tutorial, based on the Tony Gale and Ian Main GTK+2.0 tutorial, is now available for review and comment.</p></li><br />
<br />
<li><p><em>Minimalistic Haskell blog framework</em>. Paul Brown<br />
[http://archive.fo/leQtp announced] a lightweight, experimental blog publishing application, [http://datapr0n.com/repos/perpubplat perpubplat</p></li><br />
<br />
<li><p><em>atom</em>. Tom Hawkins<br />
[http://www.haskell.org/pipermail/haskell-cafe/2007-December/035742.html announced] the release of atom 2007.12; atom is a domain-specific language embedded in Haskell for describing real-time control applications</p></li></ul><br />
<ul><li><p><em>bytestring 0.9.0.4</em>. Uploaded by DonaldStewart.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/bytestring-0.9.0.4 bytestring]: Fast, packed, strict and lazy byte arrays with a list interface.</p></li><br />
<br />
<li><p><em>uuagc 0.9.5</em>. Uploaded by ArieMiddelkoop.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/uuagc-0.9.5 uuagc]: Attribute Grammar System of Universiteit Utrecht.</p></li><br />
<br />
<li><p><em>uulib 0.9.5</em>. Uploaded by ArieMiddelkoop.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/uulib-0.9.5 uulib]: Haskell Utrecht Tools Library.</p></li><br />
<br />
<li><p><em>llvm 0.0.2</em>. Uploaded by BryanOSullivan.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/llvm-0.0.2 llvm]: Bindings to the LLVM compiler toolkit.</p></li><br />
<br />
<li><p><em>HDBC-sqlite3 1.1.3.1</em>. Uploaded by JohnGoerzen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HDBC-sqlite3-1.1.3.1 HDBC-sqlite3]: Sqlite v3 driver for HDBC.</p></li><br />
<br />
<li><p><em>HDBC-odbc 1.1.3.1</em>. Uploaded by JohnGoerzen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HDBC-odbc-1.1.3.1 HDBC-odbc]: ODBC driver for HDBC.</p></li><br />
<br />
<li><p><em>dimensional 0.7.2</em>. Uploaded by BjornBuckwalter.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/dimensional-0.7.2 dimensional]: Statically checked physical dimensions..</p></li><br />
<br />
<li><p><em>uulib 0.9.5</em>. Uploaded by ArieMiddelkoop.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/uulib-0.9.5 uulib]: Haskell Utrecht Tools Library.</p></li><br />
<br />
<li><p><em>hsc3 0.1</em>. Uploaded by RohanDrape.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hsc3-0.1 hsc3]: Haskell SuperCollider.</p></li><br />
<br />
<li><p><em>hosc 0.1</em>. Uploaded by RohanDrape.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hosc-0.1 hosc]: Haskell Open Sound Control.</p></li><br />
<br />
<li><p><em>GLFW 0.2</em>. Uploaded by PaulLiu.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/GLFW-0.2 GLFW]: A binding for GLFW, An OpenGL Framework.</p></li><br />
<br />
<li><p><em>control-timeout 0.1</em>. Uploaded by AdamLangley.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/control-timeout-0.1 control-timeout]: Timeout handling.</p></li><br />
<br />
<li><p><em>hiccup 0.35</em>. Uploaded by KyleConsalus.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hiccup-0.35 hiccup]: Relatively efficient Tcl interpreter with support for basic operations.</p></li><br />
<br />
<li><p><em>phooey 2.0</em>. Uploaded by ConalElliott.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/phooey-2.0 phooey]: Functional user interfaces.</p></li><br />
<br />
<li><p><em>reactive 0.0</em>. Uploaded by ConalElliott.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/reactive-0.0 reactive]: Simple foundation for functional reactive programming.</p></li><br />
<br />
<li><p><em>phooey 1.4</em>. Uploaded by ConalElliott.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/phooey-1.4 phooey]: Functional user interfaces.</p></li><br />
<br />
<li><p><em>hburg 1.1.1</em>. Uploaded by IgorBohm.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hburg-1.1.1 hburg]: Haskell Bottom Up Rewrite Generator.</p></li><br />
<br />
<li><p><em>hinotify 0.2</em>. Uploaded by LennartKolmodin.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hinotify-0.2 hinotify]: Haskell binding to INotify.</p></li><br />
<br />
<li><p><em>cabal-rpm 0.3.3</em>. Uploaded by BryanOSullivan.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/cabal-rpm-0.3.3 cabal-rpm]: RPM package builder for Haskell Cabal source packages..</p></li><br />
<br />
<li><p><em>codec-libevent 0.1</em>. Uploaded by AdamLangley.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/codec-libevent-0.1 codec-libevent]: Cross-platform structure serialisation.</p></li><br />
<br />
<li><p><em>irc 0.4</em>. Uploaded by TrevorElliott.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/irc-0.4 irc]: A small library for parsing IRC messages..</p></li><br />
<br />
<li><p><em>dlist 0.4</em>. Uploaded by DonaldStewart.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/dlist-0.4 dlist]: Differences lists.</p></li><br />
<br />
<li><p><em>AutoForms 0.4.0</em>. Uploaded by MadsLindstroem.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/AutoForms-0.4.0 AutoForms]: GUI library based upon generic programming (SYB3).</p></li><br />
<br />
<li><p><em>bktrees 0.2.1</em>. Uploaded by JosefSvenningsson.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/bktrees-0.2.1 bktrees]: A set data structure with approximate searching.</p></li><br />
<br />
<li><p><em>bktrees 0.2</em>. Uploaded by JosefSvenningsson.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/bktrees-0.2 bktrees]: A set data structure with approximate searching.</p></li><br />
<br />
<li><p><em>binary-strict 0.1</em>. Uploaded by AdamLangley.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/binary-strict-0.1 binary-strict]: Binary deserialisation using strict ByteStrings.</p></li><br />
<br />
<li><p><em>haddock 0.9</em>. Uploaded by SimonMarlow.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/haddock-0.9 haddock]: Haddock is a documentation-generation tool for Haskell libraries.</p></li><br />
<br />
<li><p><em>bytestring-mmap 0.2.0</em>. Uploaded by DonaldStewart.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/bytestring-mmap-0.2.0 bytestring-mmap]: mmap support for strict ByteStrings.</p></li><br />
<br />
<li><p><em>bytestring 0.9.0.3</em>. Uploaded by DonaldStewart.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/bytestring-0.9.0.3 bytestring]: Fast, packed, strict and lazy byte arrays with a list interface.</p></li><br />
<br />
<li><p><em>hiccup 0.3</em>. Uploaded by KyleConsalus.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hiccup-0.3 hiccup]: Added by KyleConsalus, Wed Dec 19 17:00:42 PST 2007..</p></li><br />
<br />
<li><p><em>cedict 0.1.1</em>. Uploaded by JasonDusek.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/cedict-0.1.1 cedict]: Convenient Chinese character lookup..</p></li><br />
<br />
<li><p><em>TypeCompose 0.3</em>. Uploaded by ConalElliott.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/TypeCompose-0.3 TypeCompose]: Type composition classes & instances.</p></li><br />
<br />
<li><p><em>bytestring-mmap 0.1.2</em>. Uploaded by DonaldStewart.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/bytestring-mmap-0.1.2 bytestring-mmap]: mmap support for strict ByteStrings.</p></li><br />
<br />
<li><p><em>bytestring 0.9.0.2</em>. Uploaded by DonaldStewart.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/bytestring-0.9.0.2 bytestring]: Fast, packed, strict and lazy byte arrays with a list interface.</p></li><br />
<br />
<li><p><em>bytestring-mmap 0.1.1</em>. Uploaded by DonaldStewart.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/bytestring-mmap-0.1.1 bytestring-mmap]: mmap support for strict ByteStrings.</p></li><br />
<br />
<li><p><em>mkcabal 0.3</em>. Uploaded by DonaldStewart.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/mkcabal-0.3 mkcabal]: Generate cabal files for a Haskell project.</p></li><br />
<br />
<li><p><em>terminfo 0.1</em>. Uploaded by Judah Jacobson.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/terminfo-0.1 terminfo]: Haskell bindings to the terminfo library..</p></li><br />
<br />
<li><p><em>Cabal 1.2.3.0</em>. Uploaded by Duncan Coutts.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Cabal-1.2.3.0 Cabal]: A framework for packaging Haskell software.</p></li><br />
<br />
<li><p><em>hxt 7.4</em>. Uploaded by UweSchmidt.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hxt-7.4 hxt]: A collection of tools for processing XML with Haskell..</p></li><br />
<br />
<li><p><em>X11 1.4.1</em>. Uploaded by Spencer Janssen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/X11-1.4.1 X11]: A binding to the X11 graphics library.</p></li><br />
<br />
<li><p><em>dataenc 0.10.1</em>. Uploaded by Magnus Therning.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/dataenc-0.10.1 dataenc]: Data encoding library currently providing Uuencode, Base64,<br />
Base64Url, Base32, Base32Hex, and Base16..</p></li><br />
<br />
<li><p><em>bytestringreadp 0.1</em>. Uploaded by Gracjan Polak.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/bytestringreadp-0.1 bytestringreadp]: A ReadP style parser library for ByteString.</p></li><br />
<br />
<li><p><em>encoding 0.3</em>. Uploaded by HenningGuenther.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/encoding-0.3 encoding]: A library for various character encodings.</p></li><br />
<br />
<li><p><em>hslua 0.2</em>. Uploaded by Gracjan Polak.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hslua-0.2 hslua]: A Lua language interpreter embedding in Haskell.</p></li><br />
<br />
<li><p><em>xmonad-contrib 0.5</em>. Uploaded by Spencer Janssen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/xmonad-contrib-0.5 xmonad-contrib]: Third party extensions for xmonad.</p></li><br />
<br />
<li><p><em>xmonad 0.5</em>. Uploaded by SpencerJanssen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/xmonad-0.5 xmonad]: A tiling window manager.</p></li><br />
<br />
<li><p><em>pandoc 0.45</em>. Uploaded by John MacFarlane.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/pandoc-0.45 pandoc]: Conversion between markup formats.</p></li><br />
<br />
<li><p><em>markov-chain 0.0.1</em>. Uploaded by Henning Thielemann.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/markov-chain-0.0.1 markov-chain]: Markov Chains for generating random sequences with a user definable behaviour..</p></li><br />
<br />
<li><p><em>parsedate 3000.0.0</em>. Uploaded by Bjorn Bringert.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/parsedate-3000.0.0 parsedate]: Data and time parsing for CalendarTime.</p></li><br />
<br />
<li><p><em>hackage2hwn 0.1</em>. Uploaded by Don Stewart.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hackage2hwn-0.1 hackage2hwn]: Convert hackage = Hackage RSS feeds to Haskell Weekly News format.</p></li><br />
<br />
<li><p><em>hask-home 2007.12.6</em>. Uploaded by BjornBringert.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hask-home-2007.12.6 hask-home]: Generate homepages for cabal packages.</p></li><br />
<br />
<li><p><em>hmarkup 3000.0.1</em>. Uploaded by BjornBringert.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hmarkup-3000.0.1 hmarkup]: Simple wikitext-like markup format implementation..</p></li><br />
<br />
<li><p><em>hspread 0.2</em>. Uploaded by AndreaVezzosi.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hspread-0.2 hspread]: A client library for the spread toolkit.</p></li><br />
<br />
<li><p><em>pcap 0.4.2</em>. Uploaded by BryanOSullivan.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/pcap-0.4.2 pcap]: A system-independent interface for user-level packet capture.</p></li><br />
<br />
<li><p><em>hogg 0.3.0</em>. Uploaded by ConradParker.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hogg-0.3.0 hogg]: Library and tools to manipulate the Ogg container format.</p></li><br />
<br />
<li><p><em>Finance-Quote-Yahoo 0.4.1</em>. Uploaded by BradClawsie.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Finance-Quote-Yahoo-0.4.1 Finance-Quote-Yahoo]: Obtain quote data from finance.yahoo.com.</p></li><br />
<br />
<li><p><em>Monadius 0.9.20071204</em>. Uploaded by GwernBranwen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Monadius-0.9.20071204 Monadius]: 2-D arcade scroller.</p></li><br />
<br />
<li><p><em>Shu-thing 1.0.20071203</em>. Uploaded by GwernBranwen.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Shu-thing-1.0.20071203 Shu-thing]: A vector shooter game.</p></li><br />
<br />
<li><p><em>hmatrix 0.1.1.0</em>. Uploaded by AlbertoRuiz.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hmatrix-0.1.1.0 hmatrix]: Linear algebra and numerical computations.</p></li><br />
<br />
<li><p><em>HTTP 3001.0.3</em>. Uploaded by BjornBringert.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HTTP-3001.0.3 HTTP]: Added by BjornBringert, Fri Nov 30 14:50:55 PST 2007..</p></li><br />
<br />
<li><p><em>rss 3000.0.1</em>. Uploaded by BjornBringert.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/rss-3000.0.1 rss]: A library for generating RSS 2.0 feeds..</p></li><br />
<br />
<li><p><em>haxr 3000.0.1</em>. Uploaded by BjornBringert.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/haxr-3000.0.1 haxr]: XML-RPC client and server library..</p></li><br />
<br />
<li><p><em>fitsio 0.1</em>. Uploaded by EricSessoms.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/fitsio-0.1 fitsio]: A library for reading and writing data files in the FITS data format..</p></li><br />
<br />
<li><p><em>YamlReference 0.6</em>. Uploaded by Oren Ben Kiki.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/YamlReference-0.6 YamlReference], YAML reference implementation</p></li><br />
<br />
<li><p><em>LambdaShell 0.9.1</em>. Uploaded by Robert Dockins.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/LambdaShell-0.9.1 LambdaShell], simple shell for evaluating lambda expressions</p></li><br />
<br />
<li><p><em>Shellac 0.9.1</em>. Uploaded by Robert Dockins.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Shellac-0.9.1 Shellac], a framework for creating shell envinronments</p></li><br />
<br />
<li><p><em>EdisonCore 1.2.1.1</em>. Uploaded by Robert Dockins.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/EdisonCore-1.2.1.1 EdisonCore], a library of efficent, purely-functional data structures (Core Implementations)</p></li><br />
<br />
<li><p><em>hmatrix 0.1.0.0</em>. Uploaded by Alberto Ruiz.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hmatrix-0.1.0.0 hmatrix], linear algebra and numerical computations</p></li><br />
<br />
<li><p><em>strict-concurrency 0.1</em>. Uploaded by Don Stewart.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/strict-concurrency-0.1 strict-concurrency], strict concurrency abstractions</p></li><br />
<br />
<li><p><em>X11 1.4.0</em>. Uploaded by Don Stewart.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/X11-1.4.0 X11], binding to the X11 graphics library</p></li><br />
<br />
<li><p><em>safecopy 0.3</em>. Uploaded by David Himmelstrup.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/safecopy-0.3 safecopy], binary serialization with version control</p></li><br />
<br />
<li><p><em>HaXml 1.13.3</em>. Uploaded by Malcolm Wallace.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HaXml-1.13.3 HaXml], utilities for manipulating XML documents</p></li><br />
<br />
<li><p><em>c2hs 0.15.1</em>. Uploaded by Duncan Coutts.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/c2hs-0.15.1 c2hs], C->Haskell Interface Generator</p></li><br />
<br />
<li><p><em>calc 0.1</em>. Uploaded by Austin Seipp.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/calc-0.1 calc], small compiler for arithmetic expressions.</p></li><br />
<br />
<li><p><em>miniplex 0.2.1</em>. Uploaded by Lukas Mai.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/miniplex-0.2.1 miniplex], simple 1-to-N interprocess communication</p></li><br />
<br />
<li><p><em>sat 1.1.1</em>. Uploaded by Andrii Zvorygin.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/sat-1.1.1 sat], CNF SATisfier</p></li><br />
<br />
<li><p><em>dimensional 0.7.1</em>. Uploaded by Bjorn Buckwalter.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/dimensional-0.7.1 dimensional], statically checked physical dimensions</p></li><br />
<br />
<li><p><em>hxt 7.4</em>. Uploaded by Uwe Schmidt.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hxt-7.4 hxt], collection of tools for processing XML with Haskell.</p></li><br />
<br />
<li><p><em>dlist 0.3.2</em>. Uploaded by Don Stewart.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/dlist-0.3.2 dlist], difference lists. A list type supporting fast append.</p></li><br />
<br />
<li><p><em>mkcabal 0.2</em>. Uploaded by Don Stewart.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/mkcabal-0.2 mkcabal], generate cabal files for a Haskell project</p></li><br />
<br />
<li><p><em>Chart 0.5</em>. Uploaded by Tim Docker.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Chart-0.5 Chart], a library for generating 2D Charts and Plots</p></li><br />
<br />
<li><p><em>MaybeT 0.1.1</em>. Uploaded by Don Stewart.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/MaybeT-0.1.1 MaybeT], MaybeT monad transformer</p></li><br />
<br />
<li><p><em>regex-pcre 0.93</em>. Uploaded by Chris Kuklewicz.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/regex-pcre-0.93 regex-pcre], replaces Text.Regex</p></li><br />
<br />
<li><p><em>fixpoint 0.1</em>. Uploaded by Roman Leshchinskiy.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/fixpoint-0.1 fixpoint], data types as fixpoints</p></li><br />
<br />
<li><p><em>ChasingBottoms 1.2.2</em>. Uploaded by Nils Anders Danielsson.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/ChasingBottoms-1.2.2 ChasingBottoms], support for testing partial and infinite values</p></li><br />
<br />
<li><p><em>GrowlNotify 0.3</em>. Uploaded by Nicholas Burlett.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/GrowlNotify-0.3 GrowlNotify], notification utility for Growl</p></li><br />
<br />
<li><p><em>pcap 0.4.1</em>. Uploaded by Bryan OSullivan.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/pcap-0.4.1 pcap], a system-independent interface for user-level packet capture</p></li><br />
<br />
<li><p><em>bencode 0.3</em>. Uploaded by David Himmelstrup.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/bencode-0.3 bencode], parser and printer for bencoded data.</p></li><br />
<br />
<li><p><em>stream-fusion 0.1.1</em>. Uploaded by Don Stewart.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/stream-fusion-0.1.1 stream-fusion], provides the standard Haskell list library reimplemented to allow stream fusion. This should in general provide faster list operations, and faster code for list-heavy programs.</p></li><br />
<br />
<li><p><em>HTTP 3001.0.2</em>. Uploaded by Bjorn Bringert.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HTTP-3001.0.2 HTTP], library for client-side HTTP</p></li><br />
<br />
<li><p><em>X11-xft 0.2</em>. Uploaded by Clemens Fruhwirth.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/X11-xft-0.2 X11-xft], bindings to the Xft, X Free Type interface library, and some Xrender parts</p></li><br />
<br />
<li><p><em>GrowlNotify 0.1</em>. Uploaded by Nicholas Burlett.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/GrowlNotify-0.1 GrowlNotify], notification utility for Growl.</p></li><br />
<br />
<li><p><em>HsHaruPDF 0.0.0</em>. Uploaded by Audrey Tang.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HsHaruPDF-0.0.0 HsHaruPDF], Haskell binding to libharu</p></li><br />
<br />
<li><p><em>unicode-normalization 0.1</em>. Uploaded by Reinier Lamers.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/unicode-normalization-0.1 unicode-normalization], Unicode normalization using the ICU library</p></li><br />
<br />
<li><p><em>uniplate 1.0.1</em>. Uploaded by Neil Mitchell.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/uniplate-1.0.1 uniplate], uniform type generic traversals</p></li><br />
<br />
<li><p><em>lax-0.0.0</em>. Uploaded by Wolfgang Jeltsch.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/lax-0.0.0 lax], Lax arrows are variants of other arrows which are ?less strict? than the original arrows. They can be used, for example, to produce I/O fixpoints in situations where fixIO would fail.</p></li><br />
<br />
<li><p><em>fastcgi 3001.0.1</em>. Uploaded by Bjorn Bringert.<br />
[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/fastcgi-3001.0.1 fastcgi], a Haskell library for writing FastCGI programs</p></li></ul><br />
<br />
==Archives by year==<br />
<br />
*[[News/2007|2007 Archives]]<br />
*[[News/2006|2006 Archives]]<br />
*[[News/2005|2005 Archives]]<br />
*[[News/2004|2004 Archives]]<br />
*[[News/2003|2003 Archives]]<br />
*[[News/2002|2002 Archives]]<br />
*[[News/2001|2001 Archives]]<br />
*[[News/2000|2000 Archives]]<br />
*[[News/1999|1999 Archives]]<br />
*[[News/1998|1998 Archives]]<br />
*[[News/1997|1997 Archives]]<br />
*[[News/1996|1996 Archives]]<br />
*[[News/1995|1995 Archives]]<br />
*[[News/1994|1994 Archives]]<br />
*[[News/1993|1993 Archives]]<br />
*[[News/1992|1992 Archives]]<br />
*[[News/1991|1991 Archives]]<br />
*[[News/1990|1990 Archives]]<br />
*[[News/1989|1989 Archives]]<br />
*[[News/1988|1988 Archives]]<br />
*[[News/1987|1987 Archives]]<br />
*[[News/1986|1986 Archives]]<br />
*[[News/1985|1985 Archives]]<br />
*[[News/1984|1984 Archives]]</div>Ysangkokhttps://wiki.haskell.org/index.php?title=Applications_and_libraries/Operating_system&diff=62998Applications and libraries/Operating system2019-08-15T19:17:23Z<p>Ysangkok: fix gmane links using archive.fo</p>
<hr />
<div>'''Operating Systems and Systems Programming'''<br />
<br />
See also [[Research papers/Program development#Operating systems|research papers on this topic]].<br />
<br />
__TOC__<br />
<br />
== Applications ==<br />
<br />
=== Standalone operating systems ===<br />
<br />
;[http://programatica.cs.pdx.edu/House/ House]<br />
:House is a platform for exploring various ideas relating to low-level and system-level programming in a high-level functional language, or in short for building operating systems in Haskell. [http://archive.is/ZFSEi A more up to date, unofficial version.]<br />
<br />
;[http://www.ninj4.net/kinetic/ Kinetic]<br />
:Kinetic is an operating system where the expressiveness of Haskell's type system guides the design of operating system features and facilities.<br />
<br />
;[http://github.com/tathougies/hos Hos]<br />
:Hos is an x86-64 microkernel-based operating system written in Haskell 98 and compiled with JHC. With the exception of the bootstrap code, architecture-specific task switching, and low-level memory manager, all parts are written in Haskell. It currently supports user-space cooperative (for-now) multitasking, IPC, ELF loading, and has the beginnings of an ATA driver. The kernel and user space interaction is expressed as a continuation with the kernel yielding to a user space thread and waiting for the user space to yield control back (either explicitly or through an interrupt or trap). Patches welcome! For help building, e-mail [mailto:travis@athougies.net travis@athougies.net]<br />
<br />
=== Filesystems ===<br />
<br />
;[http://www.haskell.org/halfs/ Halfs, the Haskell Filesystem]<br />
:Halfs is a filesystem implemented in Haskell. Halfs can be mounted and used like any other Linux filesystem, or used as a library.<br />
<br />
;[http://okmij.org/ftp/Computation/Continuations.html#zipper-fs ZipperFS] <br />
:Oleg Kiselyov's [[zipper]]-based file server/OS where threading and exceptions are all realized via delimited [[continuation]]s.<br />
<br />
;[http://archive.fo/ch6e9 Debian From Scratch]<br />
:A single, full debian rescue CD. The tool that generates these ISO images (dfsbuild) is written in Haskell.<br />
<br />
=== Hardware emulators ===<br />
<br />
;[http://www.mutantlemon.com/omegagb/ OmegaGB]<br />
:OmegaGB is a Nintendo Game Boy emulator written in Haskell.<br />
<br />
;[http://naesten.dyndns.org:8080/repos/ZMachine/ ZMachine]<br />
:ZMachine is a Z-machine (Infocom's interactive fiction VM) interpreter which currently needs attention to its UI rather badly. This points to the darcs repository, as I suppose you can tell. It uses Gtk2Hs, but it just goes down hill from there. Help welcome! --[[User:SamB|SamB]] 03:40, 6 December 2006 (UTC) (the author)<br />
<br />
=== Window managers ===<br />
<br />
;[http://www.xmonad.org/ xmonad]<br />
:A lightweight X11 window manager.<br />
<br />
;[http://www.bluetile.org Bluetile]<br />
:A tiling window manager based on xmonad which focuses on making the tiling paradigm easily accessible to users coming from traditional window managers by drawing on known conventions and providing both mouse and keyboard access for all features. It also tries to be usable 'out of the box', requiring minimal to no configuration in most cases.<br />
<br />
;[http://archive.fo/vYbEH hswm]<br />
:A non-tiling window manager with a plugin architecture<br />
<br />
=== Shell utilities ===<br />
<br />
;[http://web.comlab.ox.ac.uk/oucl/work/ian.lynagh/haskell-ls/ haskell-ls]<br />
:A (near-)clone of the GNU ls utility.<br />
<br />
;[http://www.cse.unsw.edu.au/~dons/h4sh.html h4sh]<br />
:h4sh provides a set of Haskell List functions as normal unix shell commands. This allows us to use Haskell in shell scripts transparently. Each program is generated from the corresponding Haskell function's type<br />
<br />
=== Package management ===<br />
<br />
;[http://www.haskell.org/haskellwiki/himerge Himerge]<br />
:Luis Araujo's Haskell gui frontend to Emerge<br />
<br />
== Libraries ==<br />
<br />
=== Filesystems ===<br />
<br />
;[http://abridgegame.org/repos/fuse_example Fuse] <br />
:David Roundy's combination of a nice DarcsIO-style filesystem interface on the Haskell side (called FuseIO) with an interface to libfuse (which is a library for creating filesystems from user space on linux).<br />
<br />
;[http://code.haskell.org/hfuse/ hfuse]<br />
:Jeremy Bobbio's fuse bindings.<br />
<br />
;[http://haskell.org/~kolmodin/code/hinotify/ hinotify]<br />
:A library binding to [http://www.kernel.org/pub/linux/kernel/people/rml/inotify/ inotify], providing file system event notification, by simply add a watcher to a file or directory and get an event when it is accessed or modified.<br />
<br />
=== Dynamic linking ===<br />
<br />
;[http://www.cse.unsw.edu.au/~dons/hs-plugins hs-plugins] <br />
:Library support for dynamically loading Haskell modules, as well as compiling source or ''eval'' code fragments at runtime.<br />
<br />
=== Processes ===<br />
<br />
;[http://hackage.haskell.org/package/popenhs-1.0.0 popenhs]<br />
:An old small library, based on runProcess in the standardised posix library. It provides lazy output from subprocesses.<br />
<br />
;[http://freearc.narod.ru/ Process]<br />
:Process is a fun library for easing decomposition of algorithms to several processes, which transmit intermediate data via Unix-like pipes. Each sub-process is just a function started with forkIO/forkOS with one additional parameter-pipe.<br />
<br />
See also [[Libraries and tools/Concurrency and parallelism | concurrency and parallelism]]<br />
<br />
=== Environment ===<br />
<br />
;[http://repetae.net/john/recent/out/GetOptions.html GetOptions]<br />
:This module provides an advanced option parsing routine which can properly parse options depending on what types are infered for them as well as produce a pretty error message with usage info when an incorrect option is used.<br />
<br />
;[https://hackage.haskell.org/package/optparse-applicative Optparse-applicative]<br />
:[http://www.reddit.com/r/haskell/comments/3cfax3/new_haskellers_ask_anything/csv0q4r Discussion on Reddit]. Turtle (see elsewhere on this page) provides a beginner-friendly wrapper: [http://www.reddit.com/r/haskell/comments/3cfax3/new_haskellers_ask_anything/csv5cqe Reddit link]<br />
<br />
=== Time ===<br />
<br />
;[http://semantic.org/TimeLib/ TimeLib]<br />
:TimeLib is an attempt to redesign the current library for handling time (System.Time), balancing expressive functionality and intelligible simplicity. Now at version 0.2, TimeLib features representation of TAI, UTC and UT1, as well as Gregorian, ISO 8601 week, and "year and day" calendars, time-zones, and functions for strftime-style formatting. We'd like to collect some additional documentation on this wiki, too: [[Libraries and tools/Time library | Time library]]<br />
<br />
;[http://www.cs.chalmers.se/~bringert/darcs/parsedate/doc/ ParseDate]<br />
:ParseDate provides a function for parsing dates and times given a date format string.<br />
<br />
;[http://uebb.cs.tu-berlin.de/~magr/projects/rdtsc/doc/ rdtsc]<br />
:Provides the function 'rdtsc' for accessing the time stamp counter on modern IA-32 processors. This is a 64-bit counter which counts the number of ticks since the machine has been powered up. Using this instruction, you can make very precise time measurements.<br />
<br />
=== Terminal ===<br />
;[[Library/VTY]]<br />
: A simple terminal interface library. It provides: handling of suspend/resume, window resizes, minimizes repaint area, automatically decodes keyboard keys into (key,modifier) tuples, and more!<br />
<br />
=== Shell ===<br />
<br />
==== Haskell shell examples ====<br />
<br />
;[http://www.volker-wysk.de/hsshellscript HsShellScript]<br />
:A library for using Haskell for tasks which are usually done by shell scripts, e.g. command line parsing, analysing paths, etc. It can be used also for tasks usually done [http://haskell.org/ghc/docs/latest/html/libraries/base/System-Console-GetOpt.html GetOpt] (a module for GNU-/POSIX-like option handling of commandline arguments). But also for many other things.<br />
<br />
;[http://www.informatik.uni-bonn.de/~ralf/software/examples/Hsh.html Jim Mattson's Hsh Haskell shell]<br />
:on the [http://www.informatik.uni-bonn.de/~ralf/software.html software] page by [http://www.informatik.uni-bonn.de/~ralf/ Ralf Hinze]. Hsh seems to be written in Haskell 1.3.<br />
<br />
;[http://nellardo.com/lang/haskell/hash/ HaSh]<br />
:a nascent project page on a shell scripting system<br />
<br />
;[http://okmij.org/ftp/Computation/monadic-shell.html Monadic i/o and UNIX shell programming]<br />
:UNIX pipes as IO monads.<br />
<br />
;[http://directory.fsf.org/shell-haskell.html shell-haskell]<br />
:start an external shell command asynchronously, write data to its standard input and read results from its standard output. There is a [http://darcs.haskell.org/shell-pipe/ Darcs repository] with a cabalized version.<br />
<br />
;[http://haskell.org/hashell hashell]<br />
:shell with some scripting capabilities to use Haskell as a scripting language.<br />
<br />
;[http://www.haskell.org/pipermail/haskell/2006-June/018059.html Haskell Shell (HSH)]<br />
:HSH, the Haskell shell. Things are still very preliminary in many ways, but this version already lets you:<br />
* Run commands<br />
* Pipe things between commands<br />
* Pipe command input/output into and out of pure Haskell functions<br />
* Pure Haskell functions are as much a first-class citizen as is grep or cat<br />
<br />
;[http://hackage.haskell.org/package/shelly shelly]<br />
: a convenient library for shell scripting using modern (Text) and safe (sytem-filepath) techniques and featuring good error messages.<br />
<br />
;[http://hackage.haskell.org/package/shell-monad shell-monad]<br />
: Procedures written in this monad produce shell scripts.<br />
<br />
;[https://github.com/Gabriel439/Haskell-Turtle-Library Turtle]<br />
: Turtle is a reimplementation of the Unix command line environment in Haskell so that you can use Haskell as a scripting language or a shell.<br />
<br />
;[https://github.com/jekor/hesh Hesh]<br />
: Haskell Extensible Shell, makes writing scripts in Haskell easier. Uses Template Haskell.<br />
<br />
;[https://github.com/chrisdone/hell Hell]<br />
: A simple read-eval-print (REPL) loop for Haskell that has some simple awareness of the current directory and completion works.<br />
<br />
;[https://github.com/cpennington/h4sh h4sh]<br />
: Makes Haskell functions available as unix shell commands.<br />
<br />
==== Link collections on pure functional shells ====<br />
<br />
* [http://lambda-the-ultimate.org/classic/message9846.html on Lambda the Ultimate]<br />
* [http://www.cse.unsw.edu.au/~pls/thesis-topics/functionalshell.html Thesis Topic: The Design and Implementation of a Functional Shell]<br />
<br />
=== File utilities ===<br />
<br />
;[http://quux.org/devel/magic-haskell magic-haskell]<br />
:magic-haskell is a binding to the libmagic library. With magic-haskell, you can determine the type of a file by looking at its contents rather than its name. This library also can yield the MIME type of a file by looking at its contents.<br />
<br />
;[http://darcs.haskell.org/iff IFF parser]<br />
:Parse files in the [http://www.digitalpreservation.gov/formats/fdd/fdd000115.shtml#identification Interchange File Format] by Electronic Arts as used in AIFF, ILBM, 8SVX and so on. Creation of IFF files is planned.<br />
<br />
;[http://www.cse.unsw.edu.au/~dons/code/icfp05/MkTemp.hs mkstemps]<br />
:A Haskell reimplementation of the C mktemp/mkstemp/mkstemps library from OpenBSD<br />
<br />
;[http://www.cse.unsw.edu.au/~dons/haskell-1990-2000/msg04763.html Unix.hs]<br />
:Koen Claessen's binding to common unix functions.<br />
<br />
;[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/FileManip-0.1 FileManip]<br />
:A Haskell library for working with files and directories. Includes code for pattern matching, finding files, modifying file contents, and more.<br />
<br />
=== Logging ===<br />
<br />
;[http://repetae.net/john/recent/out/ErrorLog.html ErrorLog]<br />
:Manages an error log with proper locking. has a number of useful routines for detecting and reporting erronious conditions.<br />
<br />
;[http://www.cse.unsw.edu.au/~dons/code/icfp05/Logging.hs Logging]<br />
:Multiple debug levels and log file support<br />
<br />
{{LibrariesPage}}</div>Ysangkokhttps://wiki.haskell.org/index.php?title=User_groups&diff=62997User groups2019-08-15T19:16:44Z<p>Ysangkok: fix gmane links using archive.fo</p>
<hr />
<div>[[Category:Community]]<br />
<br />
A range of Haskell User Groups are springing up all over.<br />
<br />
== Online communities ==<br />
<br />
* Official [https://discourse.haskell.org/ discourse] forum<br />
<br />
* [https://discordapp.com/channels/280033776820813825 discord] <em>Haskell</em> subchannel on <em>Functional Programming</em> channel<br />
<br />
=== Reddit ===<br />
* [https://www.reddit.com/r/haskell/ /r/haskell]<br />
* [https://www.reddit.com/r/haskellgamedev /r/haskellgamedev]<br />
* [https://www.reddit.com/r/haskelltil /r/haskelltil]<br />
* [https://www.reddit.com/r/haskellquestions /r/haskellquestions]<br />
<br />
=== Facebook Groups ===<br />
* [https://www.facebook.com/groups/programming.haskell Programming Haskell]<br />
* [https://www.facebook.com/groups/learning.haskell Learning Haskell]<br />
<br />
=== Google+ communities ===<br />
(Google+ is scheduled for shutdown on April 2, 2019)<br />
<br />
* [https://plus.google.com/communities/101629034466170191725 Haskell: The Haskell-Beginners Community]<br />
* [https://plus.google.com/communities/104818126031270146189 Haskell]<br />
<br />
<br />
* Questions tagged <em>haskell</em> on [https://stackoverflow.com/questions/tagged?tagnames=haskell StackOverflow]<br />
<br />
== User groups ==<br />
<br />
Regular meetings in a particular geographical area. Great if you want to see and meet other Haskellers.<br />
<br />
<br />
===Africa===<br />
<br />
====South Africa====<br />
; [http://www.meetup.com/lambda-luminaries/ Lambda Luminaries] : Functional programming user group based in Centurion, Gauteng.<br />
<br />
===Asia===<br />
<br />
====China====<br />
;[http://lisp.org.cn/en/ China Lisp User Group]<br />
:China Lisp User Group (CLUG) is the earliest founded Lisp user group in China. <br />
<br />
====Hong Kong====<br />
;[http://www.meetup.com/HK-Functional-programming/ Hong Kong Functional Programming User Meetup Group]<br />
<br />
====India====<br />
;[https://t.me/haskellindia Haskell India Group]<br />
: Telegram group that complements existing personal meetups at various places in India. To join, go here on your mobile browser: https://t.me/haskellindia<br />
<br />
;[https://www.meetup.com/The-Bangalore-Haskell-User-Group/ The Bangalore Haskell User Group]<br />
: We are a diverse group of experienced Haskellers, commercial Haskell users as well as learners, meeting up at Bangalore usually on Saturdays at 3:00 PM - 5:00 PM.<br />
<br />
====Japan====<br />
;[https://haskell.jp/ Japan Haskell Users Group (Haskell-jp)]<br />
:blog, slack, recipes, events (meetings) and more<br />
<br />
;[http://www.starling-software.com/en/tsac.html Tokyo Society for the Application of Currying]<br />
<br />
;[http://www.meetup.com/Tokyo-Haskell-Meetup/ Tokyo Haskell Meetup]<br />
:Casual monthly meetings to help each other learn Haskell<br />
<br />
====Singapore====<br />
;[https://www.meetup.com/HASKELL-SG HASKELL.SG Meetup]<br />
<br />
===Europe===<br />
<br />
==== Belgium ====<br />
<br />
;[[Ghent Functional Programming Group]]<br />
:The Ghent Functional Programming Group will be having its first meeting on April 1, 2010.<br />
<br />
;[https://groups.google.com/forum/#!forum/leuven-haskell Leuven Haskell User Group]<br />
:The Leuven Haskell User Group was launched on March 3, 2015 and meets every two weeks.<br />
<br />
==== Czech Republic ====<br />
<br />
;[https://fpbrno.github.io Functional Programming Brno]<br />
<br />
==== France ====<br />
<br />
;[[Fr/Haskell]]<br />
:The Strasbourg HUG meets monthly in an informal setting. Level is very low and newbies are very welcome.<br />
<br />
==== Germany ====<br />
<br />
;Curry Club Augsburg<br />
:http://curry-club-augsburg.de/<br />
<br />
;Berlin HUG<br />
:http://www.meetup.com/berlinhug/<br />
<br />
;Haskell in Frankfurt<br />
: <ul><li>[http://www.meetup.com/Frankfurt-Haskell-User-Group Frankfurt Haskell User Group] meets monthly.</li><li> [http://wiki.lug-frankfurt.de/Programmierworkshop/aktuell Regular Saturday Workshop] taking place every couple of months. Feel free to join us!</li><br />
<br />
;[http://www.iba-cg.de/hal5.html Haskell in Leipzig]<br />
:Hal, they have videos [http://iba-cg.de/haskell.html online].<br />
<br />
;[http://www.haskell-munich.de Haskell in Munich]<br />
: We had our first meeting on Thursday, 29th of September 2011. We are always looking forward to see new people. If you can make it to Munich, consider joing us!<br />
<br />
;[http://www.meetup.com/de-DE/Regensburg-Haskell-Meetup Regensburg Haskell Meetup]<br />
: We meet regularly once a month since 2014. Folks from the Munich and Nuremberg area frequently join.<br />
<br />
;Interest for User Groups in Germany<br />
* '''Ulm''': [[HugUlm]]<br />
* '''Mannheim or Heidelberg''': [[User:Cgo|cgo]] ([http://www.haskell.org/haskellwiki/?title=Special:Emailuser&target=Cgo mail]), [[User:HC|hc]]<br />
<br />
==== Greece ====<br />
<br />
;[https://groups.google.com/forum/#!forum/haskell-greece/ Haskell Greece Google group]<br />
<br />
==== Hungary ====<br />
<br />
;[http://www.meetup.com/Bp-HUG Budapest Haskell User Group]<br />
:The Haskell User Group is a group of Haskell enthusiasts who are interested in sharing their knowledge and meeting people who share similar interests. We had our first meeting in September 2013.<br />
<br />
==== Iceland ====<br />
<br />
;[[Reykjavik Haskell User Group]] Iceland<br />
;[http://groups.google.com/group/haskell-is Currently recruiting members]<br />
<br />
==== Israel ====<br />
<br />
;[[IsraelHaskell]] User Group<br />
:[http://archive.fo/HKbQG Are getting organised].<br />
* '''Konstanz''': [[User:Thkoch|thkoch]]<br />
<br />
==== Italy ====<br />
;[[ItaloHaskell]]<br />
:We had a first meeting in August 2008 and we are planning a second one sometime during the 2008/2009 Autumn/Winter season.<br />
<br />
==== Netherlands ====<br />
<br />
;[http://dutchhug.nl/ Dutch HUG]<br />
:The Dutch HUG meets monthly in an informal setting.<br />
<br />
==== Norway ====<br />
<br />
;[http://www.meetup.com/Oslo-Haskell/ Osλo Haskell]<br />
:Osλo Haskell is a group for Haskellers and people interested in Haskell and related languages in and around Oslo. We had our first meeting in March 2014.<br />
<br />
;[http://www.meetup.com/Trondheim-Haskell-Users-Group/ Trondheim Haskell Users' Group]<br />
:A Haskell users' group in the Trondheim area. For seasoned veterans, complete newbies who only heard of Haskell two minutes ago, and everyone in between and beyond. We meet and talk about Haskell and anything else members are interested in.<br />
<br />
==== Poland ====<br />
;[https://plus.google.com/u/0/communities/103183708602453146804 HUG Warsaw] <br />
We are the successors to the Warsaw Functional Society (Warszawskie Towarzystwo Funkcyjne) and as such we welcome any functional programmers and enthusiasts, though the focus of the group is Haskell. We (hope to) have rather informal, but regular meetings in Warsaw, Poland.<br />
<br />
==== Russia ====<br />
<br />
;[http://ruhaskell.org/ Russian community of Haskell-developers]<br />
;[http://spbhug.folding-maps.org Saint-Petersburg Haskell User Group]<br />
;[https://groups.google.com/forum/#!forum/mskhug Moscow Haskell User Group]<br />
;[https://groups.google.com/forum/#!aboutgroup/haskell-russian haskell-russian mailing list]<br />
<br />
==== Switzerland ====<br />
<br />
;[http://www.meetup.com/HaskellerZ/ Haskell User Group Zurich]<br />
:We are meeting once a month to share knowledge of and experience with Haskell.<br />
<br />
;[http://www.meetup.com/Geneva-Haskell-Group/ Geneva Haskell Group]<br />
:We are a Haskell community in Geneva planning to meet up every week.<br />
<br />
==== Turkey ====<br />
<br />
;[http://groups.google.com/group/core-haskell?lnk=srg Turkey Haskell Programmer's Group]<br />
:Formed by Turkish Functional Programmers, the group began to communicate via an e-mail list opened by core.gen.tr. The first contribution is hlibev project by Aycan iRiCAN.<br />
<br />
;[http://bilfp.wikidot.com/ BILFP (Bilkent University Comp. Eng. Dept. Functional Programming Society)] Turkey <br />
:Project aims to improve people's knowledge and encourage the use of functional programming languages &mdash; especially in Turkey. Group is open to functional-programming-related discussions and establishes related presentations at Bilkent University that are open to anybody.<br />
<br />
==== UK ====<br />
;[http://lambdalounge.org.uk/ Manchester Lambda Lounge]<br />
:We are an active community meeting monthly at the [http://madlab.org.uk/ Madlab] (Manchester Digital Laboratory) to talk about topics in functional programming.<br />
<br />
;[http://www.meetup.com/hoodlums/ Hoodlums - Haskell developer meetup]<br />
:Meets monthly on the second Thursday of the month in Canary Wharf. It is a "Coding Dojo" format where we pick some interesting problem and solve it as a group. <br />
<br />
;[http://www.meetup.com/London-HUG/ London Haskell User Group]<br />
:The main meetings are monthly on the last or fourth Thursday of the month. The group was revived in late 2012.<br />
<br />
;[http://www.meetup.com/ed-lambda/ ed lambda (Edinburgh, UK)]<br />
:For functional programming in general, founded by a Haskeller. First meeting will be September 13th 2010.<br />
<br />
;[http://groups.google.com/group/oxhug OxHUG - the Oxford Haskell Users Group]<br />
:Meets every other week, currently at the Department of Computer Science, University of Oxford. Discussion session followed by adjournment to a local tavern. Aimed at students, graduates, professionals and enthusiasts.<br />
<br />
;[http://groups.google.com/group/fp-southwales fp-southwales], the South Wales Functional Programming User Group<br />
:Starting up in late 2009, based out of Swansea University.<br />
<br />
==== Ukraine ====<br />
;[https://groups.google.com/forum/#!forum/ltu-kiev LtU-Kiev community]<br />
:Irregular meetups, usually with prepared talks on Haskell and other FP topics.<br />
;[http://www.haskell.od.ua Odessa Haskell User Group]<br />
:Regular informal meetups (approximately once a month) in a pub or cafe<br />
<br />
===North America===<br />
<br />
====Central====<br />
<br />
;[http://leibnizdream.wordpress.com/2007/12/22/new-austin-functional-programmers-group-in-2008/ Austin Functional Programmers Group]<br />
:See the [http://groups.google.com/group/austin-fp discussion group] for more.<br />
<br />
;[http://www.meetup.com/Boulder-Haskell-Programmers/ Boulder Haskell Programmers]<br />
: Boulder and Denver (Colorado) area Haskell Programmer Group. Meetings are focused on practical topics faced by working programmers. All experience levels are welcome.<br />
<br />
;[http://groups.google.com/group/real-world-haskell-book-club/browse_thread/thread/3e8e59768c8c50a9 Colorado Area Haskell Study Group]<br />
<br />
;[http://ChicagoHaskell.com Chicago Haskell] — First general meeting in December 2009. — [https://groups.google.com/forum/#!forum/haskell-chicago Mailing List] — [https://twitter.com/ChicagoHaskell @ChicagoHaskell]<br />
<br />
;[http://www.meetup.com/DenHUG/ Denver Area Haskell Users Group] -- DenHUG had it's first meeting on 27 Feb 2010. Next meeting will be 3 Apr 2010.<br />
<br />
;[http://www.meetup.com/Houston-Haskell-Users-Group/ Houston Haskell Users Group] -- Meets the 1st Monday of every month at [https://txrxlabs.org/ TxRx labs]<br />
<br />
;[http://www.lambdalounge.org St. Louis Lambda Lounge] -- Meets the 1st Thursday of the month. Since Dec 2008, Lambda Lounge is a user group in St. Louis organized loosely around the idea of exploring dynamic and functional languages.<br />
<br />
;[http://www.meetup.com/Nashville-Haskell-Users-Group Nashville Haskell Users Group (NHUG)] -- Meets 1st Tuesday of each month.<br />
<br />
====East Coast====<br />
<br />
;[http://groups.google.com/group/bostonhaskell Boston Haskell Users' Group].<br />
:Meets monthly.<br />
<br />
;[http://www.meetup.com/NY-Haskell/ New York Haskell Users Group]<br />
:The NY Haskell Users Group is for all programmers either interested in or experienced with the Haskell programming language. Meets monthly.<br />
<br />
;[http://www.meetup.com/lisp-59/ New York Functional Programmers]<br />
:Come and meet like-minded functional programmers in the New York area.<br />
<br />
;[http://www.meetup.com/Haskell-DC/ Haskell DC]<br />
:Washington DC area Meetup for Haskell.<br />
<br />
;[http://www.lisperati.com/fringedc.html FringeDC Washington]<br />
:Meetings about functional programming languages in Washington DC.<br />
<br />
;[http://groups.google.com/group/AFPUG Atlanta Functional Programming Users Group]<br />
:Meet other functional programmers in the Atlanta area. Join us and geek out!<br />
<br />
;Toronto Haskell User Group<br />
:Haskellers of Toronto, unite! We meet at [https://bentomiso.com/events Bento Miso] on the second Wednesday of every month (check the [https://bentomiso.com/events event page] to be sure; it's usually up-to-date). There is also a small organizational [http://groups.google.com/group/toronto-haskell/ mailing list] you can join to keep up to date.<br />
<br />
;Toronto Haskell Meetup<br />
:A beginner friendly place to learn about Haskell, ask questions, and meet friendly FP enthusiasts - [https://www.meetup.com/meetup-group-evRITRtT/ you can find us on meetup.com]<br />
<br />
;[http://www.haskellers-montreal.com/ Haskellers Montreal Group].<br />
:Meets every 2 months on the first Wednesday of that month, currently at Centre [http://cloud.ca Cloud.ca] (previously known as RPM). Talks alternate from expert-level to more newcomer-oriented ones; and we organize through our [http://haskell-meetup.sandreckoning.com/ website], a [https://groups.google.com/forum/#!forum/haskellers-montreal Google group] and a [http://www.meetup.com/Haskellers-Montreal-Meetup/ meetup.com] page.<br />
<br />
====West Coast ====<br />
<br />
;[http://socalfp.blogspot.com/ SoCal FP Group]<br />
<br />
;[http://www.meetup.com/sandiegohug/ San Diego Haskell User Group]<br />
:a Haskell User Group for the San Diego and Tijuana region<br />
<br />
;[http://bayfp.org/ The Bay Area Functional Programmers group]<br />
:Meeting monthly in the San Francisco Bay area. See [http://bayfp.org/blog their blog] for more details and news of upcoming meetings.<br />
<br />
;[http://pdxfunc.org PDXfunc: Portland FP Group]<br />
:Monthly meetings of the Portland, Oregon functional programming group. Meetings occur on the second Monday of each month at 7 pm, typically in Downtown/NW Portland.<br />
<br />
;[http://seattlehaskell.org/ Seattle Area Haskell Users' Group]<br />
:Monthly get-togethers serving Seattle and the Eastside (see also [http://meetup.com/SEAHUG/ Meetup.com] for details)<br />
<br />
;[http://www.haskell.org/pipermail/haskell-cafe/2008-February/038991.html Seattle: Northwest Functional Programming Interest Group]<br />
:a Northwest Functional Programming Interest Group in Seattle.<br />
<br />
;[http://www.meetup.com/Vancouver-Haskell-Unmeetup/ Vancouver Haskell UnMeetup]<br />
:Monthly interactive sessions, (+10) for joining<br />
<br />
===Oceania===<br />
====Australia====<br />
<br />
;[http://groups.google.com/group/fp-syd FP-SYD, the Sydney (Australia) Functional Programming group]<br />
:FP hackers in Sydney.<br />
<br />
;[http://sites.google.com/site/fpunion/ (FPU) Melbourne Functional Programming Union]<br />
:The FPU is a collective of functional programming language enthusiasts, which has been in operation since 1998. We are based at the University of Melbourne, in the Department of Computer Science and Software Engineering, but we are open to all members of the community. We meet on a regular basis for lively discussions on topics broadly associated with the declarative programming paradigm.<br />
<br />
;[http://bfpg.org/ Brisbane Functional Programming Group (BFPG)] ([http://www.meetup.com/Brisbane-Functional-Programming-Group-BFG/ Meetup page])<br />
:A group for Functional Programming with Haskell, Scala and other languages.<br />
<br />
;[http://meetup.com/PerthFP/ Perth Functional Programmers Meetup]<br />
:A group in Perth, WA for Functional Programming with Haskell, Scala and other languages.<br />
<br />
===South America===<br />
<br />
==== Bolivia ====<br />
; [https://www.facebook.com/groups/111518795538430/ Comunidad Haskell San Simon (CHSS)]<br />
: Haskell user group for Bolivia and spanish speaking community<br />
<br />
====Brazil====<br />
;[[User_groups/Brazil|Grupo Brasileiro de Usuários de Haskell]]<br />
: Grupo criado para reunir os desenvolvedores e entusiastas que utilizam Haskell no Brasil<br />
<br />
====Ecuador====<br />
; [http://www.meetup.com/Quito-Lambda-Meetup/ Quito Lambda]<br />
: A monthly meetup about functional programming in Quito, Ecuador<br />
<br />
== Workshops/meet ups ==<br />
<br />
Less regular, and move around. Usually have a few talks from invited speakers.<br />
See the [[Haskell]] homepage for a list of upcoming events.<br />
<br />
== Hackathons ==<br />
<br />
Getting together to squash bugs and write new stuff. For a list of past and upcoming hackathons, see the [[Hackathon]] page.<br />
<br />
== Conferences ==<br />
<br />
See the [[Haskell_in_research#Conferences|Haskell in research]] and [[Conferences]] page for academic workshops and conferences<br />
focusing on Haskell and related technology.</div>Ysangkokhttps://wiki.haskell.org/index.php?title=ICFP_Programming_Contest/Teams_2007&diff=62996ICFP Programming Contest/Teams 20072019-08-15T19:16:03Z<p>Ysangkok: fix gmane links using archive.fo</p>
<hr />
<div>This page is for helping Haskell (and FP) people organise teams for the<br />
[http://www.icfpcontest.org// 2007 ICFP contest].<br />
<br />
* [http://www.kingsrook.com/icfp/countdown.html Countdown to contest start]<br />
<br />
Resources:<br />
* The home of [http://www.icfpcontest.org/ ICFP 2007].<br />
* The #haskell-icfp07 and #haskell [[IRC channel]]s on freenode.<br />
* The #oasis [[IRC channel]] on freenode: generic ICFP discussion channel (not specifically Haskell oriented)<br />
* [http://archive.fo/RqR1h Announcement] for this page.<br />
<br />
== Teams ==<br />
<br />
Teams that competed, used Haskell, and their final rankings.<br />
<br />
{| border="0" cellspacing="15" cellpadding="2"<br />
! Team<br />
! Members<br />
! Ranking<br />
|-<br />
| Basically Awesome<br />
| jcd__ et al<br />
| less than 15<br />
|-<br />
| [http://stereotype441.livejournal.com/45150.html The Corn Worf Strategy]<br />
| ?<br />
| 28<br />
|-<br />
| solo r6<br />
| roconnor<br />
| 32<br />
|-<br />
| Lazy Bottoms<br />
| vincenz, Adept, Lemmih, psykotic, zeeeee, jethr0, Cale<br />
| 56<br />
|-<br />
| Team PDX<br />
| Binkley et al<br />
| 67<br />
|-<br />
| TNT: Team Named Thunk <br />
| timbod, mnislaih, Toxaris<br />
| 80<br />
|-<br />
| [http://leastfixed.com/ The Church of the Least Fixed Point]<br />
| mietek, dreamer_, lispozord, q, rraptorr<br />
| 95<br />
|-<br />
| cdsmith<br />
| Chris Smith<br />
| 104<br />
|-<br />
| ChuToys<br />
| genneth, smowton, greg<br />
| 129<br />
|-<br />
| Instant Chaos <br />
| alar, ivant, akamaus, vsb, lome0, gvennet<br />
| 133<br />
|-<br />
| LazyBear<br />
| Dimitur Krustev<br />
| 146<br />
|-<br />
| augustss<br />
| Lennart<br />
| 151<br />
|-<br />
| scsibug<br />
| Greg Heartsfield<br />
| 195<br />
|-<br />
| enolan<br />
| Echo Nolan<br />
| 251<br />
|-<br />
| Pointless<br />
| nominolo, Igloo, mauke<br />
| 695<br />
|-<br />
|}<br />
<br />
The following teams sound like they might use Haskell, or FP at least:<br />
<br />
{| border="0" cellspacing="15" cellpadding="2"<br />
! Teams that sound like they use Haskell<br />
! Members<br />
! Rank<br />
|-<br />
| PurelyFunctionalInfrastructure (maybe)<br />
| ?<br />
| less than 16<br />
|-<br />
| The Higher order of Zeuxis<br />
| ?<br />
| 16<br />
|-<br />
| Frictionless Bananas<br />
| ?<br />
| 27<br />
|-<br />
| Side Effects May Include... (maybe)<br />
| ?<br />
| 29<br />
|-<br />
| Poor Man's Haskell (maybe)<br />
| ?<br />
| 252<br />
|-<br />
| Haskeller (maybe)<br />
| ?<br />
| 312<br />
|-<br />
| Nomadic I/O<br />
| ?<br />
| 578<br />
|-<br />
|}<br />
<br />
== Contest Code ==<br />
<br />
Some teams have made their contest source code available<br />
<br />
{| border="0" cellspacing="15" cellpadding="2"<br />
! Team<br />
! DNA representation<br />
! Source Code<br />
|-<br />
| solo r6<br />
| Data.ByteString.Lazy<br />
| darcs get http://r6.ca/icfp2007<br />
|-<br />
| Antoine, Creighton<br />
| String<br />
| http://panicsonic.blogspot.com/2007/07/icfp-07-post-mortem-i.html<br />
|-<br />
| TNT<br />
| Data.ByteString.Lazy<br />
| http://ender4.dsic.upv.es:81/darcs/tnt<br />
|- <br />
| ChuToys<br />
| strict list of strict BS<br />
| http://www.srcf.ucam.org/~gz218/icfpc2007/<br />
|-<br />
|}<br />
<br />
[[Category:Contests]]</div>Ysangkokhttps://wiki.haskell.org/index.php?title=News/2006&diff=62995News/20062019-08-14T23:40:13Z<p>Ysangkok: fix gmane link using MementoWeb</p>
<hr />
<div>==News from 2006==<br />
<br />
''2006-12-20''<br />
<br />
<ul><li><p><em>Edison 1.2.1</em>. Robert Dockins<br />
[http://archive.fo/lnkg2 announced] the 1.2.1 release of [http://www.eecs.tufts.edu/~rdocki01/ Edison]. Edison is a famous library of efficient, purely-functional data structures in Haskell. Notable changes from the previous version include: a new sequence implementation based on finger trees; documentation fixes dealing with the licence; added a few methods to EnumSet for wrapping and unwrapping the underlying Word</p></li><br />
<br />
<li><p><em>Basic serialisation library using SYB</em>. Stefan O'Rear<br />
[http://archive.fo/JXZFH announced] GenericSerialize, [http://members.cox.net/stefanor/genericserialize a library] for serialization using the existing generic-programming framework. It is often advocated that support for serialization should be added to the compiler (e.g. in the form of a deriving(Binary)). With this project Stefan wants to show that the existing infrastructure is sufficient, and has some advantages over a dedicated serialization interface. GenericSerialize supports multiple serialization modes.</p></li><br />
<br />
<li><p><em>vty 1.0</em>. Stefan O'Rear<br />
[http://archive.fo/ybZtI announced] vty 1.0, a simple [http://members.cox.net/stefanor/vty terminal interface library]. It provides: handling of suspend/resume, window resizes, computation of minimal differences, minimizes repaint area, automatically decodes keyboard keys into (key,modifier) tuples, and more!</p></li><br />
<br />
<li><p><em>Monad.Reader call for copy</em>. Wouter Swierstra<br />
[http://archive.fo/8yE4m reminded us] that its still not too late to write something for the next issue of [http://www.haskell.org/haskellwiki/TheMonadReader The Monad.Reader]! We have a nice issue slowly shaping up, but your contribution is still very welcome. Get in touch with Wouter if you intend to submit something -- the sooner you let him know what you're up to, the better.</p></li><br />
<br />
<li><p><em>Ranged Sets</em>. Paul Johnson<br />
[http://archive.fo/WMESn announced] that Ranged Sets now have a Monoid instance, and singletons (i.e. a range holding a single value), thanks to Jean-Philippe Bernardy.</p></li><br />
<br />
<li><p><em>CalDims 1.0 (RC 1)</em>. schneegloeckchen<br />
[http://archive.fo/9Bj43 announced] CalDims, a calculator aware of units. Its available from [http://www.haskell.org/haskellwiki/CalDims the Haskell wiki]. It includes support for user defined basic units and derrived units; user defined functions; work sheets can be modified/saved via shell; (1/3)*3 == 1 (No rounding errors); built-in feature to simplify units and easy unit-conversion.</p></li><br />
<br />
<li><p><em>JoinCabal</em>. Dougal Stanton<br />
[http://archive.fo/oFyzQ announced] an alternative to mkcabal, for initialising new cabal projects: [http://brokenhut.no-ip.org/~dougal/cgi-bin/darcsweb.cgi?r=JoinCabal;a=summary JoinCabal], available [http://brokenhut.no-ip.org/~dougal/darcs/joincabal/ via darcs]. JoinCabal will create stub sources files with a license header, and appropriate license for you code, making it easier to set up a valid cabal build system.</p></li><br />
<br />
<li><p><em>Haskell Vim plugin</em>. Arthur van Leeuwen<br />
[http://archive.fo/Z4Tbb announced] a new [http://www.cs.uu.nl/~arthurvl/haskell.vba vim plugin] for Haskell providing some preliminary folding support, easy insertion of type signatures into programs, and support for handling .hi files.</p></li></ul><br />
<br />
''2006-12-12''<br />
<br />
<ul><li><p><em>Visual Haskell 0.2</em>. Krasimir Angelov<br />
[http://archive.fo/UHkQZ announced] the final version of [http://www.haskell.org/visualhaskell Visual Haskell] 0.2 is available! This is the first version that is: available for both VStudio 2003 and VStudio 2005; distributed with a stable GHC version (6.6). Additionally the plugin itself is much more stable than its first 0.0 version.</p></li><br />
<br />
<li><p><em>Phooey: functional user interfaces for Haskell</em>. Conal Elliott<br />
[http://archive.fo/w9ks1 announced] Phooey, [http://darcs.haskell.org/packages/phooey/doc a functional UI library for Haskell]. GUIs are usually programmed in an 'unnatural' style, in that implementation dependencies are inverted, relative to logical dependencies. This reversal results directly from the imperative orientation of most GUI libraries. While outputs depend on inputs from a user and semantic point of view, the imperative approach imposes an implementation dependence of inputs on outputs. Phooey ('Phunctional ooser ynterfaces') retains the functional style, in which outputs are expressed in terms of inputs. In addition, Phooey supports dynamic input bounds, flexible layout, and mutually-referential widgets. It is [http://darcs.haskell.org/packages/phooey available via darcs].</p></li><br />
<br />
<li><p><em>HOgg 0.2.0</em>. Conrad Parker<br />
[http://archive.fo/bQTna announced] HOgg 0.2.0. The [http://snapper.kfish.org/~conrad/software/hogg/ HOgg] package provides a commandline tool for manipulating Ogg files, and a corresponding Haskell library. This is the initial public release. The focus is on correctness of Ogg parsing and production. The capabilities of the hogg commandline tool are roughly on par with those of the [http://www.annodex.net/software/liboggz/index.html oggz* tools], although hogg does not yet provide an equivalent to oggz-validate. HOgg supports chained and multiplexed Ogg bitstreams conformant with [http://www.ietf.org/rfc/rfc3533.txt RFC3533]. HOgg can parse headers for CMML, FLAC, OggPCM, Speex, Theora and Vorbis media codecs, and can read and write Ogg Skeleton bitstreams.</p></li><br />
<br />
<li><p><em>ftphs</em>. John Goerzen<br />
[http://archive.fo/v6Fsk announced] ftphs, [http://software.complete.org/ftphs an FTP client] and server library for Haskell. Its features include: easy to use operation; full support of text and binary transfers; optional lazy interaction; server can serve up a real or a virtual filesystem tree; Standards compliant. ftphs was previously a part of the MissingH library. The code in this release is unchanged from its state in MissingH, other than the changes necessary to make it a standalone package.</p></li><br />
<br />
<li><p><em>AnyDBM 1.0.0</em>. John Goerzen<br />
[http://archive.fo/kkFgl announced] AnyDBM, a generic DBM-type interface. [http://software.complete.org/anydbm AnyDBM] provides a generic infrastructure for supporting storage of hash-like items with String-to-String mappings. It can be used for in-memory or on-disk storage. Two simple backend drivers are included with this package: one that is RAM-only, and one that is persistent and disk-backed. The hdbc-anydbm package provides another driver, which lets you use simple tables in any SQL database to provide a DBM-like interface. MissingPy also provides a Python driver which lets you use any Python anydbm driver under Haskell AnyDBM.</p></li><br />
<br />
<li><p><em>ConfigFile 1.0.0</em>. John Goerzen<br />
[http://archive.fo/IVkE0 announced] ConfigFile, a parser and writer for handling sectioned config files in Haskell. The [http://software.complete.org/configfile ConfigFile] module works with configuration files in a standard format that is easy for the user to edit, easy for the programmer to work with, yet remains powerful and flexible. It is inspired by, and compatible with, Python's ConfigParser module. It uses files that resemble Windows .INI-style files, but with numerous improvements.</p></li><br />
<br />
<li><p><em>hslogger</em>. John Goerzen<br />
[http://archive.fo/7vZ3F announced] hslogger, a logging framework for Haskell. [http://software.complete.org/hslogger hslogger's] features include: each log message has a priority and a source associated with it; multiple log writers can be on the system; configurable global actions based on priority and source; extensible log writers (handlers); default handlers that write to the console, file handles, or syslog; easy to use operation. hslogger is the first package to be split off from the MissingH source.</p></li><br />
<br />
<li><p><em>MissingH 0.18.0</em>. John Goerzen<br />
[http://archive.fo/VJZRG announced] MissingH 0.18.0. [http://software.complete.org/missingh MissingH] is a large collection of assorted utility libraries for Haskell. Its primary audience is Haskell programmers that want to get practical things done fast. This release implements the first part of the MissingH transition. The major changes are: most code from other sources that had been merged into MissingH has been split off; stable, mostly standalone components of MissingH have been split off: hslogger, ftphs, ConfigFile, AnyDBM, and all modules renamed to more closely follow current Haskell naming practices.</p></li><br />
<br />
<li><p><em>ZMachine 0.0</em>. Samuel Bronson<br />
[http://www.haskell.org/pipermail/haskell/2006-December/018870.html announced] a (partial) Z-machine interpreter in Haskell. It uses gtk2hs for the interface, though other interfaces could be implemented without actually changing the interpreter proper. The Z-machine is a virtual machine that was developed by Joel Berez and Marc Blank in 1979 and used by Infocom for its text adventure games.</p></li><br />
<br />
<li><p><em>Halp: Haskell Logic Prover</em>. Dan Mead<br />
[http://archive.fo/NgdYv announced] the release of Halp, the simple logic prover. Right now it only supports simple first order logic but predicates are on the way. Theres also a simple gui written in Java 5 which is in the [http://taz.cs.wcupa.edu/~dmead/code/halp/ darcs repository].</p></li><br />
<br />
<li><p><em>DList 0.1</em>. Don Stewart<br />
[http://archive.fo/XPjS4 announced] dlist 0.1, a library for difference lists in Haskell. Difference lists are a Haskell idiom for implementing O(1) append on lists, using functions to represent the lists.</p></li></ul><br />
<br />
''2006-12-05''<br />
<br />
<ul><li><p><em>Communities and Activities Report</em>. Andres Loeh<br />
[http://archive.fo/u30rD published] the [http://www.haskell.org/communities/ Haskell Communities and Activities Report] (11th edition, November 2006). The report is now available from the Haskell Communities home page in several formats. The goal of the report is to improve the communication between the increasingly diverse groups, projects and individuals working on, with, or inspired by Haskell. When we try for the next update, six months from now, you might want to report on your own work, project, research area or group as well.</p></li><br />
<br />
<li><p><em>Visual Haskell prerelease 0.2</em>. Krasimir Angelov<br />
[http://archive.fo/pUjEv announced] that there is a prerelease version of Visual Haskell [http://www.haskell.org/visualhaskell available]. This is the first version that is: available for both VStudio 2003 and VStudio 2005, and distributed with a stable GHC version (6.6)</p></li><br />
<br />
<li><p><em>Haskell MIME library</em>. Jeremy Shaw<br />
[http://archive.fo/HSFEj announced] the availability of a MIME processing library. This library is supposed to be able to parse emails and decode various attachments, and generate emails with attachments. [http://www.n-heptane.com/nhlab/repos/haskell-mime The library] includes modules that implement portions of: RFC 2045, RFC 2046, RFC 2387 and RFC 2822.</p></li><br />
<br />
<li><p><em>Core (ghc-base) library</em>. Bulat Ziganshin<br />
[http://archive.fo/6tk2Y announced] progress on the Core library project, to divide the Haskell base library into two parts: small compiler-specific one (the Core library proper) and the rest: new, compiler-independent Base library that uses only services provided by Core lib.</p></li><br />
<br />
<li><p><em>hpodder 0.99.0</em>. John Goerzen<br />
[http://archive.fo/TEFQi announced] hpodder 0.99.0, the first beta candidate for making an eventual 1.0.0 release of hpodder. [http://quux.org/devel/hpodder hpodder] is a podcast downloader that happens to be written in Haskell. This version introduces two major new features: nicer apt-like output and multithreaded downloading.</p></li><br />
<br />
<li><p><em>MissingH 0.16.3</em>. John Goerzen<br />
[http://archive.fo/ifleX released] MissingH 0.16.3. Including a new module MissingH.ProgressTracker which tracks the progress of long-running tasks, and MissingH.Quantity which renders numbers according to a quantification system such as SI or binary.</p></li><br />
<br />
<li><p><em>The restricted IO monad</em>. Stefan O'Rear<br />
[http://archive.fo/GP0DC introduced] RIO, an experimental library for extensible restricted IO in Haskell.</p></li><br />
<br />
<li><p><em>Typed symbolic differentiation</em>. Oleg Kiselyov<br />
[http://archive.fo/jh0fE showed] symbolic differentiation of a wide class of numeric functions without any interpretative overhead. The functions to symbolically differentiate can be given to us in a compiled form (in .hi files); their source code is not needed. We produce a (compiled, if needed) function that is an exact, algebraically simplified analytic derivative of the given function. Our approach is reifying code into its `dictionary view', intensional analysis of typed code expressions, and the use of staging to evaluate under lambda.</p></li></ul><br />
<br />
''2006-11-28''<br />
<br />
<ul><li><p><em>QuickCheck 2 development version</em>. Bjorn Bringert<br />
[http://archive.fo/t1lqW announced] that the development version of QuickCheck 2 is now available in a public darcs repository. Highlights of the new QuickCheck version include: shrinking of failing test cases; supports testing monadic code; handles exceptions gracefully; coarbitrary has moved to a separate class; type-level modifiers for changing test data generation (e.g. NonNegative); function table printing; and user-defined actions when properties fail. The source is [http://www.cs.chalmers.se/~bringert/darcs/QuickCheck/ available via darcs].</p></li><br />
<br />
<li><p><em>PQC: QuickCheck in the Age of Concurrency</em>. Don Stewart<br />
[http://archive.fo/hcGeg announced] PQC: Parallel QuickCheck. [http://www.cse.unsw.edu.au/~dons/pqc.html PQC] provides a single module: [http://www.cse.unsw.edu.au/~dons/pqc/Test-QuickCheck-Parallel.html Test.QuickCheck.Parallel]. This is a QuickCheck driver that runs property lists as jobs in parallel, and will utilise as many cores as you wish, with the SMP parallel GHC 6.6 runtime. It is simple, scalable replacement for Test.QuickCheck.Batch.</p></li><br />
<br />
<li><p><em>cabal-test: automatic testing for Cabal projects</em>. David Himmelstrup<br />
[http://archive.fo/5qF2h announced] cabal-test, the automatic tester for Cabal projects. The cabal-test tool is capable of testing embedded QuickCheck properties in any and all cabalized projects. The tests are currently executed in parallel with PQC. QuickCheck properties can reside anywhere in the code and don't have to be exported. The [http://darcs.haskell.org/~lemmih/cabal-test darcs repo] is available.</p></li><br />
<br />
<li><p><em>Streams 0.1.7</em>. Bulat Ziganshin<br />
[http://archive.fo/SB0PB announced] Streams version 0.1.7, a fast extensible [http://haskell.org/haskellwiki/Library/Streams I/O and serialization library]. Changes include: GHc 6.6 support, support for files larger than 4G on Windows, haddock documentation.</p></li><br />
<br />
<li><p><em>Ranged Sets 0.0.3</em>. Paul Johnson<br />
[http://archive.fo/FNlCV announced] the 0.0.3 release of [http://ranged-sets.sourceforge.net/Ranged/ Ranged Sets]. Ranged sets allow programming with sets of values described by a list of ranges. A value is a member of the set if it lies within one of the ranges. The ranges in a set are ordered and non-overlapping, so the standard set operations can be implemented by merge algorithms in O(n) time.</p></li></ul><br />
<br />
''2006-11-26''<br />
<br />
<ul> <li><p><em>How to build an adaptable interpreter in one day</em>. The slides of this paper, by Dan Popa, presented at ICMI 45, and not included in the proceedings, are [http://www.haskell.org/haskellwiki/Image:Building_an_interpreter.pdf available now] (pdf). The paper is a step by step guide on the building of a small monadic interpreter. The [http://www.haskell.org/sitewiki/images/5/54/Building_an_interpreter.pdf papers slides] are also available.</p></ul><br />
<br />
<br />
''2006-11-22''<br />
<br />
<ul><li><p><em>Haskell XML Toolbox 7.0</em>. Uwe Schmidt<br />
[http://archive.fo/sYGqf released] a new version of the [http://www.fh-wedel.de/~si/HXmlToolbox/index.html Haskell XML Toolbox]. New in 7.0 is a module for XSLT transformation. The XSLT module implements most of the XSLT standard. The development of the XSLT module is done by Tim Walkenhost in his master thesis, describing the design of the transformer (and the limitations) is included in the distribution. HXT 7.0 works with ghc-6.4 and ghc-6.6. [http://www.haskell.org/haskellwiki/HXT A tutorial] is available in the Haskell wiki.</p></li><br />
<br />
<li><p><em>Hac: Haskell Hackathon 2007</em>. The Hac organisers [http://archive.fo/4n01A announced] that the inaugural Haskell Hackathon, [http://haskell.org/haskellwiki/Hac_2007 Hac 2007], will be held at Oxford University Computing Laboratory, January 10-12, 2007. The plan is to hack on Haskell infrastructure, tools, libraries and compilers. To attend please register, and get ready to hack those lambdas!</p></li><br />
<br />
<li><p><em>System.FilePath 0.11</em>. Neil Mitchell<br />
[http://archive.fo/RzlOU announced] the release of [http://www-users.cs.york.ac.uk/~ndm/projects/libraries.php#filepath System.FilePath 0.11], a library for manipulating FilePath's correctly on both Posix and Windows.</p></li><br />
<br />
<li><p><em>Darcs release candidate</em>. Tommy Pettersson<br />
[http://archive.fo/2raNP announced] it's time for a new darcs release candidate, 1.0.9rc2. There will probably be yet another release candidate (rc3) before final 1.0.9. Get testing!</p></li><br />
<br />
<li><p><em>Safe library 0.1</em>. Neil Mitchell<br />
[http://archive.fo/3ll0T announced] the release of [http://www-users.cs.york.ac.uk/~ndm/projects/libraries.php#safe Safe library, 0.1]. People often have a problem with pattern match errors, and the only helpful message they get is: 'pattern match error'. The Safe library hopes to eliminate some of the frustration this causes by providing versions of these partial functions with more helpful error messages.</p></li><br />
<br />
<li><p><em>LocH, located errors 0.1</em>. Don Stewart<br />
[http://archive.fo/3ll0T announced] the release of LocH, a small Haskell module providing source location-specific error messages and debugging strings for Haskell code. It uses the compiler-expanded 'assert' token, rather than cpp or m4, to provide a lightweight approach to generating source locations. No preprocessor is required. More information is available at [http://www.cse.unsw.edu.au/~dons/loch.html the LocH site], including [http://www.cse.unsw.edu.au/~dons/loch/Debug-Trace-Location.html API documentation].</p></li><br />
<br />
<li><p><em>Starting your own Haskell project</em>. Jason Dagit and Don Stewart<br />
[http://archive.fo/6wXjj expanded] on the document describing how best to [http://haskell.org/haskellwiki/How_to_write_a_Haskell_program set up a new Haskell project], leading to the creation of [http://archive.fo/vefIm mkcabal], a new tool for setting up cabalised Haskell projects.</p></li></ul><br />
<br />
''2006-11-14''<br />
<br />
<ul><li><p><em>Compiling Haskell to Javascript: YCR2JS</em>. Dimitry Golubovsky<br />
[http://archive.fo/EKGCe announced] Ycr2js, a sub-project within the [http://darcs.haskell.org/yhc York Haskell Compiler] (Yhc) project. It is aimed to create a tool to convert an arbitrary Haskell program into Javascript which in turn may be executed in any Web browser. With great amount of help from the Yhc Team, the converter has been integrated into the Yhc project, and initial stage of coding and development has been completed. [http://haskell.org/haskellwiki/Yhc/Javascript More documentation].</p></li><br />
<br />
<li><p><em>System.FilePath 0.10</em>. Neil Mitchell<br />
[http://archive.fo/f91dz announced] System.FilePath 0.10, which hopefully is pretty close to final. [http://www-users.cs.york.ac.uk/~ndm/projects/libraries.php#filepath This library] manipulates FilePath's correctly on both Posix and Windows.</p></li><br />
<br />
<li><p><em>Major typeclass overhaul</em>. Simon Peyton-Jones<br />
[http://archive.fo/hDS6f mentioned] that for some time he has been promising an overhaul of GHC's type inference machinery to fix the interactions between type classes and GADTs. This overhaul has now been completed, and user-visible changes are summarised, including: GHC's type inference becomes complete, the restriction that every constraint in a type signature must mention at least one of the quantified type variables is lifted, dictionaries are packaged in data constructors and the proper interaction between GADTs and type classes is now respected.</p></li><br />
<br />
<li><p><em>Implementing the lambda calculus</em>. Lennart Augustsson<br />
[http://archive.fo/AryLP wrote] about implementing interpreters for the lambda-calculus in Haskell, to [http://darcs.augustsson.net/Darcs/Lambda/ experiment] with different implementation methods.</p></li><br />
<br />
<li><p><em>Great language shootout: reloaded</em>. Don Stewart<br />
[http://archive.fo/yykOp mentioned] that now [http://haskell.org/ghc GHC 6.6] is available on the shootout machines, the time has come to improve the existing [http://shootout.alioth.debian.org/ language shootout] entries. Improvements can be posted to the [http://www.haskell.org/haskellwiki/Great_language_shootout wiki] for review.</p></li></ul><br />
<br />
''2006-11-08''<br />
<br />
<ul><li><p><em>SmallCheck 0.2</em>. Colin Runciman<br />
[http://archive.fo/e7mcS announced] that SmallCheck 0.2, a lightweight testing library for Haskell,<br />
is out, and can be [http://www.cs.york.ac.uk/fp/smallcheck0.2.tar obtained].<br />
Since version 0.1: there's now a choice of interactive or non-interactive test-drivers using iterative deepening; more pre-defined test-data generators, including revised Int, Integer, Float, Double, Nat and Natural and additional examples. SmallCheck is similar to QuickCheck but instead of testing for a sample of randomly generated values, SmallCheck tests properties for all the finitely many values up to some depth, progressively increasing the depth used.</p></li><br />
<br />
<li><p><em>Hoogle Command Line 3 Beta</em>. Neil Mitchell<br />
[http://archive.fo/rV1py released] Hoogle Command Line version 3 Beta, an alternative to [http://haskell.org/hoogle the Hoogle website]. Hoogle lets you search for Haskell functions by name and by type signature.</p></li><br />
<br />
<li><p><em>The Monad.Reader</em>. Wouter Swierstra<br />
[http://archive.fo/2iG0c issued] a call for submissions for articles for the next issue of [http://www.haskell.org/haskellwiki/TheMonadReader The Monad.Reader]. There are a large number of conferences and journals that accept research papers related to Haskell; unfortunately, the platform for non-academic publications is far less developed. This is where The Monad.Reader fits in. So if you are tossing around some ideas, write it up, and submit! Deadline for submissions is January 19th, 2007.</p></li><br />
<br />
<li><p><em>Haskell Communities and Activities Report</em>. Andres Loeh<br />
[http://archive.fo/DH1Bx reminded us] that the deadline for the November 2006 edition of the Haskell Communities and Activities Report is now! -- there may still be just enough time to make sure that the report contains a section on *your* project, on the interesting stuff that you've been doing; using or affecting Haskell in some way. For more info see [http://www.haskell.org/pipermail/haskell/2006-October/018646.html the call for contributions].</p></li><br />
<br />
<li><p><em>HsMan</em>. Frederik Eaton<br />
[http://archive.fo/eSfoR announced] hsman, a tool that indexes Haddock-generated HTML files, and allows users to search for functions and also GHC manual topics.</p></li><br />
<br />
<li><p><em>HaL, Haskell meeting in Leipzig</em>. Johannes Waldmann<br />
[http://archive.fo/QwGOd announced] that a local Haskell meeting is to take place on December 5th in Leipzig, Germany. The meeting will be hosted by IBA Consulting. It will be quite informal, with some very short talks (most probably in German). Interessenten sind herzlich eingeladen. [http://iba-cg.de/haskell.html Details and (free) registration].</p></li></ul><br />
<br />
''2006-10-31''<br />
<br />
<ul><li><p><em>A type-based solution to the "strings problem"</em>. Tom<br />
Moertel wrote on<br />
[http://blog.moertel.com/articles/2006/10/18/a-type-based-solution-to-the-strings-problem a solution] to the problem of keeping web applications free of<br />
string-based XSS and SQL-injection vulnerabilities, by employing the<br />
Haskell type system.</p></li><br />
<br />
<li><p><em>Associated data types in GHC</em>. Manuel Chakravarty<br />
[http://archive.fo/Pt1Nw announced] the availability of indexed data types, an extension of our earlier proposal for [http://www.cse.unsw.edu.au/~chak/papers/CKPM05.html associated data types], in GHC's development version. Detailed information on where to get the right GHC and how to use indexed types is available from [http://haskell.org/haskellwiki/GHC/Indexed_types the Haskell wiki].</p></li><br />
<br />
<li><p><em>Yhc Bytecode library 0.3</em>. Robert Dockins<br />
[http://archive.fo/d4Hcb announced] the release of the [http://www.eecs.tufts.edu/~rdocki01/yhc-bytecode.html Yhc Bytecode library], version 0.3.</p></li><br />
<br />
<li><p><em>Haskell Program Coverage</em>. Andy Gill<br />
[http://www.galois.com/~andy/ray/hpc.html checked] the latest version of HPC, with GHC support, into the head GHC branch</p></li><br />
<br />
<li><p><em>Haskell Mersenne Twister</em>. Lennart Augustsson<br />
[http://www.augustsson.net/Darcs/MT/ made available] his Haskell implementation of the Mersenne Twister random number generator.</p></li><br />
<br />
<li><p><em>Haskell-specific Google Search Engine</em>. Don Stewart<br />
[http://www.google.com/coop/cse?cx=015832023690232952875%3Acunmubfghzq initialised] a Haskell-specific search engine, as part of Google's coop engine system, which seems to do a good job of targeting just Haskell sites, in particular, mailing list items</p></li><br />
<br />
<li><p><em>A process for submitting library extensions</em>. The libraries hackers<br />
[http://archive.fo/Muwy4 have] developed [http://haskell.org/haskellwiki/Library_submissions a document] describing how to best go about contributing new code to the core Haskell libraries. On a similar note, the GHC team has prepared [http://hackage.haskell.org/trac/ghc/wiki/WorkingConventions a page] on best practice for GHC submissions.</p></li><br />
<br />
<li><p><em>How to create a Haskell project</em>. Don Stewart and Ian Lynagh<br />
[http://archive.fo/DhA9p prepared] some guidelines on starting your own Haskell project.</p></li></ul><br />
<br />
''2006-10-24''<br />
<br />
<ul><li><p><em>MissingH 0.16.0</em>. John Goerzen<br />
[http://archive.fo/1f1Zv announced] that the latest version of MissingH is now available. MissingH is a suite of 'missing' library functions. New features include: render numbers as binary units, a progress tracker, turn QuickCheck tests into HUnit tests, and GHC 6.6 support.</p></li><br />
<br />
<li><p><em>SMP parallel Pugs on GHC</em>. Audrey Tang<br />
[http://archive.fo/eZEO6 announced] that parallel support, on top of GHC's new SMP runtime system, has been added to Pugs, the standard bearer [http://pugs.blogs.com/pugs/2006/10/smp_paralleliza.html Perl6 implementation].</p></li><br />
<br />
<li><p><em>YAHT is now a part of the wikibook</em>. Eric Kow<br />
[http://koweycode.blogspot.com/2006/10/yaht-badly-imported.html announced] that the famous 'Yet Another Haskell Tutorial' has been imported into [http://en.wikibooks.org/wiki/Haskell the Haskell wikibook]. Let the great Haskell Remix begin!</p></li></ul><br />
<br />
''2006-10-19''<br />
<br />
<ul><li><p><em>GHC version 6.6</em>. The GHC Team<br />
[http://archive.fo/oN2nt announced] a new release of GHC! There have been many changes since the 6.4.2 release. For details, see [http://haskell.org/ghc/docs/6.6/html/users_guide/release-6-6.html the release notes]. Binary builds, source and packages are all found at [http://www.haskell.org/ghc/ GHC's home].</p></li><br />
<br />
<li><p><em>Haddock version 0.8</em>. Simon Marlow<br />
[http://archive.fo/NoHL8 announced] Haddock 0.8, including: cabalisation, Hoogle support, image inclusion. [http://www.haskell.org/haddock Read more.]</p></li><br />
<br />
<li><p><em>Pugs 6.2.13 released</em>. Audrey Tang<br />
[http://pugs.blogs.com/pugs/2006/10/pugs_6213_relea.html announced] that after nearly four months of development and 3400+ commits, [http://pugscode.org Pugs] 6.2.13, the leading Perl6 implementation written in Haskell, is now available.</p></li><br />
<br />
<li><p><em>STM invariants and exceptions</em>. Tim Harris<br />
[http://archive.fo/Az2zs announced] that new transactional memory features have been committed to GHC. The main change is to add support for dynamically checked data invariants of the kind described in [http://research.microsoft.com/~tharris/papers/2006-transact.pdf this paper (pdf)]. There are two operations: <code>always X :: STM Bool -> STM ()</code> and <code>alwaysSucceeds X :: STM a -> STM ()</code>. More details in [http://research.microsoft.com/~tharris/papers/2005-ppopp-composable.pdf here (pdf)].</p></li><br />
<br />
<li><p><em>Cabal version 1.1.6 is now available</em>. Duncan Coutts<br />
[http://archive.fo/a5bXJ announced] that [http://haskell.org/cabal/ Cabal], the common architecture for building applications and libraries, version 1.1.6 is now available. It is included in GHC version 6.6.</p></li><br />
<br />
<li><p><em>Fun in the Afternoon: Thurs 16th Nov in Oxford</em>. Jeremy Gibbons<br />
[http://archive.fo/BCHz9 announced] that he, Graham Hutton and Conor McBride at Nottingham are organizing a seminar, [http://sneezy.cs.nott.ac.uk/fun/ Fun in the Afternoon], on functional programming and related topics. The idea is to have a small number of talks as an antidote to mid-term blues, three afternoons a year. The hope is that talks will be informal and fun, and that there will be plenty of scope for discussion and chat as well. Looks fun!</p></li><br />
<br />
<li><p><em>HC&A Call for Contributions</em>. Andres Loeh<br />
[http://archive.fo/OrmMP asked] for contributions towards the 11th [http://www.haskell.org/communities/ Haskell Communities & Activities Report], a bi-annual overview of the state of Haskell as well as Haskell-related projects of all flavours.</p></li><br />
<br />
<li><p><em>Generic Haskell version 1.60 (Diamond)</em>. Utrecht's Generic Haskell Team<br />
[http://archive.fo/0dmYO announced] a new release of [http://www.generic-haskell.org Generic Haskell], an extension of Haskell that facilitates generic programming. Generic Haskell includes: type-indexed values and type-indexed types. The Generic Haskell compiler takes Generic Haskell source and produces Haskell code. This release adds support for Generic Views.</p></li><br />
<br />
<li><p><em>Streams 0.1 available for GHC 6.6</em>. Bulat Ziganshin<br />
[http://archive.fo/c12bu announced] that the Streams 0.1 library is now compatible GHC 6.6.</p></li></ul><br />
<br />
''2006-10-10''<br />
<br />
<ul><li><p><em>hinotify 0.1</em>. Lennart Kolmodin<br />
[http://archive.fo/nLnmM announced] hinotify 0.1, a library to [http://www.kernel.org/pub/linux/kernel/people/rml/inotify/ inotify] which has been part of the Linux kernel since 2.6.13. inotify provides file system event notification, simply add a watcher to a file or directory and get an event when it is accessed or modified. [http://haskell.org/~kolmodin/code/hinotify/docs/api/ API] and [http://haskell.org/~kolmodin/code/hinotify/ source].</p></li><br />
<br />
<li><p><em>Monad Transformer Tutorial</em>. Martin Grabmueller<br />
[http://archive.fo/MdyXO published] a small tutorial on using monad transformers. In contrast to others approaches, it concentrates on using them, not on their implementation. [http://uebb.cs.tu-berlin.de/~magr/pub/Transformers.en.html PDF and Literate Haskell source available].</p></li><br />
<br />
<li><p><em>Speaking Haskell in Spanish</em>. Luis Araujo<br />
[http://archive.fo/aOemt announced] [http://haskell.org/haskellwiki/Haskell.es a project] to make Haskell documentation more available to Spanish speakers. The idea is to [http://www.haskell.org/haskellwiki/Haskell.es collect information in Spanish] about Haskell, including news and tutorials, and to translate [http://haskell.org/haskellwiki/Special:Popularpages Haskell wiki pages].</p></li><br />
<br />
<li><p><em>Haskell Packages 6.6</em>. Isaac Jones<br />
[http://archive.fo/TOU61 announced] that the Cabal package tools for Haskell are in a good state, with almost 30 packages already in [http://hackage.haskell.org/packages/ the database]. Time to start testing packages, starting with the cabal release candidate that'll go into GHC 6.6, to make sure they work nicely together!</p></li><br />
<br />
<li><p><em>Cabal-1.1.6 release candidate</em>. Duncan Coutts<br />
[http://archive.fo/zFRmo released] a tarball for the next 1.16 Cabal release candidate. Let's get this tested before GHC 6.6 arrives!</p></li><br />
<br />
<li><p><em>Darcs 1.0.9 release candidate</em>. Tommy Pettersson<br />
[http://archive.fo/edaZO announced] the first release candidate for next stable [http://darcs.net darcs], 1.0.9rc1. This will mainly be a bug fix version to get things right that got wrong or didn't get right in 1.0.7 and 1.0.8, but there are some new features and optimizations too.</p></li><br />
<br />
<li><p><em>Haskell and Vim</em>. Marc Weber<br />
[http://archive.fo/XZy9N wrote] some Vim scripts to ease various Haskell coding tasks in Vim.</p></li></ul><br />
<br />
''2006-10-03''<br />
<br />
<ul><li><p><em>Proceedings Haskell Workshop 1995</em>. Henrik Nilsson<br />
[http://archive.fo/zxnyL announced] that in celebration of the 10th [http://haskell.org/haskell-workshop Haskell Workshop] that took place recently, the proceedings of the very first Haskell workshop, in La Jolla 1995, have now been made available on [http://haskell.org/haskell-workshop/1995 the Haskell Workshop home page]. Thanks to Paul Hudak for help locating the proceedings and arranging for them to be scanned into PDF.</p></li><br />
<br />
<li><p><em>Common library for generic programming</em>. Johan Jeuring and Andres Loeh<br />
[http://archive.fo/X72Xq announced] an initiative to design a common library for generic programming, which should work together with most of the Haskell compilers, and for which they hope to guarantee support for generics in Haskell into the future. If you want to get involved (or just want to see the discussion), you can subscribe to [http://www.haskell.org/mailman/listinfo/generics the generics mailing list]. Check the [http://haskell.org/haskellwiki/Research_papers/Generics Haskell research wiki] for some background on generics.</p></li><br />
<br />
<li><p><em>GHC 6.6 Second Release Candidate</em>. Ian Lynagh<br />
[http://archive.fo/tpTie announced] that the Second Release Candidate phase for GHC 6.6 is underway. Get testing!</p></li><br />
<br />
<li><p><em>Lazy functional language for the JVM</em>. Luke Evans<br />
[http://archive.fo/MnTyG announced] <br />
that the research group at Business Objects has developed a lazily evaluated, strongly-typed language called CAL, with many similarities to Haskell, targeting the JVM, to facilitate representing certain kinds of business logic as reusable, composable pieces.</p></li></ul><br />
<br />
''2006-09-27''<br />
<br />
<ul><li><p><em>ICFP Contest Results</em>. CMU's Principles of Programming Group<br />
[http://icfpcontest.org announced] the results of this year's [http://icfp06.cs.uchicago.edu/ ICFP] programming contest. Congratulations to the winning team from Google, 'Team Smartass', (Christopher Hendrie, Derek Kisman, Ambrose Feinstein and Daniel Wright), who used Haskell along with C++, Bash and Python. Haskell has now been used by the winning team three years running! An honourable mention to team Lazy Bottoms, another Haskell team, who managed to crack several of the puzzles first. Five teams from the [http://haskell.org/haskellwiki/IRC_channel #haskell IRC channel] were [http://icfpcontest.org/scoreboard.shtml placed] in the top 50. A video stream of the results announcement is [http://video.google.com/videoplay?docid=6419094369756184531 available], shot and cut by Malcolm Wallace. Many thanks to the [http://www.cs.cmu.edu/afs/cs/Web/Groups/pop/pop.html CMU team] for organising such a great contest!</p></li><br />
<br />
<li><p><em>New release of Hugs</em>. Ross Paterson<br />
[http://archive.fo/jJc7D announced] a new minor release of Hugs, fixing a few bugs with the May 2006 release, and with libraries roughly matching the forthcoming GHC 6.6 release. It is available from [http://www.haskell.org/hugs/ the Hugs page].</p></li><br />
<br />
<li><p><em>HAppS version 0.8.2</em>. Einar Karttunen<br />
[http://archive.fo/LjnKK announced] the release of the Haskell Application Server version 0.8.2. HAppS is a Haskell web application server for building industrial strength internet applications safely, quickly, and easily. With HAppS you focus entirely on application functionality implemented in your favourite language and you don't have to worry about making sure all sorts of server subsystems are functioning properly. [http://happs.org/ More info].</p></li><br />
<br />
<li><p><em>Codec.Compression.GZip and .BZip</em>. Duncan Coutts<br />
[http://archive.fo/lF3lo released] two new packages: zlib and bzlib, which provide functions for compression and decompression in the gzip and bzip2 formats, directly on [http://www.cse.unsw.edu.au/~dons/fps.html ByteStrings]. Both provide pure functions on streams of data represented by lazy ByteStrings. This makes it easy to use either in memory or with disk or network IO. There is API documentation is available [http://haskell.org/~duncan/zlib/docs here] and [http://haskell.org/~duncan/bzlib/docs here].</p></li><br />
<br />
<li><p><em>System Fc branch merged into GHC</em>. Manuel Chakravarty<br />
[http://archive.fo/byaiO merged] the [http://www.cse.unsw.edu.au/~chak/papers/SCP06.html System Fc] branch of GHC into GHC head. This is a significant development, adding extensions to GHC to support an [http://hackage.haskell.org/trac/ghc/wiki/IntermediateTypes FC-based intermediate language], a new implementation of GADTs, along with indexed data types and indexed newtypes (generalised [http://www.cse.unsw.edu.au/~chak/papers/CKPM05.html associated data types]). [http://hackage.haskell.org/trac/ghc/wiki/TypeFunctions More details] about the implementation.</p></li><br />
<br />
<li><p><em>Job writing security software in Haskell</em>. Andrew Pimlott<br />
[http://archive.fo/mAeys announced] that Planning Systems, Inc. has a job opportunity for Haskell programmers, writing a high-assurance authorization system. [http://www.plansys.com/careers/job_details.cfm?JobID=28 Job description].</p></li><br />
<br />
<li><p><em>Dr Haskell 0.1</em>. Neil Mitchell<br />
[http://archive.fo/9T29p released] Dr Haskell, a tool to help suggest improvements to your Haskell code. Dr Haskell will analyse your code, and suggest shorter alternatives for rewriting. [http://www-users.cs.york.ac.uk/~ndm/projects/drhaskell.php More details].</p></li><br />
<br />
<li><p><em>BitSyntax for Haskell</em>. Adam Langley<br />
[http://archive.fo/mIIl5 released] a [http://www.imperialviolet.org/binary/bitsyntax/ bit syntax library] for Haskell, based on Erlang's [http://www.erlang.org/doc/doc-5.4.12/doc/programming_examples/bit_syntax.html bit syntax] (great for building and breaking up binary structures). Nice!</p></li><br />
<br />
<li><p><em>File fuzzing</em>. Tim Newsham<br />
[http://archive.fo/LaTW7 made available] FileH, a Haskell tool for generating test data via random file mutation. [http://www.isecpartners.com/file_fuzzers.html More details].</p></li><br />
<br />
<li><p><em>A DSL for state machines</em>. Stephane Bortzmeyer<br />
[http://archive.fo/9LzlM announced] a Haskell implementation of a proposal to the IETF to standardize [http://www.cosmogol.fr/ a language] used for finite state machines (which are common in IETF standards). The reference implementation is [http://www.cosmogol.fr/shadok.html available].</p></li><br />
<br />
<li><p><em>A language tag parser</em>. Stephane Bortzmeyer<br />
announced [http://www.bortzmeyer.org/gabuzomeu-parsing-language-tags.html GaBuZoMeu], a set of programs to parse and check [http://www.iana.org/assignments/language-subtag-registry language tags] (see RFC 4646 produced by the IETF Working Group LTRU - Language Tag Registry Update).</p></li></ul><br />
<br />
''2006-09-18''<br />
<br />
<ul><br />
<li><br />
<p><br />
<em><br />
Haskell98 Termination Analyser<br />
</em>. Stephan Swidersk<br />
[http://archive.fo/yuIx4 announced] the integration of an automatic Haskell98 termination analyzer in the termination tool AProVE. The tool accepts full Haskell as specified in the Haskell 98 Report and is available through our web interface. [http://aprove.informatik.rwth-aachen.de/ More]<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em><br />
Free theorems<br />
</em>. Janis Voigtlaender<br />
[http://archive.fo/W5nWJ announced] that Sascha Boehme has done a project to implement the Reynolds/Wadler algorithm generating theorems from polymorphic types, plus simplifications and postprocessings for such free theorems. [http://haskell.as9x.info/ More info]<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em><br />
Haddock/GHC SoC<br />
</em>. David Waern<br />
[http://archive.fo/KgIJ3 announced] a short status report of the "Port Haddock to use GHC" Summer of Code project. The GHC modifications, are finished and will be included in the GHC head repository soon.<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em><br />
AutoForms release 0.2<br />
</em>. Mads Lindstr�m<br />
[http://archive.fo/kDokH released] AutoForms 0.2, a library to ease the creation of GUIs. It does this by using generic programming (SYB) to construct GUI components. [http://autoforms.sourceforge.net/ More info]<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em><br />
HSPClientside 0.2<br />
</em>. Joel Bj�rnson<br />
[http://archive.fo/8Rn8I announced] a new version of HSPClientside (0.2) ,developed as a GSoC project during this summer. HSPClientside is a Haskell Server Pages library for generating JavaScript code. [http://darcs.haskell.org/SoC/hsp.clientside/ More info]<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em><br />
SOE implementation based on Gtk2Hs<br />
</em>. Duncan Coutts<br />
[http://archive.fo/Jd3Jm Due to popular demand] the new SOE implementation based on Gtk2Hs is [now available]. The rendering quality is better than the original HGL version. [http://haskell.org/~duncan/gtk2hs/SOE-cairo.png Here's a side-by-side comparison]<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em><br />
The experimental GHCi debugger<br />
</em>. Pepe<br />
[http://archive.fo/wpowG announced] the results of his SoC project, the experimental Haskell debugger. [http://haskell.org/haskellwiki/GHC/GHCiDebugger More details]<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em><br />
SmallCheck<br />
</em>. Colin Runciman<br />
[http://archive.fo/xr3xn released] a prototype tool that is similar in spirit, and in some of its workings, to QuickCheck. SmallCheck is, though, based on exhaustive testing in a bounded space of test values. [http://www.cs.york.ac.uk/fp/smallcheck0.0.tar More info]<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em><br />
Frisby: composable, linear time parser for arbitrary PEG grammers<br />
</em>. John Meacham<br />
[http://archive.fo/V2IV2 released] Frisby, an implementation of the 'packrat' parsing algorithm, which parse PEG grammars and have a number of very useful qualities, they are a generalization of regexes in a sense that can parse everything in LL(k), LR(k), and more, including things that require unlimited lookahead, all in guaranteed linear time. [http://repetae.net/computer/frisby/ More information]<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em><br />
HaskellNet<br />
</em>. Jun Mukai<br />
[http://archive.fo/7OI71 published] a status report on the state of his SoC project, HaskellNet<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em><br />
GHC's new support engineer<br />
</em>. Simon Marlow<br />
[http://archive.fo/UZ3Vl announced] that GHC now has a full-time support engineer, Ian Lynagh (aka Igloo on IRC). He'll be helping with all aspects of GHC, especially release management, bug diagnosis and tracking, documentation, packaging, and supporting other GHC hackers. Welcome Ian!<br />
</p><br />
</li><br />
</ul><br />
<br />
''2006-08-14''<br />
<br />
<ul><br />
<li><br />
<p><br />
<em><br />
The Haskell Workshop<br />
</em>. Andres Loeh<br />
[http://archive.fo/jAJj0 announced]<br />
the preliminary schedule of the Haskell Workshop 2006, part of the 2006 International Conference on Functional Programming (ICFP)<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em><br />
dbus haskell bindings<br />
</em>. Evan Martin<br />
[http://archive.fo/ymeKr announced] preliminary D-Bus Haskell bindings. D-Bus is a message bus system, a simple way for applications to talk to one another. [http://neugierig.org/software/hdbus/ More]<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em><br />
The GHC typechecker is Turing-complete<br />
</em>. Robert Dockins<br />
was able to [http://archive.fo/IboIF show] how that the GHC typechecker with multi-parameter typeclasses, functional dependencies, and undecidable instances is Turing-complete.<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em><br />
Haskell Program Coverage<br />
</em>. Colin Runciman<br />
[http://archive.fo/6L37k announced] the first release of hpc, a new tool for Haskell developers. Hpc records and displays Haskell program coverage. It provides coverage information of two kinds: source coverage and boolean-control coverage. [http://www.galois.com/~andy/hpc-intro.html More here]<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em><br />
Smash your boiler-plate without class and Typeable<br />
</em>. Oleg Kiselyov<br />
[http://archive.fo/vmJvZ described] a new generic programming technique, expressive enough to traverse a term and return another term of a different type, determined by the original term's type/structure. [http://okmij.org/ftp/Haskell/syb4.hs More details]<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em><br />
Paper: Software Extension and Integration with Type Classes<br />
</em>. Ralf Laemmel and Klaus Ostermann<br />
[http://archive.fo/ix4jj invite] comments towards the final version of their paper [http://homepages.cwi.nl/~ralf/gpce06/ Software Extension and Integration with Type Classes]<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em><br />
HSP.Clientside 0.01<br />
</em>. Joel Bj�rnson<br />
[http://archive.fo/G8JHY announced] a release of his Summer of Code project HSP.Clientside 0.01. Present features include an embedding of (typed) JavaScript language in Haskell, a small combinator library for generating JavaScript code, and high-level interface to Ajax functionality.<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em><br />
Monadic probabilistic functional programing<br />
</em>. Stefan Karrmann<br />
[http://archive.fo/5Jo6D announced] that he had extended Martin Erwig's PFP library to support abstract monads, cabal and darcs<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em><br />
hdbc-odbc 1.0.0.1<br />
</em>. John Goerzen<br />
[http://archive.fo/uj4vi released] DBC-odbc, the ODBC backend driver for HDBC, version 1.0.0.1.<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em><br />
Few Digits 0.5.0<br />
</em>. Russell O'Connor<br />
This year, Few Digits competed in the [http://rnc7.loria.fr/competition.html More Digits contest]. To celebrate, version 0.5.0 of Few Digits is available. Few Digits 0.5.0 is now ten times faster and three times more complicated. Few Digits has been Cabalized for your convenience. [http://r6.ca/FewDigits/ More info]<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em><br />
System.FilePath 0.9<br />
</em>. Neil Mitchell<br />
[http://archive.fo/SUJTX announced] System.FilePath 0.9<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em><br />
The History of Haskell<br />
</em>. Phil Wadler, John Hughes, Paul Hudak and Simon Peyton Jones<br />
[http://archive.fo/TXoUE have been writing] a paper, The History of Haskell, for the History Of Programming Languages conference (HOPL'07), and they invite feedback. Wiki page [http://haskell.org/haskellwiki/History_of_Haskell here].<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em><br />
AngloHaskell<br />
</em>. Lemmih<br />
[http://archive.fo/F54Hh mentioned] that AngloHaskell will be held at Cambridge in August. The agenda includes beer, unicycles, hacking and other fun. [http://haskell.org/haskellwiki/AngloHaskell More info]<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em><br />
Haskell XML Toolbox Version 6.0, 6.1<br />
</em>. Uwe Schmidt<br />
[http://archive.fo/thpuB announced] [http://archive.fo/4GJ5W two] new versions of the Haskell XML Toolbox. New features include ghc 6.4.2 support, better XPath integration, separate documentation for filter API and an arrow API<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em><br />
Down the rabbit hole<br />
</em>. Bulat Ziganshin<br />
[http://archive.fo/RR4Tg announced] the availability of a new tutorial directed toward comprehensive explanation of the IO monad, and it's use in complex programs<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em><br />
ldap-haskell, arch2darcs and darcs-buildpackage<br />
</em>. John Goerzen<br />
[http://archive.fo/E3pGA posted] new versions of these packages<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em><br />
Internships on GHC and Haskell at MSR Cambridge<br />
</em>. Simon Peyton-Jones<br />
[http://archive.fo/R0yGT announced] that MSR Cambridge is taking interns year-round, not just in the summer months. GHC HQ are keen to attract motivated and well-qualified folk to work on improving or developing GHC. [http://hackage.haskell.org/trac/ghc/wiki/Internships More details]<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em><br />
FGL<br />
</em>. Martin Erwig<br />
[http://archive.fo/mRb9I announced] a new release of his well known Functional Graph Library (FGL).<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em><br />
Takusen<br />
</em>. Alistair Bayley and Oleg Kiselyov<br />
[http://archive.fo/LrRyn released] a new version of Takusen, a library for accessing DBMSs. The most significant code change is a new internal design, giving better separation of concerns like statement preparation, binding, and result-set processing. Takusen is now held in darcs, and [http://darcs.haskell.org/takusen hosted] at haskell.org<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em><br />
Text.Regex.Lazy 0.44, 0.56, 0.66 and 0.70<br />
</em>. Chris Kuklewicz<br />
[http://archive.fo/YgwK3 announced] [http://sourceforge.net/projects/lazy-regex Text.Regex.Lazy] 0.44-0.70, with many enhancements. Multiple backends are supported, in addition to the "full lazy" and the DFA backends. Text.Regex.Lazy is a replacement and enhancement for Text.Regex. More details [http://archive.fo/0lQMr here]<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em><br />
Streams 0.2.1 beta<br />
</em>. Bulat Ziganshin<br />
[http://archive.fo/9Np81 released] Streams 0.2.1 beta, featuring various bug fixes and improvements to the streams library<br />
</p><br />
</li><br />
</ul><br />
<br />
''2006-07-24''<br />
<br />
* [[ICFP Programming Contest#Ninth annual ICFP Programming Contest (2006)|Ninth annual ICFP Programming Contest (2006)]] is over. Results will be announced in September.<br />
<br />
''2006-07-03''<br />
<br />
<ul><br />
<li><br />
<p><br />
<em><br />
HDBC 1.0<br />
</em>. John Goerzen<br />
[http://archive.fo/QPpSz released] the latest HDBC. HDBC is a database tool, modeled loosely on Perl's DBI interface, though it has also been influenced by Python's DB-API v2, JDBC in Java, and HSQL in Haskell. You can find the code [http://quux.org/devel/hdbc here].<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em><br />
hpodder<br />
</em>. John Goerzen<br />
[http://archive.fo/hvpiC announced] the first release of hpodder. hpodder is a podcast downloader (podcatcher) written in pure Haskell. It exists because John was unsatisfied with the other podcatchers for Linux. Full details [http://quux.org/devel/hpodder here].<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em><br />
hmp3 1.1<br />
</em>. Don Stewart<br />
[http://archive.fo/D0KFT announced] a new release of hmp3, the curses-based mp3 player written in Haskell. Release 1.1 is a maintenance release, fixing support for GHC 6.4.2<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em><br />
HSP.Clientside 0.001<br />
</em>. Joel Bjornson<br />
[http://archive.fo/fp5he announced] a prerelease version of Hsp.Clientside. This is Joel's [http://code.google.com/soc/haskell/about.html Summer of Code] project aiming to add support for client-side script generation in Haskell Server Pages. The basic building blocks for embedding Javascript has been implemented. As the project proceeds a suitable programming model based on these components will be added. Hopefully this will also include some kind of higher level Ajax support. For more information see [http://www.dtek.chalmers.se/~bjornson/soc here].<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em><br />
QDBM and Hyper Estraier bindings<br />
</em>. Jun Mukai<br />
[http://archive.fo/92wW2 released] a library of bindings to Quick DBM, a database module similar to GDBM, Berkeley-DB, optimized for performance and a simple API. Additionally, Jun's code includes support for Hyper Estraier, a full-text search system using QDBM, with the ability to search documents according to keywords.<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em><br />
Streams 0.2<br />
</em>. Bulat Ziganshin<br />
[http://archive.fo/yDclH announced] the beta release of his Streams 0.2 library, providing fast string and binary IO, now with Data.ByteString support.<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em><br />
HNOP 0.1<br />
</em>. Ashley Yakeley<br />
[http://archive.fo/seKtU released] the first version of HNOP 0.1. HNOP does nothing. This version should be considered "beta" quality.<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em><br />
HList updates<br />
</em>. Oleg Kiselyov<br />
[http://archive.fo/gsKhV announced] that HList, the library for strongly typed heterogeneous lists, records, type-indexed products (TIP) and co-products is now accessible via darcs, [http://darcs.haskell.org/HList/ here]. Additionally, Oleg pointed to some new features for HList, including a new representation for open records. Finally, he [http://archive.fo/3D45f published] a note on how HList supports, natively, polymorphic variants: extensible recursive open sum datatypes, quite similar to Polymorphic variants of OCaml. HList thus solves the `expression problem' -- the ability to add new variants to a datatype without changing the existing code.<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em><br />
Haskell IO Inside<br />
</em>. Bulat Ziganshin<br />
[http://archive.fo/WWT86 wrote] a new introductory tutorial to IO in Haskell, [http://haskell.org/haskellwiki/IO_inside Down the Rabbit's Hole].<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em><br />
Bytecode API 0.2<br />
</em>. Robert Dockins<br />
[http://archive.fo/davY7 published] the Yhc Bytecode API version 0.2. More details [http://www.eecs.tufts.edu/~rdocki01/yhc-bytecode.html here].<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em><br />
Translating Haskell into English<br />
</em>. Shannon Behrens<br />
[http://www.linuxjournal.com/article/9096 published] a new Haskell tutorial, hoping to give readers a glimpse of the Zen of Haskell, without requiring that they already be Haskell converts.<br />
</p><br />
</li><br />
</ul><br />
<br />
''2006-06-25''<br />
<br />
<ul><br />
<li><br />
<p><br />
<em><br />
The GHC Hackathon<br />
</em>. Simon Peyton-Jones<br />
[http://archive.fo/2Bp4y announced] that GHC HQ are going to run a hackathon, in Portland, just before ICFP this September (14-15th). It'll be held at Galois's offices, in Beaverton. Thanks go to [http://galois.com Galois] for hosting the meeting. [http://hackage.haskell.org/trac/ghc/wiki/Hackathon Here] are the details. If you are interested in finding out a bit about how GHC works inside, then you should find the hackathon fun. It will be informal and interactive. If you think you might come, please take a look at the above page, and register.<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em><br />
Bytecode API library<br />
</em>. Robert Dockins<br />
[http://archive.fo/BLbnM announced] a release of an alpha version of a library for reading and writing the YHC bytecode file format. It reads and writes the entire bytecode set, version 1.9 (the one used by recent YHC builds). [http://www.eecs.tufts.edu/~rdocki01/yhc-bytecode.html Check it out].<br />
</p><br />
</li><br />
</ul><br />
<br />
''2006-06-16''<br />
<br />
<ul><br />
<li><br />
<p><br />
<em>Google Summer of Code</em>. The Haskell.org team<br />
[http://www.haskell.org/pipermail/haskell/2006-May/017999.html announced]<br />
that nine Haskell projects have been selected to receive funding to the<br />
value of $45k under Google's 2006 <br />
[http://code.google.com/soc Summer of Code] <br />
program. A wide range of projects will be worked on, contributing to<br />
the community important tools and libraries. The students have until<br />
August 21 to complete their projects, and receive their grants. Details<br />
of the accepted projects can be found <br />
[http://code.google.com/soc/haskell/about.html here]<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em>Haskell Communities & Activities Report</em>. Andres Loeh<br />
[http://www.haskell.org/pipermail/haskell/2006-June/018071.html published] <br />
the 10th edition of the Haskell Communities and Activities<br />
Report (HCAR). If you haven't encountered the Haskell Communities and<br />
Activities Reports before, you may like to know that the first of these reports<br />
was published in November 2001. Their goal is to improve the communication<br />
between the increasingly diverse groups, projects and individuals working on,<br />
with, or inspired by Haskell.<br />
</p><br />
<br />
<p><br />
Read the 10th edition [http://www.haskell.org/communities/ here].<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em>Would you like a job working on GHC?</em>. Simon Peyton-Jones <br />
[http://www.haskell.org/pipermail/haskell/2006-June/018068.html announced]<br />
that GHC HQ is looking for support engineer. The Glasgow Haskell<br />
Compiler (GHC) is now being used by so many people, on so many<br />
platforms, that GHC HQ has been struggling to keep up. In<br />
particular, the candidate should be someone who is enthusiastic<br />
about Haskell, and fired up about the prospect of becoming a GHC<br />
expert.<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em>Shellac and Lambda Shell 0.3</em>. Robert Dockins<br />
[http://www.haskell.org/pipermail/haskell/2006-May/018041.html announced]<br />
the simultaneous release of Shellac 0.3 and Lambda Shell 0.3. <br />
Shellac is a library for creating read-eval-print style shells. It makes <br />
binding to feature-rich shell packages (ie, readline) easier. Lambda shell <br />
is full-featured shell environment for evaluating terms of the pure untyped <br />
lambda calculus and a showcase/tutorial for Shellac's features.<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em>darcs-graph</em>. Don Stewart released<br />
[http://www.cse.unsw.edu.au/~dons/darcs-graph.html darcs-graph],<br />
a tool for generating graphs of commit activity for darcs repositories.<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em>VersionTool 1.0</em>. Manuel Chakravarty<br />
[http://www.haskell.org/pipermail/haskell/2006-June/018063.html announced]<br />
version 1.0 of <br />
[http://www.cse.unsw.edu.au/~chak/haskell/VersionTool/ VersionTool], <br />
a small utility that:<br />
<ul><br />
<li>extracts version information from Cabal files,<br />
<li>maintains version tags in darcs,<br />
<li>computes patch levels by querying darcs,<br />
<li>extracts the current context from darcs, and <br />
<li>adds all this information to a source file<br />
</ul><br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em>Streams 0.1e</em>. Bulat Ziganshin<br />
[http://www.haskell.org/pipermail/haskell/2006-June/018063.html released]<br />
Streams library version 0.1e. Now cabalised and BSD-ified.<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em>Hitchhikers guide to Haskell - chapter 5</em>. Dmitry Astapov<br />
[http://www.haskell.org/pipermail/haskell-cafe/2006-June/015966.html announced] <br />
that chapter 5 of his online tutorial, the<br />
Hitchhikers guide to Haskell, is available. Changes include: It's<br />
bigger. It's better. It now comes with source code included. </p><br />
</li><br />
<br />
<li><br />
<p><br />
<em>Haskell Shell (HSH) 0.1.0</em>. John Goerzen<br />
[http://www.haskell.org/pipermail/haskell/2006-June/018059.html released]<br />
version 0.1.0 of HSH, the Haskell shell. Things are still very<br />
preliminary in many ways, but this version already lets you:<br />
<ul><br />
<li> Run commands<br />
<li> Pipe things between commands<br />
<li> Pipe command input/output into and out of pure Haskell functions<br />
<li> Pure Haskell functions are as much a first-class citizen as is grep or cat<br />
</ul><br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em>Edison 1.2</em>. Robert Dockins<br />
[http://www.haskell.org/pipermail/haskell/2006-June/018050.html released]<br />
the final, stable release of Edison 1.2. Edison is a <br />
library of efficient, purely-functional data structures for<br />
Haskell.<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em>Arrays & References Library 0.1</em>. Bulat Ziganshin<br />
[http://www.haskell.org/pipermail/haskell/2006-June/018044.html announced]<br />
version 0.1of his arrays and references library. Featuring:<br />
<ul><br />
<li>Unboxed references in IO and ST<br />
<li>Monad-independent interfaces to boxed and unboxed references<br />
<li>Syntax sugar to make using of mutable objects easier (=:, +=, -=,..)<br />
</ul>and more.<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em>Kamiariduki</em> Shelarcy<br />
[http://www.haskell.org/pipermail/haskell/2006-June/018043.html released]<br />
Kamiariduki - a system to judge your derivative work's purpose<br />
and license is valid with Ceative Commons License Works.<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em>lambdabot 4.0</em>. Don Stewart<br />
[http://www.haskell.org/pipermail/haskell/2006-June/018077.html announced]<br />
the release of version 4.0 of the venerable Haskell IRC bot, lambdabot.<br />
lambdabot is a stable, feature rich IRC bot based on a plugin<br />
framework. lambdabot 4.0 comes with a suite of more than 50 plugins,<br />
and many new features.<br />
</p><br />
</li><br />
</ul><br />
<br />
''2006-05-22''<br />
<br />
<ul><br />
<li><br />
<p><br />
<em>Hugs 2006</em>. Ross Paterson<br />
[http://archive.fo/rb5td announced]<br />
a new major release of Hugs, including an installer for Windows and a<br />
new WinHugs interface. It is available from <br />
[http://www.haskell.org/hugs/ the Hugs page]. <br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em>Linspire Chooses Haskell for Core OS Development</em>.<br />
Clifford Beshers<br />
[http://archive.fo/lxzxL announced]<br />
that the OS team at Linspire, Inc. is standardizing on Haskell as their<br />
preferred language for core OS development.<br />
Much of the infrastructure is being written in Haskell, including<br />
the Debian package builder (aka autobuilder). Other tools such as ISO<br />
builders, package dependency checkers are in progress. The goal is to<br />
make a tight, simple set of tools that will let developers contribute<br />
to Freespire, based on Debian tools whenever possible.<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em>lambdaFeed</em>. Manuel Chakravarty<br />
[http://archive.fo/CX5Fc released]<br />
lambdaFeed -- lambdas for all! lambdaFeed is an RSS 2.0 feed<br />
generator. It reads news items - in a non-XML, human-friendly<br />
format - distributed over multiple channels and renders them<br />
into the RSS 2.0 XML format understood by most news aggregators<br />
as well as into HTML for inclusion into web pages.<br />
Source is available in darcs. <br />
[http://www.cse.unsw.edu.au/~chak/haskell/lambdaFeed/ Check it out].<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em>Milfoh, an image to texture loading library</em>. Maurizio Monge<br />
[http://archive.fo/enqgx announced]<br />
he has put together a very small library, using SDL_image (and a<br />
bare minimun of SDL), to load image files as opengl textures.<br />
More information [http://linuz.sns.it/~monge/wiki/index.php/Milfoh here.]<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em>Haskell Charting Library</em>. Tim Docker<br />
[http://archive.fo/PMKRS released]<br />
his Haskell 2D charting library. It's still at quite an early stage, but already it has:<br />
<ul><br />
<li>Line charts, points charts, fills, and combinations.<br />
<li>Automatic layout sizing and adjustment.<br />
<li>Auto scaling of axis ranges<br />
<li>Extensible to support new plot types<br />
<li>Uses the cairo graphics library for output<br />
</ul> and more. [http://dockerz.net/software/chart.html Further information and a darcs repo.]<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em>Edison 1.2RC4</em>. Robert Dockins <br />
[http://archive.fo/xAxk0 announced]<br />
the 4th release candidate for Edison 1.2. Edison is a library of<br />
efficient data structures for Haskell.<br />
</p><br />
</li><br />
<br />
<li><br />
<p><em>Collections pre-release</em>. Jean-Philippe Bernardy<br />
[http://archive.fo/lOw81 announced]<br />
an alpha release of the new collections package he (and others) have<br />
been working on. It's still far from perfect, but I hope it's already a<br />
good choice for many use cases of collection data structures.<br />
</p><br />
</li><br />
<br />
<li><br />
<p><em>Haskell Graph Automorphism Library</em>. In a busy week,<br />
Jean-Philippe also <br />
[http://archive.fo/XdRKm released]<br />
HGAL 1.2 (Haskell Graph Automorphism Library), a Haskell implementation<br />
of Brendan McKay's algorithm for graph canonic labeling and<br />
automorphism group. (aka Nauty). Improvements over the previous release<br />
include a faster algorithm implementation and the library is now cabalised.<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em>Darcs 1.0.7</em>. Tommy Pettersson<br />
[http://archive.fo/PCvA9 announced]<br />
the release of darcs 1.0.7, containing a few bug fixes, and some new features.<br />
</p><br />
</li><br />
</ul><br />
<br />
''2006-05-08''<br />
<br />
<ul><br />
<li><br />
<p><br />
<em>hmake</em>. Malcolm Wallace <br />
[http://archive.fo/OJ5Rb released]<br />
version 3.11 of <br />
[http://archive.is/ZbN5k hmake], <br />
the compiler-independent project-building tool for Haskell<br />
programs. It automates recompilation analysis, based on import<br />
declarations in your files, to rebuild only those modules that<br />
are impacted by a change. It is rather like ghc's --make mode,<br />
but faster, less memory intensive, and it works with any<br />
compiler (e.g. hbc, nhc98).<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em>cpphs</em>. In a busy week, Malcolm also <br />
[http://archive.fo/p9qsw released]<br />
version 1.2 of<br />
[http://haskell.org/cpphs cpphs], the in-Haskell<br />
implementation of the C pre-processor. The major change in this<br />
release is that the source files have been re-arranged into a<br />
cabal-ised hierarchical library namespace, so you can use cpp<br />
functionality from within your own code, in addition to the<br />
stand-alone utility.<br />
</p><br />
</li><br />
<br />
<li><br />
<p><em>Cabal 1.1</em>. Duncan Coutts (as the new Cabal release manager)<br />
[http://archive.fo/dkLfQ announced]<br />
that Cabal-1.1.4, the version shipped with GHC 6.4.2 is now<br />
available to download as <br />
[http://haskell.org/cabal/download.html a separate tarball].<br />
There is also a <br />
[http://haskell.org/mailman/listinfo/cabal-devel new mailing list] <br />
for Cabal development discussion including patch review. This is<br />
also where patches sent via "darcs send" will end up.<br />
The Cabal team would also like to take the opportunity to invite<br />
people to get involved in Cabal development, either new features<br />
or squashing annoying bugs.<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em>DownNova-0.1</em>. Lemmih<br />
[http://archive.fo/1yK3R released] <br />
downNova, a program designed for automating the process of<br />
downloading TV series from mininova.org. Written in Haskell, it<br />
will scan your downloaded files to find out what your interests<br />
are and download missing/new episodes to your collection.<br />
Advanced classification techniques are used to interpret the<br />
file names and 'downNova' will correctly extract series name,<br />
season number, episode number and episode title in nigh all<br />
cases.<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em>Student SoC Application Deadline</em> is rapidly approaching. Paolo<br />
Martini encouraged students to apply to google, using the <br />
[http://archive.fo/J8eWq student application]<br />
form, and [http://hackage.haskell.org/trac/summer-of-code/ Haskell.org] <br />
is looking forward to the several dozen applications we hope to receive.<br />
</p><br />
</li><br />
<br />
</ul><br />
<br />
''2006-05-01''<br />
<br />
<ul><br />
<li><br />
<p><br />
<em>GHC 6.4.2</em>. Simon Marlow <br />
[http://archive.fo/n36q8 announced]<br />
the release of the Glasgow Haskell Compiler, version 6.4.2. <br />
GHC is a state-of-the-art programming suite for Haskell. Included<br />
is an optimising compiler generating good code for a variety of<br />
platforms, together with an interactive system for convenient, quick<br />
development. The distribution includes space and time profiling<br />
facilities, a large collection of libraries, and support for various<br />
language extensions, including concurrency, exceptions, and foreign<br />
language interfaces (C, whatever). GHC is distributed under a<br />
BSD-style open source license. For more information, see:<br />
<ul><br />
<li>[http://www.haskell.org/ghc/ GHC home]<br />
<li>[http://haskell.org/ghc/docs/6.4.2/html/users_guide/release-6-4-2.html Release notes]<br />
<li>[http://hackage.haskell.org/trac/ghc/ GHC developers' home]<br />
</ul><br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em>Communities and Activities Report</em>. Andres Loeh<br />
[http://archive.fo/ASLDO released]<br />
the call for contributions to the 10th (!) Haskell Communities and<br />
Activities Report. If you are working on any project that is in some<br />
way related to Haskell, write a short entry and submit it to Andres. <br />
</p><br />
<p><br />
The Haskell Communities and Activities Report is a bi-annual<br />
overview of the state of Haskell as well as Haskell-related projects<br />
over the last, and possibly the upcoming 6 months. If you have only<br />
recently been exposed to Haskell, it might be a good idea to browse the <br />
[http://haskell.org/communities/11-2005/html/report.html November 2005 edition] <br />
-- you will find interesting topics described as well as several<br />
starting points and links that may provide answers to many questions.<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em>Haskell' Status Report</em>. Isaac Jones<br />
[http://archive.fo/o6LrP released]<br />
a [http://prime.haskell.org/ Haskell'] status report. <br />
Currently the committee is focused on two issues, standardising<br />
[http://prime.haskell.org/wiki/Concurrency concurrency]<br />
and extensions to <br />
[http://prime.haskell.org/wiki/ClassSystem the class system].<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em>Google Summer of Code</em>. Paolo Martini<br />
[http://archive.fo/8IUk5 announced]<br />
that Haskell.org would have a presence as an official mentoring<br />
organisation for this year's Google Summer of Code. Several members<br />
of the Haskell community have volunteered as mentors, and a large<br />
number of proposals have been listed. If you're interested in<br />
mentoring, suggesting projects, or applying as a student to spend<br />
your summer writing Haskell code, check it out!<br />
<ul><br />
<li>[http://code.google.com/soc/ The official SoC site]<br />
<li>[http://hackage.haskell.org/trac/summer-of-code/ The Haskell.org SoC page]<br />
</ul><br />
</p><br />
</li><br />
<br />
</ul><br />
<br />
''2006-05-01''<br />
<ul><br />
<br />
<li><br />
<p><br />
<em>2006 GHC Hackathon</em>. Simon Marlow<br />
[http://archive.fo/BVqEv writes] <br />
that the GHC team is considering the possibility of organising a GHC<br />
Hackathon around ICFP this year. Tentative details are on <br />
[http://hackage.haskell.org/trac/ghc/wiki/Hackathon the wiki page].<br />
</p> </li><br />
<br />
<li><br />
<p><br />
<em>Data.ByteString</em>. Don Stewart <br />
[http://archive.fo/Ztq2t announced]<br />
new versions of <br />
[http://www.cse.unsw.edu.au/~dons/fps.html FPS/Data.ByteString], <br />
the fast, packed strings library for Haskell.<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em>Debian from Scratch</em>. John Goerzen <br />
[http://archive.fo/ch6e9 announced]<br />
Debian From Scratch (DFS), a single, full rescue linux CD capable of<br />
working with all major filesystems, LVM, software RAID, and even<br />
compiling a new kernel. The tool that generates the ISO images<br />
(dfsbuild) is written in Haskell. The generated ISO images also<br />
contain full, working GHC and Hugs environments.<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em>Hazakura - search-based MUA</em>. Jun Mukai<br />
[http://archive.fo/0v53a announced] <br />
the first release of hazakura, a search-based mail client, written<br />
in Haskell.<br />
<ul><br />
<li>[http://www.city5.org/hazakura/ Web]<br />
<li>[http://www.city5.org/haskellprog/hazakura/ Source]<br />
<li>[http://www.city5.org/haskellprog/hazakura/ Darcs]<br />
</ul><br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em>(HS)XML queries</em>. Oleg Kiselyov<br />
[http://archive.fo/NHqQu published]<br />
a note demonstrating <br />
[http://www.cwi.nl/~ralf/syb3/ Scrap your boilerplate 3]<br />
style generic term processing for transformations and selections<br />
from (HS)XML-like documents. <br />
</p><br />
</li><br />
</ul><br />
<br />
''2006-04-17''<br />
<ul><br />
<li><br />
<p><br />
<em>Halfs, a Haskell filesystem</em>. Isaac Jones <br />
[http://archive.fo/m1rqr announced] <br />
the first release of Halfs, a filesystem written<br />
in Haskell. Halfs can be mounted and used like any other Linux filesystem,<br />
or used as a library. Halfs is a fork (and a port) of the filesystem<br />
developed by Galois Connections. In addition, Halfs comes with a virtual<br />
machine to make using it extremely easy. You don't need an extra partition<br />
or a thumb drive, or even Linux (Windows and Mac OS can emulate the virtual<br />
machine). See more at <br />
[http://www.haskell.org/halfs/ the Halfs site].<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em>DrIFT-2.2.0</em>. John Meacham <br />
[http://archive.fo/LB6O6 released] <br />
DrIFT-2.2.0, the type sensitive preprocessor for Haskell. It<br />
extracts type declarations and directives from modules. The<br />
directives cause rules to be fired on the parsed type declarations,<br />
generating new code which is then appended to the bottom of the<br />
input file. Read more <br />
[http://repetae.net/john/computer/haskell/DrIFT/ here].<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em>MissingH 0.14.2</em>. John Goerzen<br />
[http://archive.fo/YqL1M announced] <br />
version 0.14.2 of MissingH, the library of "missing" Haskell code. Now including support for <br />
shell globs, POSIX-style wildcards and more. Check <br />
[http://quux.org/devel/missingh here] for more details.<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em>HAppS - Haskell Application Server 0.8</em> Einar Karttunen <br />
[http://archive.fo/zP6C7 announced] <br />
HAppS 0.8. The Haskell Application Server version 0.8 contains a complete<br />
rewrite of the ACID and HTTP functionalities. Features include:<ul><br />
<li>MACID - Monadic framework for ACID transactions.<br />
<li>An HTTP Server (outperforms Apache/PHP in informal benchmarks).<br />
<li>An SMTP Server.<br />
<li>Mail delivery agent.<br />
<li>DNS resolver in pure Haskell<br />
<li>XML and XSLT. Separate application logic from presentation using XML/XSLT.<br />
<li>And more..<br />
</ul><br />
More information on the [http://happs.org/ the HAppS page].<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em>Index-aware linear algebra</em>. Frederik Eaton <br />
[http://archive.fo/bfres announced] <br />
an index-aware linear algebra library written in Haskell.<br />
The library exposes index types and ranges so that static guarantees can be<br />
made about the library operations (e.g. an attempt to add two incompatibly<br />
sized matrices is a static error). Frederik's motivation is that a good<br />
linear algebra library which embeds knowledge of the mathematical<br />
structures in the type system, such that misuse is a static error, could<br />
mean Haskell makes valuable contribution in the area of technical<br />
computing, currently dominated by interpreted, weakly typed languages.<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em>Crypto-3.0.3</em>. Dominic Steinitz<br />
[http://archive.fo/MELPN announced]<br />
Crypto-3.0.3, a new version of the Haskell Cryptography Library. Version<br />
3.0.3 supports: DES, Blowfish, AES, Cipher Block Chaining (CBC), PKCS#5 and<br />
nulls padding, SHA-1, MD5 , RSA, OAEP-based encryption<br />
(Bellare-Rogaway), PKCS#1v1.5 signature scheme, ASN.1, PKCS#8, X.509<br />
Identity Certificates, X.509 Attribute Certificates.<br />
See <br />
[http://www.haskell.org/crypto here] for more.<br />
</p><br />
</li><br />
</ul><br />
<br />
''2006-04-10''<br />
<br />
<ul><br />
<li><br />
<p><br />
<em>hImerge: a graphical user interface for emerge</em>. Luis Araujo<br />
released <br />
[http://haskell.org/~luisfaraujo/himerge/ hImerge], <br />
a graphical user interface for emerge, (Gentoo's Portage system)<br />
written in Haskell using gtk2hs. <br />
[http://haskell.org/~luisfaraujo/rhimerge.jpeg Here's a jpg]. <br />
The main idea is to simplify browsing the entire portage tree as well as of<br />
running the most basic and common options from the emerge command. hImerge<br />
also offers several handy tools, like global and local use flags browsers,<br />
and a minimal web browser.<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em>MissingH 0.14.0</em>. John Goerzen <br />
[http://archive.fo/acMdL announced]<br />
MissingH 0.14.0, a library of "missing" functions.<br />
MissingH is available <br />
[http://quux.org/devel/missingh/ here].<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em>Haskell mailing list archives</em>. Don Stewart <br />
[http://archive.fo/yNrCq converted] <br />
the Haskell mailing list archives from 1990-2000, into html format.<br />
The archive is available to view <br />
[http://www.cse.unsw.edu.au/~dons/haskell-1990-2000/threads.html here].<br />
</li><br />
</p><br />
<br />
<li><br />
<p><br />
<em>Chapter 4 of Hitchhikers Guide to the Haskell</em>. Dmitry Astapov<br />
[http://archive.fo/xjzJK announced]<br />
that the 4th chapter of the Hitchhikers Guide to Haskell is now<br />
[http://www.haskell.org/haskellwiki/Hitchhikers_Guide_to_the_Haskell available].<br />
</p><br />
</li><br />
<br />
<li><br />
<p><br />
<em>Edison 1.2 rc3</em>. Robert Dockins<br />
[http://archive.fo/WbcJF announced]<br />
that the 3rd release candidate for Edison 1.2 is now avaliable.<br />
</p><br />
</li><br />
</ul><br />
<br />
''2006-03-27''<br />
<ul><br />
<li><br />
<p><em>monadLib 2.0</em>. Iavor Diatchki <br />
[http://archive.fo/lYMpK announced]<br />
the release of monadLib 2.0 -- library of<br />
monad transformers for Haskell. 'monadLib' is a descendent of<br />
'mtl', the monad template library that is distributed with most<br />
Haskell implementations. Check out the<br />
[http://www.csee.ogi.edu/~diatchki/monadLib library] web page.<br />
</p><br />
</li><br />
<br />
<li><br />
<p><em>Text.Regex.Lazy (0.33)</em>. Chris Kuklewicz <br />
[http://archive.fo/KpcxG announced]<br />
the release of [http://sourceforge.net/projects/lazy-regex Text.Regex.Lazy].<br />
This is an alternative to Text.Regex along with some enhancements.<br />
GHC's Text.Regex marshals the data back and forth to C arrays, to call<br />
libc. This is far too slow (and strict). This module understands<br />
regular expression Strings via a Parsec parser and creates an internal data<br />
structure (Text.Regex.Lazy.Pattern). This is then transformed into a<br />
Parsec parser to process the input String, or into a DFA table for matching<br />
against the input String or FastPackedString. The input string is<br />
consumed lazily, so it may be an arbitrarily long or infinite source.<br />
</p><br />
</li><br />
<br />
<li><br />
<p><em>HDBC 0.99.2</em>. John Goerzen <br />
[http://archive.fo/Xn605 released]<br />
HDBC 0.99.2, along with 0.99.2 versions of all database<br />
backends. John says "If things go well, after a few weeks of<br />
testing, this version will become HDBC 1.0.0". <br />
[http://quux.org/devel/hdbc HDBC] is a<br />
multi-database interface system for Haskell.<br />
</p><br />
</li><br />
<br />
<li><br />
<p><em>GHC 6.4.2 Release Candidates</em><br />
Simon Marlow <br />
[http://archive.fo/IjSwi announced] <br />
that GHC was moving into release-candidate mode for<br />
version 6.4.2. [http://www.haskell.org/ghc/dist/stable/dist/ Grab a snapshot] <br />
and try it out. The available builds are: x86_64-unknown-linux (Fedora<br />
Core 5), i386-unknown-linux (glibc 2.3 era), and Windows<br />
(i386-unknown-mingw32). Barring any serious hiccups, the release should<br />
be out in a couple of weeks.<br />
</p><br />
</li><br />
<br />
<li><br />
<p><em>HaRe 0.3</em>.<br />
Sneaking out without us noticing, in January, a <br />
[http://www.cs.kent.ac.uk/projects/refactor-fp/hare.html new snapshot] <br />
of HaRe, the Haskell refactoring tool, was released.<br />
This snapshot of HaRe 0.3 is now compatible with the latest GHC and<br />
Programmatica. New refactorings have also been added. <br />
</p><br />
</li><br />
<br />
<li><br />
<p><em>Haskell on Gentoo Linux</em> Duncan Coutts <br />
[http://archive.fo/6UxUX writes] <br />
that GHC 6.4.1 has been marked stable on x86,<br />
amd64, sparc and ppc, for <br />
[http://packages.gentoo.org/search/?sstring=ghc Gentoo Linux]. <br />
(We also support ppc64, alpha and hppa.)<br />
Gentoo also has a collection of over 30 Haskell libraries and tools.<br />
There is also a #gentoo-haskell <br />
[http://haskell.org/haskellwiki/IRC_channelirc channel] on freenode.<br />
</p><br />
</li><br />
<br />
<li><br />
<p><em>Planet Haskell</em>. Isaac Jones<br />
[http://archive.fo/VUe8p asked] <br />
if someone could volunteer to set up "Planet<br />
Haskell", an RSS feed aggregator in the style of Planet Debian, Planet<br />
Gnome or Planet Perl. Happily, Antti-Juhani Kaijanaho stepped up, and now <br />
Planet Haskell is live at [http://planet.haskell.org http://planet.haskell.org]. <br />
Antti-Juhani asks that any Haskell<br />
people with blogs submit their feed urls to him, so check it out!<br />
</p><br />
</li><br />
<br />
<li><br />
<p><em>Concurrent Yhc</em>. The Yhc dev team<br />
[http://www.haskell.org//pipermail/yhc/2006-March/000085.html reports]<br />
that Yhc now includes support for concurrency!<br />
The interface is the same as Concurrent GHC. Currently only<br />
</p><br />
<br />
<ul><br />
<li>Control.Concurrent<br />
<li>Control.Concurrent.MVar<br />
<li>Control.Concurrent.QSem<br />
</ul> <br />
<br />
<p><br />
are implemented, however many other abstractions can be written in<br />
Haskell in terms of MVars.<br />
</p><br />
</li><br />
</ul><br />
<br />
''2006-03-20'' <br />
<br />
<ul><br />
<li><br />
<p><em>lhs2TeX version 1.11</em>. Andres Loeh<br />
[http://archive.fo/KzrOp announced]<br />
lhs2TeX version 1.11, a preprocessor to generate LaTeX code from<br />
literate Haskell sources.<br />
</p><br />
<br />
<p><br />
lhs2TeX includes the following features:<br />
<ul><br />
<li>Highly customized output.<br />
<li>Liberal parser -- no restriction to Haskell 98.<br />
<li>Generate multiple versions of a program or document from a single source.<br />
<li>Active documents: call Haskell to generate parts of the<br />
document (useful for papers on Haskell).<br />
<li>A manual explaining all the important aspects of lhs2TeX.<br />
</ul><br />
</p><br />
</li><br />
</ul><br />
<br />
''2006-03-13''<br />
<br />
<ul><br />
<li><br />
<em>Alternative to Text.Regex</em>. Chris Kuklewicz [http://archive.fo/kuUw4 announced] an alternative to Text.Regex. While working on the [http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=all language shootout], Chris implemented a new efficient regex engine, using parsec. It contructs a parser from a string representation of a regular expression.<br />
</li><br />
<br />
<li><br />
<em>pass.net</em>. S. Alexander Jacobson [http://archive.fo/I5zVJ launched] Pass.net. Written in Haskell, using HAppS, Pass.net lets websites replace registration, confirmation mails, and multiple passwords with a single login, authenticating via their email domain.<br />
</li><br />
</ul><br />
<br />
''2006-03-06''<br />
<br />
<ul><br />
<li><br />
<em>Haskell as a markup language</em>. Oleg Kiselyov [http://www.haskell.org/pipermail/haskell/2006-March/017656.html writes] on using Haskell to represent semi-structured documents and the rules of their processing. [http://ssax.sourceforge.net SXML] is embedded directly in Haskell, with an open and extensible set of `tags'. The benefit of this is of course in static type guarantees, such as prohibiting an H1 element to appear in the character content of other elements.<br />
</li><br />
<br />
<li><br />
<em>hmp3 1.0</em>. Don Stewart [http://www.haskell.org/pipermail/haskell/2006-March/017674.html released] hmp3 version 1. hmp3 is a curses-based mp3 player written in Haskell, designed to be fast, small and stable.<br />
</li><br />
<br />
<li><br />
<em>Edison 1.2rc2</em>. Robert Dockins [http://www.haskell.org/pipermail/libraries/2006-March/004983.html announced] the second release candidate for Edison 1.2 is now ready for comments.<br />
</li><br />
</ul><br />
<br />
''2006-02-27''<br />
<br />
<ul><br />
<li><br />
<em>Long Live Edison</em>. Robert Dockins [http://archive.fo/897c4 announced] he had revived the Edison data structure code, and is maintaining a darcs repository, with a view to modernising the codebase.<br />
</li><br />
</ul><br />
<br />
<br />
''2006-02-20''<br />
<br />
<ul><br />
<li> <em>The Haskell Workshop</em>. Andres Loeh <br />
[http://archive.fo/xKMBJ released]<br />
the initial call for papers for the ACM SIGPLAN 2006<br />
[http://www.haskell.org/haskell-workshop/2006/ Haskell Workshop], to be held at Portland, Oregon on the 17 September, 2006. <br />
The purpose of the [http://haskell.org/haskell-workshop/ Haskell Workshop]<br />
is to discuss experience with Haskell, and possible<br />
future developments for the language. The scope of the workshop includes<br />
all aspects of the design, semantics, theory, application, implementation,<br />
and teaching of Haskell.<br />
</li><br />
<br />
<li><em>Probability Distributions</em>.<br />
Matthias Fischmann [http://archive.fo/wgUI3 released]<br />
a module for sampling arbitrary probability distribution, so far including<br />
normal (gaussian) and uniform distributions.<br />
</li><br />
<br />
<li><em>Constructor Classes</em>. Sean Seefried <br />
[http://archive.fo/7Gfko announced] an <br />
[http://www.cse.unsw.edu.au/~sseefried/code.html implementation] of <br />
a tool to help explore constructor classes (type<br />
classes which can take constructors as arguments) described in Mark Jones'<br />
paper, [http://www.cse.ogi.edu/~mpj/pubs/fpca93.html A system of constructor classes: overloading and implicit higher-order polymorphism.] The implementation not only infers the type<br />
but also prints out a trace of the derivation tree for the syntax directed<br />
rules.<br />
</ul><br />
<br />
''2006-02-13''<br />
<br />
<ul><br />
<li><em>FFI Imports Packaging Utility</em>. Dimitry Golubovsky<br />
[http://archive.fo/Wlr0o announced] <br />
the pre-release of the FFI Imports Packaging Utility<br />
(ffipkg), a new member of the HSFFIG package.<br />
<br />
The `ffipkg' utility prepares a Haskell package containing FFI imports<br />
for building by accepting locations of C header and foreign library<br />
files as command line arguments and producing Haskell source files<br />
with FFI declarations, a Makefile, a Cabal package descriptor file,<br />
and a Setup.hs file suitable for running the Cabal package setup<br />
program. The utility acts as a "driver" running the C preprocessor,<br />
the equivalent of the hsffig program, and the source splitter.<br />
<br />
<code>darcs get --partial http://hsffig.sourceforge.net/repos/hsffig-1.1<br />
</code><br />
</li><br />
<br />
<li><em>Haskell in Higher Education</em>.<br />
John Hughes <br />
[http://archive.fo/kV7o3 announced] <br />
that the result of his survey into the use of<br />
Haskell in higher education are out. The survey covers 89<br />
universities, accounting for 5-10,000 students being taught<br />
Haskell this academic year. The results are<br />
[http://www.cs.chalmers.se/~rjmh/Wash/Survey/teaching.htm available on the web].<br />
</li><br />
<br />
</ul><br />
<br />
''2006-02-06''<br />
<br />
<ul><br />
<li><br />
<em>EclipseFP</em>. Thiago Arrais <br />
[http://archive.fo/jsfwn announced] <br />
that EclipseFP 0.9.1 has been released since last<br />
Friday. It is an open-source development environment for Haskell code.<br />
EclipseFP integrates GHC with an Haskell-aware code editor and also<br />
supports quick file browsing through an outline view, automatic<br />
building/compiling and quick one-button code execution. Downloads and<br />
more information are available on the <br />
[http://eclipsefp.sourceforge.net project home page].<br />
</li><br />
<br />
<li><br />
<em>Class-parameterized classes, and type-level logarithm</em>. Oleg<br />
Kiselyov [http://archive.fo/JwMNI writes]: we show invertible, terminating, 3-place addition, multiplication,<br />
exponentiation relations on type-level Peano numerals, where <i>any</i><br />
two operands determine the third. We also show the invertible factorial<br />
relation. This gives us all common arithmetic operations on Peano numerals,<br />
including n-base discrete logarithm, n-th root, and the inverse of factorial.<br />
The inverting method can work with any representation of (type-level) numerals,<br />
binary or decimal.<br />
<br />
Oleg says, "The implementation of RSA on the type level is left for future work".<br />
</li><br />
<br />
<li><br />
<em>Fast mutable variables for IO and ST</em>. Bulat Ziganshin <br />
[http://archive.fo/URz7I released] a module for fast mutable variables, providing efficient<br />
newVar/readVar/writeVar, as well as support for unboxed values, fast<br />
unboxed bitwise operations, and more.<br />
</li><br />
</ul><br />
<br />
''2006-01-30''<br />
<br />
<ul><br />
<li><em>C-- Frontend</em>. Robert Dockins <br />
[http://archive.fo/wH7A2 announced] <br />
the initial alpha release of a [http://www.cminusminus.org/ C--]<br />
frontend (parser, pretty printer, and semantic checker) written in<br />
Haskell. The goal when beginning this project was to create a<br />
modular frontend that could be used both by people writing and by<br />
those targeting C-- compilers. This implementation attempts to<br />
follow the C-- spec as exactly as possible.<br />
</li><br />
<br />
<li><em>Type level arithmetic</em>. Robert Dockins <br />
[http://archive.fo/77scn also released] a library for arithmetic on the type<br />
level. This library uses a binary representation and can handle<br />
numbers at the order of 10^15 (at least). It also contains a<br />
test suite to help validate the somewhat unintuitive algorithms.<br />
</li><br />
</ul><br />
<br />
''2006-01-23''<br />
<br />
<ul><br />
<li><br />
<em>Haskell'</em> <br />
<br />
This week Isaac Jones announced that the Haskell' standardisation<br />
process is underway. Haskell' will be a conservative refinement of<br />
Haskell 98:<br />
<br />
<blockquote><br />
Announcing the Haskell' ("Haskell-Prime") process. A short time ago,<br />
I asked for volunteers to help with the next Haskell standard. A<br />
brave group has spoken up, and we've organized ourselves into a<br />
committee in order to coordinate the community's work. It will be the<br />
committee's task to bring together the very best ideas and work of the<br />
broader community in an "open-source" way, and to fill in any gaps in<br />
order to make Haskell' as coherent and elegant as Haskell 98.<br />
</blockquote><br />
<br />
Read the full announcement [http://archive.fo/ViMZH here].<br />
<br />
Presently, the following resources are available:<br />
<ul><br />
<br />
<li> [http://haskell.org/mailman/listinfo/haskell-prime The haskell-prime mailing list]<br />
</li><br />
<br />
<li> The Haskell' [http://prime.haskell.org/ issue tracking system/wiki]<br />
<br />
<li> A [http://prime.haskell.org/wiki/SourceCode darcs repository] <br />
for larger code examples and experiments <br />
</ul><br />
<br />
Please join us in making Haskell' a success.<br />
</li><br />
</ul><br />
<br />
''2006-01-16''<br />
<br />
<ul><br />
<li><br />
<em>hdbc-odbc.</em> John Goerzen <br />
[http://archive.fo/It7M1 released]<br />
the first version of hdbc-odbc, the ODBC backend for HDBC. With this<br />
driver, you can use HDBC to connect to any database for which ODBC<br />
drivers exist, including such databases as MySQL, Oracle, MS SQL Server<br />
</li><br />
</ul><br />
<br />
''2006-01-09''<br />
<br />
<ul><br />
<li><br />
<em>A Faster Binary.</em> Bulat Ziganshin <br />
[http://archive.fo/6DAjH posted]<br />
a preliminary optimised Binary library, achieving excellent<br />
(de)serialization speeds of around 50 Mb/s in testing.<br />
</li><br />
</ul><br />
<br />
''2006-01-03''<br />
<br />
<ul><br />
<li><em>Process library.</em> Bulat Ziganshin announced a <br />
[http://archive.fo/SaNXC new library] abstracting over some of the process and concurrency<br />
functions in the standard libraries, using ideas from Unix<br />
pipes.</li><br />
<br />
<li><em>Djinn.</em> Lennart Augustsson <br />
[http://archive.fo/4Ztai released Djinn], <br />
a theorem prover/coding wizard, that generates<br />
Haskell code from a given type. A lambdabot plugin for Djinn was<br />
also written, for use in #haskell.<br />
</li><br />
<br />
<li><em>Ranged Sets.</em> Paul Johnson released a <br />
[http://archive.fo/tz8yX ranged sets library 0.0.1] <br />
and <br />
[http://archive.fo/HrsMk 0.0.2].<br />
Ranged sets allow programming with sets of values that are<br />
described by a list of ranges. A value is a<br />
member of the set if it lies within one of the ranges.<br />
</li><br />
<br />
<li><em>Hmp3.</em> Don Stewart <br />
[http://archive.fo/hN8mY announced]<br />
a stable release of hmp3, an curses-based mp3 player written in<br />
Haskell. Portability has improved, and binaries are available<br />
for 5 architectures.<br />
</li><br />
<br />
<li><em>HSQL.</em> Krasimir Angelov released <br />
[http://archive.fo/GoNLD HSQL 1.7]. New features include a driver for Oracle.<br />
</li><br />
<br />
<li><em>HDBC.</em> John Goerzen announced the <br />
[http://archive.fo/TdsYj 0.5.0], <br />
[http://archive.fo/iQNnF 0.6.0]<br />
and [http://archive.fo/vFsAl 0.99.0]<br />
releases of Haskell Database Connectivity library. Patterned<br />
after Perl's DBI, it includes an Sqlite3 and a<br />
[http://archive.fo/Uf7Y0 PostgreSQL backend]<br />
</li><br />
<br />
<li><em>Shellac.</em> Robert Dockins <br />
[http://archive.fo/uCNzE released]<br />
Shellac, a framework for building read-eval-print style shells.<br />
This should ease the burden of binding readline-style<br />
interactive shells in Haskell.<br />
</li><br />
<br />
<li><em>Lambda Shell.</em> Robert Dockins also released v0.1 of <br />
[http://archive.fo/518aZ Lambda Shell], a shell environment for evaluating terms of the pure,<br />
untyped lambda calculus. A lambdabot interface for use in #haskell<br />
also exists.<br />
</li><br />
<br />
<li><em>Shaskell.</em> David Mercer <br />
[http://archive.fo/64NbG announced version 0.21a] of Shaskell, a SHA2 library for sha256 and<br />
sha512 hashes, written in pure Haskell.<br />
</li><br />
<br />
<li><em>hdbc-missingh.</em> John Goerzen <br />
[http://archive.fo/jTsom announced]<br />
the initial release of HDBC-MissingH, a library to add database<br />
features to MissingH, allowing the use of a SQL database as<br />
storage for a simple DBM-like key/value interface.<br />
</li><br />
</ul><br />
[[Category:News|2006]]</div>Ysangkokhttps://wiki.haskell.org/index.php?title=Common_Misunderstandings&diff=62985Common Misunderstandings2019-08-04T15:16:59Z<p>Ysangkok: fix gmane link using archive.is</p>
<hr />
<div>[[Category:FAQ]]<br />
<br />
= Common Mistakes and Incorrect Beliefs By Haskell Beginners=<br />
People going from zero to Haskell are likely to gain a misunderstanding or miss a point that isn't stressed enough. Here are some mistakes that have been observed from multiple sources.<br />
<br />
== Indentation ==<br />
Perhaps the first trip-up - you might understand that indentation defines where a code block starts and the lack of an equal amount of indentation indicates the previous code block ended. What some miss is that <hask>then</hask> and <hask>else</hask>, if used within a section of code where indentation matters, must be indented deeper than the <hask>if</hask> statement. That is, the position of the "else" in the following is a syntax error:<br />
<br />
<haskell><br />
do if boolean then<br />
expr1<br />
else<br />
expr2<br />
</Haskell><br />
<br />
The following is correct:<br />
<br />
<haskell><br />
do if boolean<br />
then expr1<br />
else expr2<br />
</haskell><br />
<br />
Or they can be on the same line as the if:<br />
<br />
<haskell><br />
if boolean then expr1 else expr2<br />
</haskell><br />
<br />
Fortunately this misfeature is fixed in [[Haskell 2010]], and the first snippet is valid in compilers that support it (e.g. GHC 7.0.1 and later).<br />
<br />
== If / Then / Else ==<br />
if-then statements must always include an 'else' portion. It might be best not to think of if-then-else as flow control, as in most imperative languages, but think of it as construction of a value using a well formed expression.<br />
<br />
<code><br />
x = b ? y : z;<br />
</code><br />
<br />
The above is valid C code, a [http://en.wikipedia.org/wiki/Ternary_operation ternary operation], that's used quite commonly as a shortcut to typing out a full if-then-else block. It states that if <code>b</code> is true then <code>x = y</code> otherwise <code>x = z</code>. Notice how this makes no sense without <code>z</code>. Similarly, in Haskell an <hask>if</hask>/<hask>then</hask> makes no sense without an <hask>else</hask>.<br />
<br />
<haskell><br />
let x = if b then y -- compare to x = b ? y<br />
</haskell><br />
<br />
What is <code>x</code> when <code>b</code> is false? One should also recognize that the types returned by the <hask>then</hask> and <hask>else</hask> branches must match due to Haskell's strong and static type system.<br />
<br />
When <hask>if</hask> is used for sequencing IO it is not uncommon to see an <hask>else</hask> that returns a null value:<br />
<br />
<haskell><br />
main = do<br />
startNetwork <- askUser "Network? "<br />
if startNetwork<br />
then do iface <- initNetworkInterface<br />
handlePackets iface<br />
else return ()<br />
</haskell><br />
<br />
Such uses can be more succinct if they use the <hask>when</hask> function (from the Control.Monad module):<br />
<br />
<haskell><br />
main = do<br />
startNetwork <- askUser "Network? "<br />
when startNetwork $ do<br />
iface <- initNetworkInterface<br />
handlePackets iface<br />
</haskell><br />
<br />
== Binding of Type Signatures ==<br />
Due to the typeclass overloading of numbers, lists of numbers are often typed as:<br />
<br />
<haskell><br />
ghci> [1,2,3,4] :: [Float]<br />
</haskell><br />
<br />
This works fine when the list stands alone, but when applying a function take note the function application binds stronger than the type signature. This means the below signature is invalid:<br />
<br />
<haskell><br />
ghci> map floor [1,2,3,4] :: [Float]<br />
</haskell><br />
<br />
and should instead be:<br />
<haskell><br />
ghci> map floor ([1,2,3,4] :: [Float])<br />
</haskell><br />
<br />
or alternatively put the type signature on one of the elements:<br />
<br />
<haskell><br />
ghci> map floor [1,2,3,4::Float]<br />
</haskell><br />
<br />
== '''do''' Notation ==<br />
If the [[do notation]] page ever exists I'll advise you to check it out. Until then, understand that a missing <hask>do</hask> from the top of a function or code block can result in your compiler giving an error message citing a much later line number. Also, any new blocks (ex: from an <hask>if</hask> or <hask>case</hask>) must have their own <hask>do</hask>, even if the higher level code block already had one.<br />
<br />
Sorry this isn't the full picture - for an inverse point of view see [[do notation considered harmful]].<br />
<br />
== Iterating Over a List ==<br />
Some beginners confuse a single-element list pattern (such as <hask>[x]</hask>) with a pattern that iterates over every element in the list.<br />
<br />
One example that recently (in April, 2008) appeared on the Haskell-Cafe mailing list (see the reply post [http://www.haskell.org/pipermail/haskell-cafe/2008-April/041701.html Re: Embedding newlines into a string?]) was the following. Here, one coder attempted to write a function <hask>hanoi</hask> to solve the Towers of Hanoi problem, but to code it so that each tower could be named polymorphically, using, for example, either Chars or Ints. The problematic code segment was the following:<br />
<br />
<haskell><br />
hanoi_shower :: Show a => [(a, a)] -> String<br />
hanoi_shower [(a, b)] = "Move " ++ show a ++ " to " ++ show b ++ "."<br />
</haskell><br />
<br />
in the following program:<br />
<br />
<haskell><br />
hanoi :: a -> a -> a -> Int -> [(a, a)]<br />
hanoi source using dest n<br />
| n == 1 = [(source, dest)]<br />
| otherwise = hanoi source dest using (n-1)<br />
++ hanoi source using dest 1<br />
++ hanoi using source dest (n-1)<br />
<br />
hanoi_shower :: Show a => [(a, a)] -> String<br />
hanoi_shower [(a, b)] = "Move " ++ show a ++ " to " ++ show b ++ "."<br />
</haskell><br />
<br />
The coder tried to run the code in WinHugs as follows:<br />
<br />
<haskell><br />
Main> putStr (hanoi_shower (hanoi 'a' 'b' 'c' 2))<br />
</haskell><br />
<br />
However, this was the result:<br />
<br />
<haskell><br />
Program error: pattern match failure: hanoi_shower<br />
[('a','b'),('a','c')] ++ ([] ++ hanoi 'b' 'a' 'c' (2 - 1))<br />
</haskell><br />
<br />
The problem was that the parameter <hask>[(a, b)]</hask> to <hask>hanoi_shower</hask> only matched the first element of the list, but didn't iterate over the list as intended.<br />
<br />
Here is a corrected version of the code above:<br />
<br />
<haskell><br />
hanoi_shower :: Show a => [(a, a)] -> String<br />
hanoi_shower moves = unlines ["Move " ++ show a ++ " to "++ show b ++ "." | (a, b) <- moves]<br />
</haskell><br />
<br />
Here, <hask>moves</hask> is pattern-matched to type <hask>[(a, a)]</hask> (a list of pairs). The problem is how to iterate over the elements (pairs) of the list while separating the first <hask>a</hask> of each pair from the second <hask>a</hask>.<br />
<br />
The solution above uses list comprehension: The generator <hask>(a, b) <- moves</hask> feeds each pair in turn to the left-hand expression <hask>(a, b)</hask>, and this pair is mapped to the left expression, <hask>"Move " ++ show a ++ " to "++ show b ++ "."</hask>, building a new list of sentences representing moves. Then, the function <hask>unlines</hask> breaks this list into a sequence of lines.<br />
<br />
Here is the result of executing the above code in WinHugs:<br />
<br />
<haskell><br />
Main> putStr (hanoi_shower (hanoi 'a' 'b' 'c' 2))<br />
Move 'a' to 'b'.<br />
Move 'a' to 'c'.<br />
Move 'b' to 'c'.<br />
<br />
Main> putStr (hanoi_shower (hanoi 1 2 3 2))<br />
Move 1 to 2.<br />
Move 1 to 3.<br />
Move 2 to 3.<br />
</haskell><br />
<br />
Notice that since <hask>a</hask> and <hask>b</hask> in <hask>(a, b)</hask> are polymorphic types, they can range over both <hask>Chars</hask> and <hask>Ints</hask>.<br />
<br />
Another way of writing <hask>hanoi_shower</hask>, using <hask>map</hask>, is as follows:<br />
<br />
<haskell><br />
hanoi_shower :: Show a => [(a, a)] -> String<br />
hanoi_shower moves = unlines (map move moves)<br />
where move (a, b) = "Move " ++ show a ++ " to "++ show b ++ "."<br />
</haskell><br />
<br />
Here, <hask>move</hask> is mapped over <hask>moves</hask>, and each pair <hask>(a, b)</hask> of <hask>moves</hask> is pattern-matched against <hask>"Move " ++ show a ++ " to "++ show b ++ "."</hask><br />
<br />
Another way to map over a list is to use recursion, although this method is considered non-idiomatic Haskell (Haskellers generally prefer using higher-order functions over recursion when possible):<br />
<br />
<haskell><br />
hanoi :: a -> a -> a -> Int -> [(a, a)]<br />
hanoi source using dest n<br />
| n == 0 = []<br />
| n == 1 = [(source, dest)]<br />
| otherwise = hanoi source dest using (n-1) <br />
++ hanoi source using dest 1<br />
++ hanoi using source dest (n-1)<br />
<br />
hanoi_shower :: Show a => [(a, a)] -> String<br />
hanoi_shower [] = ""<br />
hanoi_shower ((a, b):moves) = unlines ["Move " ++ show a ++ " to "++ show b ++ "."] ++ hanoi_shower moves<br />
</haskell><br />
<br />
Here, in <hask>hanoi_shower</hask>, the base case is simply an empty list <hask>[]</hask>. At each recursive step, a list of type <hask>[(a, a)]</hask> (a list of pairs) is mapped against the parameter <hask>(a, b):moves</hask> of <hask>hanoi_shower</hask>. This separates the head of the list <hask>(a, b)</hask> from the tail of the list <hask>moves</hask>, which then is further matched against <hask>((a, b):moves)</hask> on the next recursive call.<br />
<br />
There are other ways of iterating over lists as well. One advantage of Haskell is that there are often many ways of performing the same action, including iterating over lists.<br />
<br />
== Guards ==<br />
(The following two tips on guards were contributed by the user 7stud in the thread "Top beginner mistakes" (see https://web.archive.org/web/20180127010825/http://article.gmane.org:80/gmane.comp.lang.haskell.beginners/1121) on the Haskell-Beginners mailing list on Wed, 4 Mar 2009 21:54:05 +0000 (UTC).)<br />
<br />
Some beginners make the mistake of putting an equals sign after a function name when using guards; ''viz.'':<br />
<br />
<haskell><br />
myfunction x y =<br />
| x < 2 = "a"<br />
| y > 20 = "b"<br />
| otherwise = "c"<br />
</haskell><br />
<br />
This causes a cryptic error message similar to the following to be displayed:<br />
<br />
<hask><br />
dhask.hs:2:4: parse error on input `|'<br />
Failed, modules loaded: none.<br />
</hask><br />
<br />
Another common mistake that some beginners make is writing "if" in front of the guard conditions; ''viz.'':<br />
<br />
<haskell><br />
myfunction x y<br />
| if x < 2 = "a"<br />
| if y > 20 = "b"<br />
| otherwise = "c"<br />
</haskell><br />
<br />
This causes a mysterious error message similar to the following to be shown:<br />
<br />
<hask><br />
dhask.hs:2:25: parse error on input `='<br />
Failed, modules loaded: none.<br />
</hask><br />
<br />
In both cases, the error messages don't help to identify the problem.<br />
<br />
(Entry added by [[User:DekuDekuplex|Benjamin L. Russell]].)<br />
<br />
== Parentheses ==<br />
(The following tip on parentheses was contributed by the user 7stud in the thread "Top beginner mistakes" (see https://web.archive.org/web/20180127010825/http://article.gmane.org:80/gmane.comp.lang.haskell.beginners/1121) on the Haskell-Beginners mailing list on Wed, 4 Mar 2009 21:54:05 +0000 (UTC).)<br />
<br />
Some beginners make the mistake of not putting parentheses around arguments of the form x:xs; ''viz.'':<br />
<br />
<haskell><br />
dosomething x:xs = head xs<br />
</haskell><br />
<br />
This causes an ambiguous error message similar to the following to be shown:<br />
<br />
<hask><br />
dhask.hs:1:0: Parse error in pattern<br />
Failed, modules loaded: none.<br />
</hask><br />
<br />
Here, the error message doesn't help to recognize the problem.<br />
<br />
(Entry added by [[User:DekuDekuplex|Benjamin L. Russell]].)<br />
<br />
<br />
= See also =<br />
<br />
* [[What a Monad is not]]</div>Ysangkokhttps://wiki.haskell.org/index.php?title=Pt/Haskell&diff=62882Pt/Haskell2019-04-04T19:51:54Z<p>Ysangkok: prime link fix</p>
<hr />
<div><p style="text-align:center"><br />
Haskell é uma linguagem de propósito geral, linguagem de programação puramente funcional e fortemente tipada, com funções de ordem superir, polimorfismo, classes tipadas e mônadicas. Compiladores Haskell são livremente disponíveis para as mais variadas plataformas.<br />
</p><br />
<br />
__NOTOC__<br />
<br />
{| border=0 cellspacing=5 cellpadding=15<br />
| valign=top bgcolor=#F0F0F0 style="text-align:left" |<br />
== Sobre ==<br />
<br />
{| border="0" cellspacing="0" cellpadding="2" style="text-align:left"<br />
|-<br />
| [[Pt/Introdução|Por que usar Haskell?]]<br />
|-<br />
| [[Pt/Linguagem e especificação das bibliotecas|Definição da Linguagem]]<br />
|-<br />
| [[Pt/História do Haskell|História]]<br />
|-<br />
| [[Pt/Futuro|Futuro]]<br />
|-<br />
| [[Pt/Implementação|Implementação]]<br />
|-<br />
|}<br />
: [http://haskell.org/ghc GHC]<br />
: [http://haskell.org/hugs Hugs]<br />
: [http://haskell.org/nhc98 nhc98]<br />
: [[Yhc]]<br />
<br />
== Como começar ==<br />
<br />
{| border="0" cellspacing="0" cellpadding="2" style="text-align:left"<br />
|-<br />
| [[Haskell em 5 passos]]<br />
|-<br />
| [[Aprendendo Haskell]]<br />
|-<br />
| [[Livros e tutoriais]]<br />
|-<br />
| [[:Categoria:Haskell|Artigos Wiki]]<br />
|-<br />
| [[Blog artigos]]<br />
|-<br />
| [http://en.wikibooks.org/wiki/Haskell Wikibook]<br />
|-<br />
| [[Research papers]]<br />
|-<br />
| [[Códigos exemplo]] <br />
|-<br />
|}<br />
<br />
== Bibliotecas ==<br />
<br />
{| border="0" cellspacing="0" cellpadding="2" style="text-align:left"<br />
|-<br />
| [http://haskell.org/ghc/docs/latest/html/libraries/ Bibliotecas padrão]<br />
|-<br />
| [http://hackage.haskell.org Banco de dados de bibliotecas Hackage]<br />
|-<br />
| [[Libraries and tools|Aplicações e bibliotecas]]<br />
|-<br />
| [http://haskell.org/hoogle Hoogle: procura de bibliotecas]<br />
|-<br />
|}<br />
<br />
<br />
<br />
== Comunidade ==<br />
<br />
{| border="0" cellspacing="0" cellpadding="2" style="text-align:left"<br />
|-<br />
| [http://haskell.org/communities/ Comunidades de projetos]<br />
|}<br />
: [[Haskell_in_education|Educação]]<br />
: [[Haskell in industry|Indústria]]<br />
: [[Haskell_in_research|Pesquisa]]<br />
: [[Haskell_and_mathematics|Matemática]]<br />
{| border="0" cellspacing="0" cellpadding="2" style="text-align:left"<br />
|-<br />
| [[Mailing lists]]<br />
|-<br />
| [[IRC channel]]<br />
|-<br />
| [[User groups]]<br />
|-<br />
| [http://planet.haskell.org/ Planet Haskell]<br />
|-<br />
| [[Haskell Notícias semanais]]<br />
|-<br />
| [http://sequence.complete.org The Haskell Sequence]<br />
|-<br />
| [http://hpaste.org/ Haskell pastebin]<br />
|-<br />
| [[Conferências]]<br />
|-<br />
| [[Programming contests|Conteúdo]]<br />
|-<br />
| [[Trabalhos]]<br />
|-<br />
| [[Consultores]]<br />
|-<br />
| [[Humor]]<br />
|-<br />
| [[Merchandise]]<br />
|-<br />
| [[Haskell.org|haskell.org]]<br />
|-<br />
| [[HaskellWiki:Contributing|Contribuindo para o site]]<br />
|-<br />
| Languages: [[Haskell|en]] [[Es/Haskell|es]] [[Ro/Haskell|ro]] [[Pt/Haskell|pt]] [[Fr/Haskell|fr]] <br />
|-<br />
|}<br />
<br />
|valign=top bgcolor=#F0F0F0 width=65% style="text-align:left"|<br />
<br />
<br />
== Eventos ==<br />
{{:Events}}<br />
<br />
<br />
== Headlines ==<br />
<br />
* Haskell.org é a organização mentora no [http://code.google.com/soc 2007 Google Summer of Code]. 9 estudantes foram convidados pelo Google para trabalhar na infraestrutura do projeto para Haskell.<br />
<br />
* O comitê [http://prime.haskell.org Haskell-prime] começou a trabalhar para definir a próxima ''minor revision'' da especificação da linguagem.<br />
<br />
* A comunidade Haskell [http://www.haskell.org/communities November 2006] Relatório de Atividades foi criada, documentando projetos para a comunidade Haskell.<br />
<br />
* Haskell, pelo terceiro ano seguido, foi usado por [http://googleresearch.blogspot.com/2006/09/and-awards-go-to.html the winning team] e no [http://www.boundvariable.org/scoreboard.shtml ICFP Programming Contest].<br />
<br />
<br />
== Livros-texto ==<br />
<br />
;[[Image:Uma_Abordagem_Pratica.jpg|Cover]] Claudio Cesar de S and Marcio Ferreira da Silva: <em> Haskell: Uma Abordagem Prática</em>, [http://www.novatec.com.br Novatec Editora Ltda.], 2006, 296 pages, ISBN 85-7522-095-0. The price is R$ 62,00 (in Reais). Language: Portugese<br />
<br />
<blockquote><br />
This book is being published by Novatec Editora Ltda. You can access directly [http://www.novateceditora.com.br/livros/haskell/ here].<br />
<br><br />
<b>Book description:</b><br><br />
This book brings a comprehensive vision of Haskell language. No <br />
knowledge in another functional programming language is expected. In <br />
addition, no background in programming is required. The book presents <br />
issues from basic up to an intermediate level; it also includes some <br />
advanced aspects of Haskell. The title of the book, <em>Haskell: Uma <br />
Abordagem Prática</em>, in English <em>Haskell: A Practical Approach</em>, is the essence of the book.<br />
The result is a text that can be used in courses of programming and paradigms languages.<br />
Finally, many practical examples can be found <br />
throughout the book.<br />
<br />
An additional page containing comments on this book is found here:<br />
[http://www2.joinville.udesc.br/~coca/index.php/Main/PaginaDoLivroDeHaskell].<br />
Other data as bibtex entry, cover's book in several formats, <br />
Winhugs-2001 for download, and so on. This page is Portugese.<br />
</blockquote><br />
<br />
<br />
== Notícias ==<br />
{{:News}}<br />
<br />
|}<br />
<br />
== Articles ==<br />
<br />
[[Category:Community]]</div>Ysangkokhttps://wiki.haskell.org/index.php?title=Cn/Haskell&diff=62881Cn/Haskell2019-04-04T19:51:00Z<p>Ysangkok: prime link fix</p>
<hr />
<div><p style="text-align:center"><br />
Haskell，一门通用型纯粹函数式编程语言。其特性有：静态类型，高阶函数，多态，型别类，以及单子式副作用等。Haskell编译器几乎在每一种计算机上都可以运行。</p><br />
__NOTOC__<br />
{| border=0 cellspacing=5 cellpadding=15<br />
| valign=top bgcolor=#F0F0F0 style="text-align:left" |<br />
== 关于 About ==<br />
<br />
{| border="0" cellspacing="0" cellpadding="2" style="text-align:left"<br />
|-<br />
| [[Cn/Introduction|Haskell介绍]]<br />
|-<br />
| [[Language and library specification|语言与库规范]]<br />
|-<br />
| [[History of Haskell|Haskell历史]]<br />
|-<br />
| [[Future of Haskell|Haskell特点]]<br />
|-<br />
| [[Implementations|Haskell实现]]<br />
|-<br />
|}<br />
: [http://haskell.org/ghc GHC]<br />
: [http://haskell.org/hugs Hugs]<br />
: [http://haskell.org/nhc98 nhc98]<br />
: [[Yhc]]<br />
<br />
== 学习Haskell ==<br />
<br />
{| border="0" cellspacing="0" cellpadding="2" style="text-align:left"<br />
|-<br />
| [[Haskell in 5 steps|Haskell 入门五步走]] ([[cn/Haskell 入门五步走|zh]])<br />
|-<br />
| [[Learning Haskell|学习Haskell]]<br />
|-<br />
| [[Books and tutorials|书籍和教程]]<br />
|-<br />
| [[:Category:Haskell|维基文章]]<br />
|-<br />
| [[Blog articles|博客文章]]<br />
|-<br />
| [[Video presentations|视频演示]]<br />
|-<br />
| [http://en.wikibooks.org/wiki/Haskell 维基教科书] ([http://zh.wikibooks.org/wiki/Haskell zh])<br />
|-<br />
|-<br />
| [[Research papers|研究论文]]<br />
|-<br />
| [[Example code|示例代码]] <br />
|-<br />
|}<br />
<br />
== 库 Libraries ==<br />
<br />
{| border="0" cellspacing="0" cellpadding="2" style="text-align:left"<br />
|-<br />
| [http://haskell.org/ghc/docs/latest/html/libraries/ 标准库]<br />
|-<br />
| [http://hackage.haskell.org Hackage 资源库]<br />
|-<br />
| [[Applications_and_libraries|应用与程序库]]<br />
|-<br />
| [http://haskell.org/hoogle Hoogle：程序库搜索引擎]<br />
|-<br />
|}<br />
<br />
== 社区 Community ==<br />
<br />
{| border="0" cellspacing="0" cellpadding="2" style="text-align:left"<br />
|-<br />
| [http://haskell.org/communities/ 社区和活跃的项目]<br />
|}<br />
: [[Haskell_in_education|Haskell与教育]]<br />
: [[Haskell in industry|Haskell与行业]]<br />
: [[Haskell_in_research|Haskell与研究]]<br />
: [[Haskell_and_mathematics|Haskell与数学]]<br />
{| border="0" cellspacing="0" cellpadding="2" style="text-align:left"<br />
|-<br />
| [[Mailing lists|邮件列表]]<br />
|-<br />
| [[IRC_channel|IRC频道]]<br />
|-<br />
| [[User groups|用户组]]<br />
|-<br />
| [http://planet.haskell.org/ Haskell星球]<br />
|-<br />
| [[Haskell Weekly News|Haskell每周简讯]]<br />
|-<br />
| [[The Monad.Reader|Monad.Reader杂志]]<br />
|-<br />
| [http://sequence.complete.org The Haskell Sequence]<br />
|-<br />
| [http://hpaste.org/ Haskell pastebin]<br />
|-<br />
| [[Conferences|会议]]<br />
|-<br />
| [[Programming contests|编程竞赛]]<br />
|-<br />
| [[Jobs|工作]]<br />
|-<br />
| [[Consultants|顾问]]<br />
|-<br />
| [[Humor|幽默]]<br />
|-<br />
| [[Merchandise|商品]]<br />
|-<br />
| [[Haskell.org|haskell.org]]<br />
|-<br />
| [[HaskellWiki:Contributing|为本站作贡献]]<br />
|-<br />
| 其他语言: [[Haskell|en]] [[Es/Haskell|es]] [[Ro/Haskell|ro]] [[Pt/Haskell|pt]] [[Fr/Haskell|fr]] [[Ru/Haskell | ru]][[cn/Haskell | zh_CN]]<br />
|-<br />
|}<br />
<br />
|valign=top bgcolor=#F0F0F0 width=65% style="text-align:left"|<br />
<br />
== 事件 Events ==<br />
{{:Events}}<br />
<br />
<br />
== 头条 Headlines ==<br />
<br />
* Haskell.org is a mentoring organisation in the [http://code.google.com/soc 2007 Google Summer of Code]. 9 students have been funded by Google to work on infrastructure projects for Haskell.<br />
<br />
* The [http://prime.haskell.org/ Haskell-prime] committee has started work on defining the next minor revision of the language specification.<br />
<br />
* The [http://www.haskell.org/communities May 2007] Haskell Communities and Activities report is now out, documenting projects in the Haskell community.<br />
<br />
* Haskell, for the third year running, was used by [http://googleresearch.blogspot.com/2006/09/and-awards-go-to.html the winning team] in the [http://www.boundvariable.org/scoreboard.shtml ICFP Programming Contest].<br />
<br />
== 新闻 News ==<br />
{{:News}}<br />
<br />
|}<br />
<br />
== 其他 ==<br />
<br />
[http://www.haskellcn.org Haskell中文主页]<br />
<br />
<br />
[[Category:Chinese]]</div>Ysangkokhttps://wiki.haskell.org/index.php?title=Tur/Haskell&diff=62880Tur/Haskell2019-04-04T19:50:29Z<p>Ysangkok: prime link fix</p>
<hr />
<div>__NOTOC__<br />
<br />
{| border=0 cellspacing=5 cellpadding=15<br />
| valign=top bgcolor=#F0F0F0 style="text-align:left" |<br />
== [http://www.millstream.com/haskellorgsearch.html haskell.org'u ara] ==<br />
== Haskell hakkında ==<br />
<br />
{| border="0" cellspacing="0" cellpadding="2" style="text-align:left"<br />
|-<br />
| [[Introduction|Tanıtım (ingilizce)]]<br />
|-<br />
| [[Language and library specification|Dil tanımı (ingilizce)]]<br />
|-<br />
| [[History of Haskell|Haskell'in tarihçesi (ingilizce)]]<br />
|-<br />
| [[Future of Haskell|Haskell'in geleceği(ingilizce)]]<br />
|-<br />
| [[Implementations|Gerçekleştirimler (ingilizce)]]<br />
|-<br />
|}<br />
: [http://haskell.org/ghc GHC]<br />
: [http://haskell.org/hugs Hugs]<br />
: [http://haskell.org/nhc98 nhc98]<br />
: [[Yhc]]<br />
<br />
== Haskell'i öğrenmek ==<br />
<br />
{| border="0" cellspacing="0" cellpadding="2" style="text-align:left"<br />
|-<br />
| [[5 adımda Haskell]]<br />
|-<br />
| [[Learning Haskell|Haskell'i öğrenmek (ingilizce)]]<br />
|-<br />
| [[Books and tutorials|Kitaplar ve kısa dersler (ingilizce)]]<br />
|-<br />
| [[:Category:Haskell|Wiki makaleleri (ingilizce)]]<br />
|-<br />
| [[Blog articles|Blog makaleleri (ingilizce)]]<br />
|-<br />
| [[Video presentations|Videolar (ingilizce)]]<br />
|-<br />
| [http://en.wikibooks.org/wiki/Haskell Wikibook]<br />
|-<br />
| [[Research papers|Araştırma(ingilizce)]]<br />
|-<br />
|}<br />
<br />
== Kütüphaneler ==<br />
<br />
{| border="0" cellspacing="0" cellpadding="2" style="text-align:left"<br />
|-<br />
| [http://haskell.org/ghc/docs/latest/html/libraries/ Standart kütüphaneler]<br />
|-<br />
| [http://hackage.haskell.org Hackage kütüphane veritabanı]<br />
|-<br />
| [[Uygulamalar ve kütüphaneler]]<br />
|-<br />
| [http://haskell.org/hoogle Hoogle: kütüphane arama sayfası]<br />
|-<br />
|}<br />
<br />
== Cemiyet ==<br />
<br />
{| border="0" cellspacing="0" cellpadding="2" style="text-align:left"<br />
|-<br />
| [http://haskell.org/communities/ Cemiyetler ve aktif projeler]<br />
|}<br />
: [[Haskell_in_education|Eğititim (ingilizce)]]<br />
: [[Haskell in industry|Sanayi (ingilizce)]]<br />
: [[Haskell_in_research|Araştırma anayi (ingilizce)]]<br />
: [[Haskell_and_mathematics|Matematik (ingilizce)]]<br />
{| border="0" cellspacing="0" cellpadding="2" style="text-align:left"<br />
|}<br />
<br />
|valign=top width=65% style="text-align:left"|<br />
<br />
<p style="text-align:center"><br />
Haskell salt fonksiyonel ve genel maksatlı bir programlama dilidir. <br />
Haskell'i birçok programlama dilinden ayıran özellikleri tembel değerlendirme (lazy evaluation), üstün düzen fonksiyonlar (higher order functions), statik tipleme (static typing), parametrik çokbiçimlilik (parametric polymorphism), tip sınıfları ve monad tarzı etkilerdir (monadic effects). Hemen hemen her bilgisayar sistemi için uygun bir Haskell derleyicisi indirmek mümkündür.<br />
</p><br />
<br />
{|<br />
|-<br />
|valign=top bgcolor=#F0F0F0 width=65% style="text-align:left"|<br />
<br />
== Etkinlikler ==<br />
{{:Events}}<br />
<br />
<br />
== Başlıklar ==<br />
* [http://www.ludd.ltu.se/~pj/hw2007/HaskellWorkshop.html Haskell Workshop 2007'den görüntüler] Sunumlar ve sohbetler izlenebilir. Formatı QuickTime (H264 video, AAC audio), 320x240 piksel, düşük çerçeve hızı (ama yine de yarım saatlik bir sunum 120Mb yapıyor).<br />
<br />
* Haskell.org [http://code.google.com/soc 2007 Google Summer of Code]'a mentor kurumu olarak katılıyor. 9 öğrenci Google tarafından Haskell için altyapı projeleri üzerine çalışmak için maddi destek aldılar.<br />
<br />
* [http://prime.haskell.org/ Haskell-prime] komitesi işbaşına geçti ve dil belirtimin bir sonraki küçük revizyonu başladı.<br />
<br />
|-<br />
|}<br />
|}</div>Ysangkokhttps://wiki.haskell.org/index.php?title=Future_of_Haskell&diff=62879Future of Haskell2019-04-04T19:50:04Z<p>Ysangkok: fix prime link</p>
<hr />
<div>==Haskell' is the next official version==<br />
<br />
The [http://www.haskell.org/onlinereport/haskell2010/ Haskell 2010] report was published in July 2010, and is the current definition of the Haskell language. Compilers will also continue to support the previous version of Haskell, [http://haskell.org/onlinereport/ Haskell 98] (via a special flag).<br />
<br />
A new standard will be defined each year. All <br />
information about this is on<br />
<blockquote><br />
<b>[http://prime.haskell.org/ The Haskell' Wiki]</b><br />
</blockquote><br />
<br />
----<br />
<br />
The language evolves and numerous extensions have been proposed and many of them have been implemented in some Haskell systems; for example<br />
pattern guards (which is adopted in the Haskell 2010 standard), scoped type variables, multi-parameter type classes, local universal and existential quantification. <br />
The Haskell [[mailing lists]] <br />
are a forum for discussing new language features.<br />
People proposing an additional language feature should implement the new feature or convince the developers of one of the Haskell systems to do so.<br />
Then many people can test the practical usefulness of the extension.<br />
Finally, the people seriously interested in the new feature should define the new feature with respect to the current Haskell standard in a document (a new mailing list can be set up for this purpose). This kind of addendum to the Haskell report clarifies the details and can be used for adding the feature to other Haskell systems. The definition of the foreign function interface (FFI) for Haskell is a good example for this process.<br />
<br />
On a rather longer time schedule, a committee led by John Launchbury<br />
may develop Haskell II. Obviously well-tested and well-described extension<br />
proposals will have a higher chance of being adopted.<br />
<br />
<br />
== Extensions of Haskell == <br />
<br />
<DL><br />
<DT><B>[[:Category:Proposals|Proposals]]</B><br />
<DD> Collects all kinds of extensions proposed for the language, libraries and specific implementations. Note that the above page is automatically generated, so to add a new proposal you can instead type the title for your page into the address bar of your browser using underscores instead of spaces, then the wiki generates a new page (assuming there is not already a page with the same title) that you can edit. If you put <pre>[[Category:Proposals]]</pre> at the top of your page, it will be automatically linked to by the [http://www.haskell.org/haskellwiki/Category:Proposals Proposals page above]. (Sometimes the convention of ending the title of a proposal with the word <tt>proposal</tt> is followed, so that people browsing the wiki can clearly see that the page describes something different that is not yet part of the current Haskell language.)<br />
</DD><br />
<br />
<DT><B><br />
[http://www.haskell.org/mailman/listinfo/libraries The libraries mailing list] <br />
</B><br />
<DD>Discusses, amongst others, extensions to libraries.<br />
</DD><br />
<br />
<DT><B>[http://web.archive.org/web/20061011095312/http://haskell.org/hawiki/HaskellTwo HaskellTwo on the old wiki]</B> (in the web archive)<br />
<DD> This old hawiki page contains all kinds of extensions proposed for the language, libraries and specific implementations, before the new wiki came online.</DD><br />
<br />
</DL><br />
<br />
<P><br />
Below we present some of the various extensions that have<br />
been implemented or proposed.<br />
See also the Haskell [[mailing lists]].<br />
<br />
<UL><br />
<li id="views"><b>Views</b> allow multiple `logical' constructors to match<br />
against real constructors in patterns.<br />
<ul><br />
<li>A [http://www.haskell.org/development/views.html views proposal] has been submitted for consideration in<br />
future Haskell reports. Implemented in hbc (?)</li><br />
<li>[[Dependent type]]s provide a way for not-forgetful views: views who cannot lie.<br />
</ul><br />
<li><b>Pattern Guards</b> by Simon Peyton-Jones is a proposal<br />
to generalize guards used in function definitions. See the<br />
[http://research.microsoft.com/Users/simonpj/Haskell/guards.html proposal] for<br />
further details. Implemented in GHC, proposed for Haskell 2. <br />
<li> [[Mathematical prelude discussion#Basic Algebra Library (BAL)|Basic algebra proposal.]] In particular: Reformulating numeric classes,<br />
instance ruled type and domain conversion.<br />
<LI> [http://www.soi.city.ac.uk/~ross/notes/ArrowsInHaskell.html Haskell Proposal: Syntactic Sugar for Arrows]<br />
<li>Mark Shields and Simon Peyton Jones: [http://research.microsoft.com/Users/simonpj/Papers/first-class-modules/ First-class Modules for Haskell] discusses a lot of extension proposals integrated in a coherent design. See also [[First-class module]] page.<br />
<li>[[Extensible record]] page: problems where extensible records are useful, proposals, implementations etc.<br />
<li>An [[Accessible layout proposal]] which would allow you to make more use of the layout rule to eliminate many commas and parentheses (particularly interesting if you don't like manually deleting then re-inserting that comma that always ends up in the wrong place when you are re-ordering a list of things by cut and paste).<br />
<li> A [[Class system extension proposal]] page, to collect ideas for making the class system more powerful, some of which have been implemented in other languages similar to Haskell.<br />
</UL><br />
<br />
== Variations of Haskell ==<br />
<br />
<br />
<DL><br />
<dt>[http://www.cs.mu.oz.au/~sulzmann/chameleon/ Chameleon]<br />
<dd>Chameleon is a Haskell-style language which provides a flexible<br />
overloading mechanism based on Constraint Handling Rules (CHRs).<br />
The user can impose conditions on overloaded identifiers via CHRs.<br />
<br />
<DT>[http://web.cecs.pdx.edu/~mpj/goferarc/index.html Gofer]<br />
<DD><br />
Gofer is a small interpreter by Mark Jones supporting a language based on the Haskell report version 1.2.<br />
Gofer is intended as an experimental language, particularly where type classes<br />
are involved. Although Haskell has adopted a number of ideas from Gofer, the Gofer type class system is still more flexible than the Haskell one.<br />
Available for all Unix platforms including Linux, DOS, and Macs.<br />
Hugs is the successor to Gofer and Gofer is no longer supported.<BR><br />
[http://www.google.com/search?q=goferdoc Html-version of the Gofer manual]<br />
<br />
<DT>[http://www.cee.hw.ac.uk/~dsg/gph/ GPH, Glasgow Parallel Haskell]<DD><br />
is an extension of Haskell for parallel programming. It<br />
adds just two new primitives to the language, namely, a form of<br />
parallel composition <b>par</b>, and sequential composition <b>seq</b>. With<br />
judicious use of <b>par</b> and <b>seq</b> it is possible to express how a program<br />
should be evaluated in parallel. <br />
<br />
<DT>[http://abp.lcs.mit.edu/projects/ph/ pH - a parallel Haskell]<br />
<DD><br />
The pH language is is a parallel, eagerly-evaluated variant of Haskell with syntactic provisions for<br />
loops, barriers, and I- and M- structure storage. The eager evaluation model of pH is similar to<br />
that of Id; the current version of the pH compiler shares a back end with the Id compiler, producing<br />
code for the Monsoon dataflow machine. The front end of the pH compiler is a modification of<br />
hbc.<br />
<br />
<DT>[http://www.cse.unsw.edu.au/~chak/papers/ Goffin]<DD><br />
A Haskell extension for parallel and distributed<br />
programming. Browse [http://www.cse.unsw.edu.au/~chak/ Manuel M T Chakravarty's] page for newer work on parallel extensions to GHC.<br />
<br />
<DT>[http://www.cs.chalmers.se/~patrikj/poly/polyp/ PolyP - a polytypic programming language]<DD><br />
PolyP extends a functional language (a subset of Haskell) with a construct for writing polytypic functions. A polytypic function is a function that is defined by induction on the structure of user-defined datatypes.<br />
<br />
<DT>[http://www.cs.chalmers.se/~nordland/ohaskell/ O'Haskell]<DD><br />
O'Haskell is an object-oriented extension to Haskell developed at<br />
Chalmers. O'Haskell conservatively adds two major features to the<br />
Haskell core: a monad of concurrent, state-encapsulating reactive <br />
objects, and a type system with subtyping between records as well <br />
as datatypes. An implementation is available, O'Hugs, which is a<br />
derivative of Hugs 1.3b.<br />
<br />
<DT>[http://www.mathematik.uni-marburg.de/~eden/ Eden]<dd> Eden<br />
is a parallel functional language that provides a new perspective on<br />
parallel programming. It gives programmers enough control to implement<br />
their parallel algorithms efficiently (including granularity issues)<br />
and at the same time frees them from the low level details of process<br />
management. Eden is explicit about processes and their incoming and<br />
outgoing data, but abstracts from the transfer of these data between<br />
processes and the necessary synchronisation. <br />
Eden extends the Haskell but overrules lazy evaluation whenever it is<br />
necessary to support parallelism. <br />
<br />
<dt>[http://www.informatik.uni-kiel.de/~mh/curry/ Curry]<br />
<dd>Curry combines in a seamless way features from functional programming (nested expressions, higher-order functions,<br />
lazy evaluation), logic programming (logical variables, partial data structures, built-in search), and concurrent<br />
programming (concurrent evaluation of expressions with synchronization on logical variables). Many Haskell programs are also valid Curry programs.<br />
<br />
<dt>[http://www.mrtc.mdh.se/projects/DFH/ Data Field Haskell]<br />
<dd>Data Field Haskell implements an instance of Data Fields, a generalization<br />
of arrays. The purpose is to support generic array- and data parallel<br />
programming on a very high level, for rapid prototyping of parallel<br />
algorithms. The most important language extension to Haskell is the<br />
<tt>forall</tt>-construct, which allows convenient definitions of data<br />
fields.<br />
<br />
<dt>[[Template Haskell]]<br />
<dd>Template Haskell is an extension to Haskell 98 that allows you to do<br />
type-safe compile-time meta-programming, with Haskell both as the<br />
manipulating language and the language being manipulated.<br />
<br />
<dt>[http://disciple.ouroborus.net Disciple]<br />
<dd><br />
Disciple is a dialect of Haskell that uses strict evaluation as the default and supports destructive update of arbitrary data structures. Disciple includes region, effect and closure typing, and this extra information provides a handle on the operational behaviour of code that isn't available in other languages. Programs can be written in either a pure/functional or effecful/imperative style, and one of our goals is to provide both styles coherently in the same language.<br />
<br />
<dt>[[Dependent types]]<br />
<dd><br />
* concept of dependent types, its usefulness in the world of programming;<br />
* dependently typed languages, possiblity of not-forgetful views;<br />
* simulating dependent types in Haskell, and extending Haskell to have them.<br />
<br />
<br />
</DL><br />
<br />
[[Category:Proposals| ]]<br />
[[Category:Language| ]]</div>Ysangkokhttps://wiki.haskell.org/index.php?title=Applications_and_libraries&diff=62878Applications and libraries2019-04-04T19:47:15Z<p>Ysangkok: fix prime trac link</p>
<hr />
<div>[[Category:Libraries]] [[Category:Tools]]<br />
<br />
The number of Haskell packages is growing rapidly. The section 'Haskell library collections' gives an ordering of all these packages by relative importance. In the section 'Haskell applications and libraries' an ordering by category is given. Finally some guidelines for developers of new packages are presented.<br />
<br />
== Haskell library collections ==<br />
<br />
=== Haskell Prelude ===<br />
The most important Haskell library is called the [http://www.haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html Prelude]. It is implicitly imported by default, and includes the most commonly used functions. Make sure you know what they do and how to use them effectively.<br />
<br />
=== Haskell 2010 libraries ===<br />
The Haskell 2010 [[Language and library specification]] defines a set of [http://www.haskell.org/onlinereport/haskell2010/haskellpa2.html libraries] with basic functionality which all Haskell implementations should support, including the Prelude. Changes to these libraries are handled by the [http://prime.haskell.org/ Haskell'] process.<br />
<br />
Haskell modules that almost everybody uses are in this group, for example:<br />
[http://www.haskell.org/onlinereport/haskell2010/haskellch13.html Control.Monad], [http://www.haskell.org/onlinereport/haskell2010/haskellch20.html Data.List] <br />
and [http://www.haskell.org/onlinereport/haskell2010/haskellch41.html System.IO]. Within GHC, these are mostly grouped into the [http://hackage.haskell.org/package/base base] package, but for example [http://www.haskell.org/onlinereport/haskell2010/haskellch14.html Data.Array] is in the [http://hackage.haskell.org/package/array array] package.<br />
<br />
=== GHC bootstrap libraries ===<br />
GHC comes with an expanded version of the Haskell 2010 libraries. Together these are called the [http://www.haskell.org/ghc/docs/latest/html/libraries/index.html GHC bootstrap libraries]. You should not rely on this list being stable, since it is just the list of packages that are needed to build GHC itself (including ghci and the user guide). <br />
<br />
Examples of libraries that are GHC 7.8.3 boot libraries (but not core libraries, see below): <br />
[http://hackage.haskell.org/package/haskeline haskeline],<br />
[http://hackage.haskell.org/package/integer-gmp integer-gmp] and<br />
[http://hackage.haskell.org/package/terminfo terminfo].<br />
<br />
=== Core Libraries ===<br />
The core libraries form a subset of the packages in the Haskell Platform that has submitted to the management process described on the [[Library submissions]] page. <br />
<br />
These packages typically define basic APIs that are expected to be available in any Haskell implementation, packages that are being maintained for backwards compatibility, or in some cases, which are just needed as glue to hold the rest of the platform together.<br />
<br />
Not all GHC boot libraries are core libraries.<br />
<br />
Examples of libraries, or packages, that belong to this group are: <br />
[http://hackage.haskell.org/package/mtl Monad transformer library],<br />
[http://hackage.haskell.org/package/random random] and<br />
[http://hackage.haskell.org/package/parallel parallel].<br />
<br />
=== Haskell Platform libraries ===<br />
On top of the Core Libraries, the [http://www.haskell.org/platform/ Haskell Platform] comes preinstalled with some additional packages that together form the [http://www.haskell.org/platform/contents.html#packages-and-documentation Haskell Platform libraries]. These libraries have been thoroughly tested before being included. The addition of these libraries with the [http://www.haskell.org/platform/ Haskell Platform] is what makes it 'batteries included'.<br />
<br />
Examples of included packages are:<br />
[http://hackage.haskell.org/package/attoparsec attoparsec], [http://hackage.haskell.org/package/network network] and [http://hackage.haskell.org/package/QuickCheck QuickCheck].<br />
<br />
=== The Hackage database ===<br />
[http://hackage.haskell.org/packages/archive/pkg-list.html Hackage] is the final layer of the Haskell library collections. [http://hackage.haskell.org/packages/archive/pkg-list.html Hackage] aims to provide a comprehensive collection of released Haskell packages, similar to Perl's CPAN or Python's PyPI. <br />
<br />
Start on [http://hackage.haskell.org/packages/archive/pkg-list.html Hackage] if you are looking for some functionality that did not come preinstalled with the [http://www.haskell.org/platform/ Haskell Platform]. <br />
<br />
See also the [[Hackage|Hackage wiki page]] and [[Cabal/How to install a Cabal package | how to install a Cabal package]].<br />
<br />
== Haskell applications and libraries ==<br />
<br />
Applications, libraries and tools for Haskell or written in Haskell have been classified below, but you should check [http://hackage.haskell.org/packages/archive/pkg-list.html Hackage] for the latest list.<br />
<br />
* [[/Music and sound/|Audio, music and sound]]<br />
* [[/Bioinformatics/]]<br />
* [[/Concurrency and parallelism/]]<br />
* [[/Compilers and interpreters/]]<br />
* [[/Compiler tools|Compiler construction, lexing, parsing, pretty printing]]<br />
* [[/Cryptography|Cryptography and hashing]]<br />
* [[/Data structures | Data Structures and IO Libraries]]<br />
* [[/Database interfaces/]]<br />
* [[/Editors|Editors written in Haskell]] and [[Editors|editors for Haskell]].<br />
* [[/Extended Haskell/]]<br />
* [[/Games/]]<br />
* [[/Generic programming/]]<br />
* [[/GUI libraries|Graphical User Interface (GUI) Libraries]]<br />
* [[/Graphics/]]<br />
* [[/Hardware verification/]]<br />
* [[/Linguistics|Linguistics and natural language processing]]<br />
* [[/Mathematics/|Mathematics and physics]]<br />
* [[/Network/]]<br />
* [[/Operating system/|Operating systems and systems programming]] (also emulators)<br />
* [[/Program development/]]<br />
* [[/Robotics/]]<br />
* [[/Statistics/]]<br />
* [[/Theorem provers/]]<br />
* [[/Interfacing other languages|Tools for interfacing with other languages]]<br />
* [[Web|Web, HTML, XML]]<br />
<br />
Other places to look include:<br />
* The [[Library]] hierarchy page on this wiki.<br />
* The Haskell [[Haskell Communities and Activities Report|community reports]].<br />
* The [http://www.haskell.org/mailman/listinfo/libraries mailing list] for discussion of issues related to libraries.<br />
<br />
You can also [http://www.reddit.com/r/haskell_proposals/top/?t=month propose and vote on new libraries] that you'd like on [http://www.reddit.com/r/haskell reddit], and look at our past [http://hackage.haskell.org/trac/summer-of-code/ Summer of Code proposals].<br />
<br />
== Guidelines for developers ==<br />
<br />
[[Image:Cabal-With-Text-small.png|frame|Built with Cabal]]<br />
<br />
Developer guides:<br />
<br />
* [[How to write a Haskell program|How to write a new Haskell library]]<br />
* [[Library submissions|How to propose changes to the standard libraries]]<br />
* [http://web.archive.org/web/20071011215053/http://pupeno.com/2006/12/12/the-lambda-revolution-v/ Creating a .deb from a Haskell Cabal package] (in the Web Archive)<br />
* Guide to making standard [[Library submissions|library submissions]]<br />
* If you notice the library documentation is lacking, or could be improved, [http://www.haskell.org/haskellwiki/Improving_library_documentation please report it here]<br />
* [http://www.google.com/codesearch Google Code Search] can help identify common idioms, improving your API.<br />
* [[Future projects]], more projects people would like.<br />
* [[Cabal]], The Common Architecture for Building Applications and Libraries, is a framework for packaging, building, and installing any tool developed in the Haskell language.<br />
* [[Hack-Nix]], a set of tools based on the [http://nixos.org Nix] package manager to manage multiple setups to build a project<br />
<br />
Proposals for the module name space layout that can be used to guide the construction of new libraries. <br />
<br />
* [[Hierarchical module names|Almost current guide]]<br />
* [http://www.cs.york.ac.uk/fp/libraries/layout.html Proposal 1]<br />
* [http://www.cs.york.ac.uk/fp/libraries/layoutSM.html Proposal 2]<br />
<br />
=== Libraries for other languages ===<br />
<br />
If you are thinking about designing a new library for Haskell, you ought to look what has been done in other languages. Here are standard library definitions for <br />
<br />
* [http://wiki.clean.cs.ru.nl/Libraries Clean]<br />
* [http://www.standardml.org/Basis/ Standard ML]<br />
* [http://caml.inria.fr/pub/docs/manual-ocaml/manual034.html Objective Caml]<br />
* [http://srfi.schemers.org/ Scheme]</div>Ysangkokhttps://wiki.haskell.org/index.php?title=FAQ&diff=62877FAQ2019-04-04T19:46:54Z<p>Ysangkok: fix prime trac link</p>
<hr />
<div>This FAQ is based on actual frequently-asked questions from [[IRC channel|<tt>#haskell</tt> IRC]]. The goal is simply to collect and edit some common answers. Beginner questions are still welcome on IRC, as always.<br />
<br />
This is a wiki, so please edit the text with any improvements you have. And feel free to add new questions, if they are frequently asked.<br />
<br />
== See also ==<br />
<br />
* [[:Category:FAQ|Other FAQs]]<br />
* The [[Introduction|introduction to Haskell]], and the FAQ at the end of that document.<br />
<br />
__TOC__<br />
<br />
= The real world =<br />
<br />
== Should I learn Haskell? ==<br />
<br />
That depends on your goals. In general, Haskellers will tell you that you should learn Haskell. :)<br />
<br />
Learning Haskell is fun. It will expand your mind and make you a better programmer in other languages. These are the immediate benefits.<br />
<br />
Haskell is also a great tool for solving real-world problems, but it can take many months of study to get to that point.<br />
<br />
== Is Haskell hard to learn? ==<br />
<br />
Any competent programmer can learn Haskell, but it will take more time and motivation than you may expect.<br />
<br />
Haskell requires learning a new way to think, not just new syntax for old concepts. This can be incredibly frustrating, as simple tasks seem impossibly difficult.<br />
<br />
Those with no prior programming experience may actually have an easier time learning Haskell, because they have less to un-learn.<br />
<br />
== How can I get started with Haskell ''right now''? ==<br />
<br />
Check out [http://tryhaskell.org/ Try Haskell].<br />
<br />
Also: [https://www.fpcomplete.com/business/fp-haskell-center/ FP Complete's free online IDE]<br />
<br />
<br />
== What should I read for learning Haskell? ==<br />
<br />
The most popular resources are [http://learnyouahaskell.com/ ''Learn You a Haskell''] and [http://book.realworldhaskell.org/ ''Real World Haskell'']. Each is available online for free, or can be purchased in hardcopy.<br />
<br />
Many other [[tutorials]], [[books]], and [[Learning Haskell|other resources]] are available.<br />
<br />
There's also the [https://www.schoolofhaskell.com/ School of Haskell] which has a set of free online tutorials with runnable examples.<br />
<br />
== How can I get help with learning Haskell? ==<br />
<br />
Your options include:<br />
<br />
* [[IRC channel|<tt>#haskell</tt> on Freenode IRC]]<br />
* [http://stackoverflow.com/questions/tagged/haskell Stack Overflow]<br />
* The [http://www.haskell.org/mailman/listinfo/haskell-cafe Haskell-Cafe] mailing list<br />
<br />
== Will Haskell get me a job? ==<br />
<br />
There are plenty of [[Haskell in industry|companies using Haskell]], but it's still a tiny number compared to the software industry as a whole.<br />
<br />
There are also many companies which do not use Haskell, but prefer to hire people who know Haskell. It indicates that you learned something hard and obscure just for fun, which employers take as a sign of intelligence.<br />
<br />
== Is Haskell similar to Language X? ==<br />
<br />
Probably not. It's best if you approach Haskell with a clean slate. Most analogies to another language will break down somewhere, often in a subtle and misleading way. If you first learn the Haskell concepts for what they are, you can then draw useful connections to other languages.<br />
<br />
== What's the relationship between Haskell and GHC? ==<br />
<br />
Haskell is not a piece of software; it is a specification for a standardized programming language. The [[Language and library specification|latest version of the spec]] is the Haskell 2010 Report.<br />
<br />
[http://www.haskell.org/ghc/ GHC] is the Glorious Glasgow Haskell Compiler. It is by far the most popular and &quot;production-ready&quot; implementation of the standard Haskell language. It also implements many [http://www.haskell.org/ghc/docs/latest/html/users_guide/ghc-language-features.html extension] features that go above and beyond standard Haskell. Many programs use these features and so aren't &quot;written in Haskell&quot; in the strictest sense.<br />
<br />
You can use the term &quot;Haskell&quot; to refer to the standard language, and &quot;GHC Haskell&quot; when including GHC extensions.<br />
<br />
Besides GHC, several other [[implementations]] of Haskell are available. Each one provides its own extensions, some of which don't exist in GHC.<br />
<br />
== What is the Haskell Platform? ==<br />
<br />
The [http://hackage.haskell.org/platform/ Haskell Platform] is a copy of GHC bundled with a &quot;blessed&quot; set of useful libraries. It is the easiest way to get started with Haskell. It's not essential to start with the Platform, because you can install the same libraries as needed.<br />
<br />
== What is Haskell Prime (Haskell')? ==<br />
<br />
[http://prime.haskell.org/ Haskell Prime] is a process which produces new versions of the Haskell language spec. It does not refer to a particular present or future version of Haskell.<br />
<br />
== My textbook uses Haskell 98. Is it very different from Haskell 2010? ==<br />
<br />
No. Haskell 2010 is a [http://www.haskell.org/pipermail/haskell/2009-November/021750.html very conservative change] to Haskell 98. It fixes small syntactic flaws, and standardizes several well-behaved extensions which GHC has supported for years.<br />
<br />
The standardization process is very slow because standardizing a flawed language can be a costly mistake. Extensions are accepted only once they are considered mature and well-understood.<br />
<br />
== How do I get libraries for Haskell? ==<br />
<br />
You can find libraries on [http://hackage.haskell.org/packages/archive/pkg-list.html Hackage], and install them with [[Cabal-Install|<tt>cabal-install</tt>]].<br />
<br />
== Is Haskell compiled? ==<br />
<br />
Usually. GHC, the most popular Haskell implementation, has an optimizing ahead-of-time native-code compiler, as well as a bytecode compiler and interpreter for interactive use.<br />
<br />
Haskell itself is not a &quot;compiled language&quot; because nothing in the Haskell spec requires implementations to be compilers.<br />
<br />
== Does Haskell have an interpreter? ==<br />
<br />
Yes, but maybe you instead mean &quot;Is there a program where I can type Haskell code and see it run immediately?&quot;. GHCi provides such a &quot;read-evaluate-print loop&quot;.<br />
<br />
<br />
== Which project can I join? ==<br />
<br />
See [[Haskell projects needing help]].<br />
<br />
= Paradigms =<br />
<br />
== Is learning Haskell the best way to learn functional programming? ==<br />
<br />
Not necessarily! Haskell is not a ''typical'' functional language. It can be overwhelming to learn the basic concepts of functional programming alongside static types, algebraic data, laziness, type classes, first-class IO, etc. For an introduction to FP by itself you might want to learn Scheme, or play with the FP features in your current favorite language.<br />
<br />
That said, many people choose Haskell as an introduction to FP and have success with that approach. Haskell has an extremely active community of people teaching, doing research, writing libraries, etc. Haskell is where interesting things happen in the FP space, so it's an exciting place to jump in.<br />
<br />
== I heard Haskell is pure functional. Does that mean I can't do imperative / OOP / aspect-oriented / logic programming in Haskell? ==<br />
<br />
No, &quot;pure functional&quot; has a specific technical meaning. It doesn't mean that functional is the only supported paradigm.<br />
<br />
Paradigms describe the techniques used in a particular program. For example, the Linux kernel is written in C, with pervasive use of functional, object-oriented, and aspect-oriented programming. The most we can say about a ''language'' is that it encourages or discourages a particular paradigm. Haskell is very flexible and can comfortably accommodate most paradigms, even when there is no built-in support.<br />
<br />
== I heard Haskell is pure functional. Does that mean it can't do IO? ==<br />
<br />
No; [[Introduction to IO|IO in Haskell]] is straightforward.<br />
<br />
== I heard Haskell is pure functional. Does that mean it doesn't have mutable state? ==<br />
<br />
No; see [http://www.haskell.org/ghc/docs/latest/html/libraries/base/Data-IORef.html <tt>IORef</tt>] for a simple example. A more sophisticated example is [http://book.realworldhaskell.org/read/software-transactional-memory.html software transactional memory], which provides concurrent state more sophisticated than you'll find in most other imperative languages.<br />
<br />
== Wait, is Haskell imperative or is it functional? ==<br />
<br />
Both. In Haskell, functions are first class, and so are imperative actions.<br />
<br />
There is no reason to consider &quot;imperative language&quot; and &quot;functional language&quot; as mutually exclusive. It's only a historical accident that a few of the most popular imperative languages are unusually bad at functional programming. Functional imperative programming is extremely powerful and is supported by many languages.<br />
<br />
= Math =<br />
<br />
== Was Haskell designed by mathematicians? ==<br />
<br />
Haskell was designed by people studying programming language design. Perhaps programmers would consider them to be mathematicians, while mathematicians would consider them to be programmers.<br />
<br />
Designing a programming language is a hard thing to do. There are many non-obvious tradeoffs, and many lessons to be learned from past failures and successes. Yet many of today's most popular languages were designed by people who hadn't done their homework.<br />
<br />
Haskell was designed by people who knew what they were doing. It's not perfect, but the contrast to an amateur's design is striking.<br />
<br />
== Do I need to know advanced math in order to use Haskell? ==<br />
<br />
No. Certain concepts in Haskell are named after concepts in advanced math. But other languages also appropriate math terminology: consider &quot;[http://en.wikipedia.org/wiki/Singleton_pattern singleton]&quot;, not to mention &quot;function&quot; and &quot;variable&quot;. The way these programming concepts relate to actual mathematics is not necessarily important or relevant.<br />
<br />
In addition, some people write articles about advanced math, using Haskell syntax as their notation. These articles are interesting, but the connection to everyday programming work is usually remote.<br />
<br />
Knowing advanced math will enrich your experience using Haskell, but is by no means a prerequisite.<br />
<br />
= Types =<br />
<br />
== Doesn't a static type system just make it harder to write programs? ==<br />
<br />
Yes. In particular, it makes it ''much'' harder to write ''incorrect'' programs.<br />
<br />
The tradeoff is that correct programs also become somewhat harder to write. In Haskell, features like type inference mitigate this burden to a large extent.<br />
<br />
== How do I make a list with elements of different types? ==<br />
<br />
Are you sure that's what you want? Consider instead creating a single data type to encompass the alternatives:<br />
<br />
<haskell><br />
data Identifier<br />
= ByNumber Int<br />
| ByName String<br />
<br />
doStuff :: [Identifier] -> Whatever<br />
</haskell><br />
<br />
In many dynamically-typed languages you aren't allowed to create &quot;variant types&quot; like this. The type system itself is used as a single ad-hoc global variant type. Keep this in mind if you're translating designs from a dynamically-typed language to Haskell.<br />
<br />
== No really, how do I make a list of elements of different types? ==<br />
<br />
Well, you can't avoid putting all your values into one type. But sometimes the &quot;variant type&quot; approach above is too restrictive. Maybe you need to let other people add to the set of allowed types, the way [http://www.haskell.org/ghc/docs/latest/html/libraries/base/Control-Exception.html Control.Exception] allows users to define new exception types.<br />
<br />
You can use an [[existential type]], possibly with a type class. Or you can use [http://www.haskell.org/ghc/docs/latest/html/libraries/base/Data-Dynamic.html Data.Dynamic].<br />
<br />
== I'm making an RPG. Should I define a type for each kind of monster, and a type class for them? ==<br />
<br />
Probably not. Some languages require a new type for each new behavior. In Haskell, behaviors are functions or IO actions, which are first-class values. So you can store behaviors in an ordinary data type:<br />
<br />
<haskell><br />
data MonsterOps = MonsterOps<br />
{ new :: Monster<br />
, move :: Monster -> Monster<br />
, attack :: Monster -> Player -> Player }<br />
<br />
data Monster = Monster<br />
{ position :: (Int, Int)<br />
, hitpoints :: Double }<br />
<br />
beholder :: MonsterOps<br />
beholder = MonsterOps new move attack where<br />
new = Monster (0,0) 9000<br />
move self = ...<br />
attack self player = ...<br />
</haskell><br />
<br />
This approach is especially nice if you want to generate or transform behaviors on the fly. See the article [http://lukepalmer.wordpress.com/2010/01/24/haskell-antipattern-existential-typeclass/ &quot;Haskell Antipattern: Existential Typeclass&quot;] for a longer discussion.<br />
<br />
== What's the difference between <hask>Integer</hask> and <hask>Int</hask>? ==<br />
<br />
<p><hask>Integer</hask> can represent arbitrarily large integers, up to using all of the storage on your machine.</p><br />
<br />
<p><hask>Int</hask> can only represent integers in a finite range. The [http://www.haskell.org/onlinereport/haskell2010/haskellch6.html#dx13-135009 language standard] only guarantees a range of -2<sup>29</sup> to (2<sup>29</sup> - 1). Most implementations will provide a full machine-size signed integer, i.e. 32 or 64 bits.</p><br />
<br />
Operations on <hask>Int</hask> can be much faster than operations on <hask>Integer</hask>, but overflow and underflow can cause weird bugs. Using <hask>Int</hask> in an initial design could be considered premature optimization. Unfortunately, many standard library functions (e.g. <hask>length</hask>, <hask>take</hask>) use <hask>Int</hask>.<br />
<br />
== How do I convert type <tt>A</tt> to type <tt>B</tt>? ==<br />
<br />
This is just another way of asking for a function of type <hask>A -> B</hask>. For example, you can convert <hask>Double</hask> to <hask>Int</hask> with <hask>round</hask>, <hask>ceiling</hask>, or <hask>floor</hask>. Haskell does not privilege one of these as ''the'' conversion.<br />
<br />
== Does Haskell have type casts? ==<br />
<br />
The word &quot;cast&quot; can mean a lot of different things.<br />
<br />
* You want to convert a value from one type to another, preserving some idea of what it means. For example, you might convert an <hask>Int</hask> to a <hask>Double</hask> which represents the same integer. In this case you'd just use a function of type <hask>Int -> Double</hask>, such as <hask>fromIntegral</hask>. Haskell doesn't provide special rules or syntax for these functions. See also the previous question.<br /><br /><br />
* You want to pass a value of more specific type to a function expecting a less specific type. There's no syntax for this in Haskell; you just do it. For example you can pass <hask>x :: Int</hask> to <hask>show :: (Show a) => a -> String</hask>, which automatically specializes the type of <hask>show</hask> to <hask>Int -> String</hask>. Note that Haskell does not have subtyping, so this only happens in the context of instantiating type variables.<br /><br /><br />
* You want to use a value of less specific type under the assumption of a more specific type, with a checkable runtime error if they do not match. This is rarely the right way to do things in Haskell, and probably indicates a conceptual / design problem instead. If you really do need such a cast, you can use [http://www.haskell.org/ghc/docs/latest/html/libraries/base/Data-Typeable.html#v:cast <tt>cast</tt>] from [http://www.haskell.org/ghc/docs/latest/html/libraries/base/Data-Typeable.html Data.Typeable]. In this case the &quot;checkable runtime error&quot; is <hask>cast</hask> returning <hask>Nothing</hask>. Note that Haskell does not have subtyping, so this only happens in the context of instantiating type variables.<br /><br /><br />
* You want to use a value of less specific type under the assumption of a more specific type, and if the assumption is incorrect, the program is allowed to segfault / silently corrupt data / give the attacker a root shell / send illicit photos to your boss. Also known as a "reinterpret cast". GHC Haskell has a way to do this, but I dare not speak its name. It's so dangerous and so unlikely to be what you want that it has no place in a general FAQ. You can ask on IRC or read the docs if you have the right kind of morbid curiosity.<br />
<br />
== How do I convert from one numeric type to another? ==<br />
<br />
Probably using one of these:<br />
<br />
<haskell><br />
fromIntegral :: (Integral a, Num b ) => a -> b<br />
realToFrac :: (Real a, Fractional b) => a -> b<br />
</haskell><br />
<br />
<p><hask>fromIntegral</hask> converts to a wider range of types, but <hask>realToFrac</hask> converts from types which aren't integers.</p><br />
<br />
== How do I convert <hask>Maybe Int</hask> to <hask>Int</hask>? ==<br />
<br />
Use pattern-matching. If <hask>mx :: Maybe Int</hask>:<br />
<br />
<haskell><br />
case mx of<br />
Just x -> ...<br />
Nothing -> ...<br />
</haskell><br />
<br />
This forces you to consider the <hask>Nothing</hask> case, and is the main advantage of <hask>Maybe</hask>, compared to adding a <tt>null</tt> value to every type.<br />
<br />
See also the functions [http://www.haskell.org/ghc/docs/latest/html/libraries/base/Data-Maybe.html#v:maybe <tt>maybe</tt>] and [http://www.haskell.org/ghc/docs/latest/html/libraries/base/Data-Maybe.html#v:fromMaybe <tt>fromMaybe</tt>] in the module [http://www.haskell.org/ghc/docs/latest/html/libraries/base/Data-Maybe.html Data.Maybe].<br />
<br />
''Do not'' use <hask>fromJust</hask>, because passing <hask>Nothing</hask> will crash your program with a supremely unhelpful error message. Even when you want to assume the value is not <hask>Nothing</hask>, you can provide a better error message:<br />
<br />
<haskell><br />
let x = fromMaybe (error "custom error message") mx in ...<br />
</haskell><br />
<br />
If you pattern-match without a <hask>Nothing</hask> case:<br />
<br />
<haskell><br />
let Just x = mx in ...<br />
</haskell><br />
<br />
you'll at least get a line number in the error message:<br />
<br />
<pre><br />
*** Exception: foo.hs:2:9-24: Irrefutable pattern failed for pattern Data.Maybe.Just x<br />
</pre><br />
<br />
== How do I convert <hask>IO Int</hask> to <hask>Int</hask>? ==<br />
<br />
You can't; they represent totally different things. An <hask>Int</hask> is an integer. An <hask>IO Int</hask> is a description of how some IO could be performed, in the future, to produce an integer. The IO hasn't been performed yet, and might never happen or might happen more than once.<br />
<br />
See the [[Introduction to IO]].<br />
<br />
== How do I convert between <hask>String</hask> (or <hask>Text</hask>) and <hask>ByteString</hask>? ==<br />
<br />
<p><hask>String</hask> represents a sequence of Unicode characters. <hask>ByteString</hask> represents a sequence of bytes. There are many different, incompatible ways to represent Unicode characters as bytes. See [http://www.joelonsoftware.com/articles/Unicode.html this article] if you're fuzzy on the character / byte distinction.</p><br />
<br />
The module [http://hackage.haskell.org/packages/archive/text/0.11.1.5/doc/html/Data-Text-Encoding.html Data.Text.Encoding] from the <tt>text</tt> package provides functions for common Unicode encodings. For more obscure / legacy encodings, see the [http://hackage.haskell.org/package/text-icu <tt>text-icu</tt>] package.<br />
<br />
== How do I catch the error thrown by <hask>read</hask> on a parse failure? ==<br />
<br />
Don't. Instead use<br />
<br />
<haskell><br />
import Text.Read (readMaybe)<br />
readMaybe :: Read a => String -> Maybe a<br />
</haskell><br />
<br />
which returns a <tt>Nothing</tt> in the case of parse failure.<br />
<br />
== What's the difference between <hask>type</hask>, <hask>data</hask>, and <hask>newtype</hask>? ==<br />
<br />
<p><hask>type</hask> introduces a synonym, which is fully interchangeable with the original type:</p><br />
<br />
<haskell><br />
type Foo = Int<br />
<br />
main = print ((2 :: Int) + (3 :: Foo))<br />
</haskell><br />
<br />
So it provides convenience and documentation, but no additional type checking.<br />
<br />
<p><hask>data</hask> is used to define new data types, distinct from any existing type.</p><br />
<br />
<p><hask>newtype</hask> can mostly be understood as a restricted form of <hask>data</hask>. You can use <hask>newtype</hask> when you have exactly one constructor with exactly one field. In those cases, <hask>newtype</hask> can give better performance than <hask>data</hask>.</p><br />
<br />
There is, however, a [[Newtype|subtle difference]] between <hask>data</hask> and <hask>newtype</hask> semantics, which is why the <hask>newtype</hask> optimization is not applied automatically.<br />
<br />
= Making it work =<br />
<br />
== How can I find type errors? ==<br />
<br />
There's no silver bullet, but here are a few useful techniques:<br />
<br />
* Comment out type signatures and see what GHC infers, using <tt>:t</tt> in GHCi.<br />
* Add more type signatures, for example inside <hask>let</hask>. This makes your assumptions clearer, so GHC's error message may better explain how your assumptions are inconsistent.<br />
* Replace some subexpressions with <hask>undefined</hask>, which can assume any type. In more recent versions of GHC, you should insert a "type hole", written <hask>_</hask> (a single underscore) instead of <hask>undefined</hask> for this purpose. GHC's error message will then indicate the type it's expecting for the expression in the hole.<br />
<br />
== How can I find bugs that occur at runtime? ==<br />
<br />
With pure functions, correctness is a matter of getting the right output for a given input. If one function gives incorrect results, you test the functions it calls, and so on until the bad code is located. You can perform these tests directly in GHCi, or with the help of a tool like QuickCheck.<br />
<br />
You can trace evaluation using [http://www.haskell.org/ghc/docs/latest/html/libraries/base/Debug-Trace.html Debug.Trace]. You'll get a printout when the expression is evaluated. Due to lazy evaluation, this might be at an unexpected time. But this property is useful when debugging problems related to excessive laziness.<br />
<br />
GHCi also implements a [http://www.haskell.org/ghc/docs/latest/html/users_guide/ghci-debugger.html &quot;simple imperative-style debugger&quot;].<br />
<br />
Haskell is a natural fit for novel [http://ww2.cs.mu.oz.au/~bjpop/buddha/ &quot;declarative debugging&quot; tools] but to our knowledge, no such tool is production-ready.<br />
<br />
== Why do I get an &quot;undefined symbol&quot; linker error when compiling? ==<br />
<br />
If you're using GHC 6, you should pass <tt>--make</tt> so that GHC will automatically link the appropriate Haskell libraries.<br />
<br />
== How can I get a stack backtrace when my program throws an exception? ==<br />
<br />
The standard stack in GHC Haskell doesn't represent nested function calls. The more informative stack is the profiling cost-center stack, which only exists if your code is built for profiling.<br />
<br />
With GHC 7 you can do something like this:<br />
<br />
<pre>$ ghc -fforce-recomp -prof -auto-all -rtsopts foo.hs</pre><br />
For GHC 6 you should leave off <tt>-rtsopts</tt>, and you'll probably want <tt>--make</tt>.<br />
<br />
You can then run your program with the [http://www.haskell.org/ghc/docs/latest/html/users_guide/runtime-control.html#rts-options-debugging <tt>-xc</tt> RTS option`]:<br />
<br />
<pre>$ ./foo +RTS -xc</pre><br />
== How can I do automated unit testing? ==<br />
<br />
See the [http://book.realworldhaskell.org/read/testing-and-quality-assurance.html testing chapter] in ''Real World Haskell''.<br />
<br />
== How can I find and fix performance problems? ==<br />
<br />
See the [http://book.realworldhaskell.org/read/profiling-and-optimization.html profiling and optimization chapter] in ''Real World Haskell''.<br />
<br />
= Modules =<br />
<br />
== How do I deal with name clashes between modules? ==<br />
<br />
You can disambiguate by prefixing a module name:<br />
<br />
<haskell><br />
import Data.List<br />
import Data.Map<br />
<br />
f = Data.List.lookup 7<br />
g = Data.Map.lookup 7<br />
</haskell><br />
<br />
The import syntax gives you additional control:<br />
<br />
* With <hask>import qualified Foo</hask> the names from <hask>Foo</hask> can ''only'' be used qualified, and won't clash with unqualified names.<br />
<br />
* With <hask>import Foo as M</hask> you'd write <hask>M.x</hask> instead of <hask>Foo.x</hask>.<br />
<br />
You can combine these two features. A more common way to write the above example is:<br />
<br />
<haskell><br />
import qualified Data.Map as M<br />
<br />
f = lookup 7 -- unqualified, from Prelude<br />
g = M.lookup 7<br />
</haskell><br />
<br />
In general, most combinations of <hask>import</hask> features are allowed. You<br />
can combine <hask>as</hask> and <hask>qualified</hask> with import and<br />
<hask>hiding</hask> lists. You can import two modules <hask>as</hask> the same<br />
name, or one module <hask>as</hask> two names, with different import and<br />
<hask>hiding</hask> lists, <hask>qualified</hask> or unqualified, etc.<br />
<br />
== How do I control the <hask>Prelude</hask> import? ==<br />
<br />
Haskell modules implicitly import <hask>Prelude</hask>, unless an explicit import is given. So you can write<br />
<br />
<haskell><br />
import Prelude as P hiding (length, head)<br />
</haskell><br />
<br />
== How do I qualify the name of an infix operator? ==<br />
<br />
You prefix the module name, as usual:<br />
<br />
<haskell><br />
x = 2 + 3<br />
y = 2 Prelude.+ 3<br />
<br />
f = (+) 7<br />
g = (Prelude.+) 7<br />
</haskell><br />
<br />
This looks weird but works fine. The syntax does clash a bit:<br />
<br />
<haskell><br />
xs = [False..True] -- wrong, parses as qualified name<br />
xs = [False .. True] -- ok<br />
</haskell><br />
<br />
== How do I mention an infix operator in an export / import / <hask>hiding</hask> list? ==<br />
<br />
The same way as elsewhere: enclose it in parentheses.<br />
<br />
<haskell><br />
import Prelude ( succ, (+), length, (*) )<br />
</haskell><br />
<br />
== I listed a data type in my import list but its data constructors aren't in scope. How do I fix it? ==<br />
<br />
You have to import data constructors explicitly:<br />
<br />
<haskell><br />
import Prelude ( Maybe ) -- the type only<br />
import Prelude ( Maybe(Nothing) ) -- type and specific constructor(s)<br />
import Prelude ( Maybe(..) ) -- type and all its constructors<br />
</haskell><br />
<br />
== How can I import and re-export a whole module? ==<br />
<br />
<haskell><br />
module Bar ( module Foo ) where<br />
import Foo<br />
</haskell><br />
<br />
== How can I export another module ''and'' everything defined in this module? ==<br />
<br />
<haskell><br />
module Bar ( module Bar, module Foo ) where<br />
import Foo<br />
</haskell><br />
<br />
= The M-word =<br />
<br />
See also &quot;[[What a Monad is not]]&quot;.<br />
<br />
== I heard Haskell is about monads. I heard that the core feature of Haskell is monads. Is that true? ==<br />
<br />
Absolutely not.<br />
<br />
== Do I need to understand monads in order to do IO? ==<br />
<br />
Not really. &quot;<tt>Monad</tt>&quot; is the name of a generic API that applies to many different types, including the <hask>IO</hask> type. If you're only thinking about IO, you don't need to worry about how this API generalizes.<br />
<br />
See the [[Introduction to IO]].<br />
<br />
== What should I know before trying to understand monads? ==<br />
<br />
Let's look at part of the definition of <hask>Monad</hask>:<br /><br /><br />
<br />
<haskell><br />
class Monad m where<br />
(>>=) :: m a -> (a -> m b) -> m b<br />
</haskell><br />
<br />
This uses a lot of features:<br />
<br />
* first-class functions: the second argument to <hask>(>>=)</hask> is a function<br />
<br />
* type constructors (here <hask>m</hask>)<br />
<br />
* type class polymorphism<br />
<br />
* type class polymorphism ''over'' type constructors (which few other languages have)<br />
<br />
* parametric (not type class) polymorphism, over <hask>a</hask> and <hask>b</hask><br />
<br />
Each of these features is more fundamental than the specific idea of monads. If you understand each feature, then <hask>Monad</hask> is a small example of how they fit together. <hask>Functor</hask> is a slightly simpler example, and you can start there instead (see [[Typeclassopedia]]).<br />
<br />
== Aren't monads just a hack for handling impure things in a pure language? ==<br />
<br />
No. This is wrong in several ways.<br />
<br />
First, '''<hask>Monad</hask> isn't special.''' <hask>Monad</hask> is an ordinary Haskell type class. You can define it yourself in a few lines of pure Haskell code, so it's definitely not adding magical new capabilities to the language. Besides that, <hask>Monad</hask> is an API, not an implementation.<br /><br /><br />
<br />
(The <hask>do</hask> syntax ''is'' special, but it's only [[syntactic sugar]]. There's a straightforward translation to ordinary function calls, lambdas, etc.)<br /><br /><br />
<br />
Second, '''most monads have nothing to do with effects or "impurity".''' The <hask>Monad</hask> API is implemented by many different type constructors, including <hask>Maybe</hask> and <hask>[]</hask>. Lists and <hask>Maybe</hask> values are straightforward, familiar data values. There's nothing "impure" about them.<br /><br /><br />
<br />
Third, '''<hask>IO</hask> is not an exception to purity.''' IO actions are pure, first-class values like any other. You can create, store, and evaluate them without causing side effects. IO actions are just ''descriptions'' of IO which ''could'' be performed.<br /><br />
<br />
In short, Haskell programs are pure-functional programs which compute imperative programs.<br />
<br />
It's true that <hask>IO</hask> implements the <hask>Monad</hask> API, but that's not fundamental. You could instead use non-overloaded functions like<br /><br /><br />
<br />
<haskell><br />
returnIO :: a -> IO a<br />
bindIO :: IO a -> (a -> IO b) -> IO b<br />
</haskell><br />
<br />
<br />to glue together IO actions, and it would all work out basically the same. We use the generic <hask>Monad</hask> API for <hask>IO</hask> not because we have to, but because it lets us reuse convenient syntax and [http://www.haskell.org/ghc/docs/latest/html/libraries/base/Control-Monad.html libraries]. Indeed, you can [[Introduction to IO|introduce <tt>IO</tt>]] without mentioning <hask>Monad</hask> at all.<br />
<br />
== I heard monads are like burritos or space suits full of nuclear waste. Is that true? ==<br />
<br />
These analogies are not helpful. See [http://byorgey.wordpress.com/2009/01/12/abstraction-intuition-and-the-monad-tutorial-fallacy/ &quot;Abstraction, intuition, and the 'monad tutorial fallacy&quot;'].<br />
<br />
== I can use monads but I feel like I still don't &quot;get&quot; them. What am I missing? ==<br />
<br />
You're not necessarily missing anything. &quot;<tt>Monad</tt>&quot; is just the name of a generic API that applies to many different types. The types implementing the <tt>Monad</tt> API don't have a lot in common.<br />
<br />
You might want to read &quot;[[Typeclassopedia]]&quot; to see how <tt>Monad</tt> fits in with other similar APIs.<br />
<br />
== What's the difference between <hask>State s</hask> and <hask>ST s</hask> monads? ==<br />
<br />
<tt>State s a</tt> is just a wrapper for the function type <hask>s -> (a, s)</hask>: a function that takes an &quot;old state&quot; and returns a &quot;new state&quot; along with its result. You can implement <hask>State</hask> in a few lines of standard Haskell, without any special help from the compiler.<br />
<br />
<hask>ST</hask> gives you true mutable variables with in-place update. You can't implement it yourself in standard Haskell. In GHC, <hask>STRef</hask> and <hask>IORef</hask> will behave the same way at runtime. The difference is the extra compile-time safety checking associated with <hask>runST</hask>.<br />
<br />
= Concurrency and parallelism =<br />
<br />
See also notes on [[parallel]] and [[Concurrency|concurrent]] programming.<br />
<br />
== How can I do X without resorting to threads? ==<br />
<br />
That's usually the wrong attitude. Threads are useful for solving problems. The attitude comes from other languages where some combination of the following holds:<br />
<br />
* Per-thread overhead consumes a lot of memory or CPU<br />
<br />
* Thread APIs are cumbersome, sometimes due to lacking first-class functions or IO actions<br />
<br />
* The thread implementation is fundamentally broken, e.g. a global interpreter lock<br />
<br />
* Threads break easily because programs constantly mutate implicitly-shared state<br />
<br />
None of these is true in GHC Haskell. Threads have disadvantages and are not always the right tool. But avoiding them at all costs is counterproductive.<br />
<br />
== What's the difference between concurrency and parallelism? ==<br />
<br />
Briefly: concurrency describes semantics; parallelism describes an implementation property.<br />
<br />
Concurrent programs are written with explicit threads of control. Concurrent semantics fit naturally with certain real-world problems, like a network server talking to many simultaneous clients. This is still a nice model for writing a network server, even if you only intend to run it on one CPU core — concurrency without parallelism.<br />
<br />
Parallel programs are those which run on multiple CPU cores simultaneously, regardless of how they were implemented.<br />
<br />
Concurrency is a popular way to obtain parallel performance, but converting a pure computation to use concurrent semantics is difficult and error-prone. GHC Haskell provides "[http://hackage.haskell.org/packages/archive/parallel/latest/doc/html/Control-Parallel-Strategies.html semi-implicit parallelism]" as an alternative. Adding these "annotations" to a program cannot change its behavior.<br />
<br />
There's a longer discussion on the [http://ghcmutterings.wordpress.com/2009/10/06/parallelism-concurrency/ GHC blog].<br />
<br />
== How do <hask>par</hask>, <hask>pseq</hask>, and <hask>seq</hask> relate? ==<br />
<br />
The expression <hask>par x y</hask> is semantically equivalent to <hask>y</hask>, but suggests to the runtime system that evaluating <hask>x</hask> in parallel might be a good idea. Usually <hask>x</hask> would be a variable referring to a thunk (unevaluated expression) that will later be needed.<br /><br /><br />
<br />
Now consider <hask>par x (x+y)</hask>. Evaluating this expression suggests evaluating <hask>x</hask> in parallel. But before the runtime system can act on that suggestion, we evaluate <hask>(x+y)</hask>, which will evaluate both <hask>x</hask> and <hask>y</hask> in sequence. It would be better to work on <hask>y</hask> for a while, and only demand <hask>x</hask> later, after perhaps some parallel work has occurred. We can use <hask>pseq</hask> to force this evaluation order, as in <hask>par x (pseq y (x+y))</hask>.<br /><br /><br />
<br />
The [http://hackage.haskell.org/packages/archive/parallel/latest/doc/html/Control-Parallel-Strategies.html Strategies] module provides a nicer interface to these <hask>par</hask> / <hask>pseq</hask> tricks.<br />
<br />
<p><hask>seq</hask> is similar to <hask>pseq</hask> but provides a weaker guarantee. [http://www.mail-archive.com/glasgow-haskell-users@haskell.org/msg10973.html The details] are subtle; suffice to say that if you're controlling evaluation order, you want <hask>pseq</hask>.</p><br />
<br />
== How do I do event-based IO in GHC Haskell? Should I call <tt>select</tt>, <tt>epoll</tt>, etc? ==<br />
<br />
No; just do blocking IO from multiple threads, and GHC's runtime system will make these calls for you. GHC Haskell gives you the performance benefits of event-based IO without making you turn your code inside-out.<br />
<br />
Threads in GHC are lightweight — both in performance and in the mental effort of using them. You can handle [http://blog.johantibell.com/2010/09/final-version-of-our-ghc-io-manager.html ten thousand concurrent requests] at high throughput with a naive "one thread per client" model.<br />
<br />
== What's the difference between <hask>forkIO</hask> and <hask>forkOS</hask>? ==<br />
<br />
It only matters if you're calling into a C library that cares about thread-local state. In that case, <hask>forkOS</hask> guarantees that the C library will see the same OS thread each time. Any difference beyond that is an implementation detail and subject to change.<br />
<br />
== How can I wait for a thread to finish and produce a result? ==<br />
<br />
There's a few libraries for this on Hackage, like [http://hackage.haskell.org/package/async <tt>async</tt>], [http://hackage.haskell.org/package/spawn <tt>spawn</tt>], and [http://hackage.haskell.org/package/threads <tt>threads</tt>].<br />
<br />
It's not hard to implement this yourself using [http://www.haskell.org/ghc/docs/latest/html/libraries/base/Control-Concurrent-MVar.html <tt>MVar</tt>], though it's harder to get the exception handling right.<br />
<br />
= IRC =<br />
<br />
== What does lambdabot's "info" command do? ==<br />
<br />
At first, it seems like it just echoes whatever you type:<br />
<br />
<user> ?info foo bar baz<br />
<lambdabot> foo bar baz<br />
<br />
What is actually happening is that it autocorrects to the "undo" command, which desugars do blocks according to the Report's rules. So, a more interesting example might look like this:<br />
<br />
<user> ?info do { foo; x <- bar; baz }<br />
<lambdabot> foo >> bar >>= \ x -> baz<br />
<br />
<br />
= Error messages and warnings =<br />
<br />
== Not in scope: `catch' ==<br />
<br />
The function "catch" is removed from Prelude, add the line:<br />
<haskell>import Control.Exception</haskell><br />
(Note, that this might lead to an error if you compile the same code with an older [[GHC]].)<br />
<br />
<br />
[[Category:FAQ]]</div>Ysangkokhttps://wiki.haskell.org/index.php?title=Applications_and_libraries/Mathematics&diff=62876Applications and libraries/Mathematics2019-04-04T19:46:27Z<p>Ysangkok: fix prime trac link</p>
<hr />
<div>== Applications ==<br />
<br />
=== Physics ===<br />
<br />
;[http://ab-initio.mit.edu/meep/ Meep]<br />
:Meep (or MEEP) is a free finite-difference time-domain (FDTD) simulation software package developed at MIT to model electromagnetic systems. Meep used Haskell to generate C++ code, after Meep [http://ab-initio.mit.edu/wiki/index.php/Meep_release_notes 1.0] Haskell generation droped in favor of handwritten C++ code. <br />
<br />
;[[Numeric Quest]]<br />
:Jan Skibinski's [[Numeric Quest]] library provides modules that are useful for Quantum Mechanics, among other things.<br />
<br />
== Libraries ==<br />
<br />
=== Linear algebra ===<br />
<br />
;[http://hackage.haskell.org/package/bed-and-breakfast bed-and-breakfast]<br />
:A library that implements Matrix operations in pure Haskell using mutable arrays and the ST Monad. bed-and-breakfast does not need any additional software to be installed and can perform basic matrix operations like multiplication, finding the inverse, and calculating determinants efficiently.<br />
<br />
;[https://github.com/patperry/hs-linear-algebra hs-linear-algebra]<br />
:Patrick Perry's linear algebra library, built on BLAS. [https://github.com/cartazio/hs-cblas hs-cblas] seems to be a more up-to-date fork.<br />
<br />
;[http://www.cs.utah.edu/~hal/HBlas/index.html Wrapper to CLAPACK]<br />
<br />
;[http://haskelldsp.sourceforge.net/ Digital Signal Processing]<br />
:Modules for matrix manipulation, Fourier transform, interpolation, spectral estimation, and frequency estimation.<br />
<br />
;[http://article.gmane.org/gmane.comp.lang.haskell.general/13561 Index-aware linear algebra]<br />
:Frederik Eaton's library for statically checked matrix manipulation in Haskell<br />
<br />
;[[Numeric Quest]]<br />
:Jan Skibinski's [[Numeric Quest]] library provides several modules that are useful for linear algebra in general, among other things.<br />
<br />
;[[vector-space]]<br />
:The [[vector-space]] package defines classes and generic operations for vector spaces and affine spaces. It also defines a type of infinite towers of generalized derivatives (linear transformations).<br />
<br />
;[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hmatrix HMatrix]<br />
:By Alberto Ruiz. From the project [http://perception.inf.um.es/hmatrix/ website]:<br />
::''A purely functional interface to linear algebra and other numerical algorithms, internally implemented using LAPACK, BLAS, and GSL.<br />
<br />
::''This package includes standard matrix decompositions (eigensystems, singular values, Cholesky, QR, etc.), linear systems, numeric integration, root finding, etc.<br />
<br />
;[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Vec Vec]<br />
:By Scott E. Dillard. Static dimension checking:<br />
::''Vectors are represented by lists with type-encoded lengths. The constructor is :., which acts like a cons both at the value and type levels, with () taking the place of nil. So x:.y:.z:.() is a 3d vector. The library provides a set of common list-like functions (map, fold, etc) for working with vectors. Built up from these functions are a small but useful set of linear algebra operations: matrix multiplication, determinants, solving linear systems, inverting matrices.''<br />
<br />
;[https://github.com/martinra/hlinear HLinear]<br />
:By Alexandru Ghitza, Martin Westerholt-Raum. PDE decomposition of matrices over division rings. See [https://arxiv.org/abs/1605.02532 HLinear: Exact Dense Linear Algebra in Haskell].<br />
::''HLinear is a Haskell implementation of the PLE decomposition of matrices over division rings. It writes an arbitrary matrix as a product of a permutation matrix, a lower unitriangular matrix, and an echelon matrix.''<br />
<br />
== See also ==<br />
<br />
* [[Linear algebra]]<br />
* [[Mathematical prelude discussion]]<br />
<br />
<br />
See also: [[Linear algebra|Design discussions]]<br />
<br />
=== [[Physical units]] ===<br />
<br />
;[[Dimensionalized numbers]]<br />
: Working with physical units like second, meter and so on in a type-safe manner.<br />
<br />
;[http://darcs.haskell.org/numericprelude/src/Number/SI.hs NumericPrelude: Physical units]<br />
: Numeric values with dynamically checked units.<br />
<br />
;[[CalDims]]<br />
:This is not simply a library providing a new type of <hask>Num</hask> class, but stand-alone calculation tool that supports user defined functions and units (basic and derived), so it can provide dimension-safe calculation (not embedded but via shell). Calculations can be modified/saved via shell. It uses rational numbers to avoid rounding errors where possible.<br />
<br />
;[https://github.com/bjornbm/dimensional Dimensional]<br />
: Library providing data types for performing arithmetic with physical quantities and units. Information about the physical dimensions of the quantities/units is embedded in their types and the validity of operations is verified by the type checker at compile time. The boxing and unboxing of numerical values as quantities is done by multiplication and division of units.<br />
<br />
=== Number representations ===<br />
<br />
==== Decimal numbers ====<br />
<br />
;[http://src.seereason.com/decimal/ Decimal arithmetic library]<br />
:An implementation of real decimal arithmetic, for cases where the binary floating point is not acceptable (for example, money).<br />
<br />
==== Real and rational numbers ====<br />
<br />
There are several levels of [[Exact real arithmetic|handling real numbers]] and according libraries.<br />
<br />
===== Arbitrary precision =====<br />
<br />
* Numbers have fixed precision<br />
* Rounding errors accumulate<br />
* Sharing is easy, i.e. in <hask>sqrt pi + sin pi</hask>, <hask>pi</hask> is computed only once<br />
* Fast, because the routines can make use of the fast implementation of <hask>Integer</hask> operations<br />
<br />
;[[Numeric Quest]]<br />
:Jan Skibinski's [[Numeric Quest]] library provides, among other things, a type for arbitrary precision rational numbers with transcendental functions.<br />
<br />
;[http://cvs.haskell.org/darcs/numericprelude/src/Number/FixedPoint.hs FixedPoint.hs]<br />
:part of NumericPrelude project<br />
<br />
;[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/AERN-Basics AERN-Basics] [http://hackage.haskell.org/cgi-bin/hackage-scripts/package/AERN-Real AERN-Real] [http://hackage.haskell.org/cgi-bin/hackage-scripts/package/AERN-Real-Interval AERN-Real-Interval] [http://hackage.haskell.org/cgi-bin/hackage-scripts/package/AERN-Real-Double AERN-Real-Double]<br />
:contains type classes that form a foundation for ''rounded arithmetic'' and ''interval arithmetic'' with explicit control of rounding and the possibility to increase the rounding precision arbitrarily for types that support it. At the moment there are instances for Double floating point numbers where one can control the direction of rounding but cannot increase the rounding precision. In the near future instances for MPFR arbitrary precision numbers will be provided. Intervals can use as endpoints any type that supports directed rounding in the numerical order (such as Double or MPFR) and operations on intervals are rounded either outwards or inwards. Outwards rounding allows to safely approximate exact real arithmetic while a combination of both outwards and inwards rounding allows one to safely approximate exact interval arithmetic. Inverted intervals with Kaucher arithmetic are also supported.<br />
<br />
;[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/AERN-RnToRm AERN-RnToRm]<br />
:contains arithmetic of ''piecewise polynomial function intervals'' that approximate multi-dimensional (almost everywhere) continuous real functions to arbitrary precision<br />
<br />
;[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hmpfr hmpfr]<br />
:hmpfr is a purely functional haskell interface to the [http://www.mpfr.org/ MPFR] library<br />
<br />
;[http://hackage.haskell.org/package/numbers numbers]<br />
:provides an up-to-date, easy-to-use BigFloat implementation that builds with a modern GHC, among other things.<br />
<br />
===== Dynamic precision =====<br />
<br />
* You tell the precision and an expression shall be computed to, and the computer finds out, how precisely to compute the input values<br />
* Rounding errors do not accumulate<br />
* Sharing of temporary results is difficult, that is, in <hask>sqrt pi + sin pi</hask>, <hask>pi</hask> ''will'' be computed twice, each time with the required precision.<br />
* Almost as fast as arbitrary precision computation<br />
<br />
;[http://www.cs.man.ac.uk/arch/dlester/exact.html ERA] is an implementation (in Haskell 1.2) by David Lester.<br />
: It is quite fast, possibly the fastest Haskell implementation. At 220 lines it is also the shortest. Probably the shortest implementation of exact real arithmetic in any language.<br />
: The provided number type <hask>CReal</hask> is instance of the Haskell 98 numeric type classes and thus can be used whereever you used Float or Double before and encountered some numerical difficulties.<br />
:Here is a mirror: http://darcs.augustsson.net/Darcs/CReal/<br />
<br />
;[http://www.doc.ic.ac.uk/~ae/exact-computation/#bm:implementations IC-Reals] is an implementation by Abbas Edalat, Marko Krznar&#263; and Peter J. Potts.<br />
:This implementation uses linear fractional transformations.<br />
<br />
;[http://r6.ca/ Few Digits] by Russell O'Connor.<br />
:This is a prototype of the implementation he intendeds to write in [http://coq.inria.fr/ Coq]. Once the Coq implementation is complete, the Haskell code could be extracted producing an implementation that would be proved correct.<br />
<!--<br />
Example:<br />
*Data.Real.CReal> answer 1000 (exp 1 + sqrt 2)<br />
--><br />
<br />
;COMP is an implementation by Yann Kieffer.<br />
:The work is in beta and relies on new primitive operations on Integers which will be implemented in GHC. The library isn't available yet.<br />
<br />
;[http://www2.arnes.si/~abizja4/hera/ Hera] is an implementation by Aleš Bizjak.<br />
:It uses the [http://www.mpfr.org/ MPFR] library to implement dyadic rationals, on top of which are implemented intervals and real numbers. A real number is represented as a function <hask>Int -> Interval</hask> which represents a sequence of intervals converging to the real.<br />
<br />
===== Dynamic precision by lazy evaluation =====<br />
<br />
The real numbers are represented by an infinite datastructure, which allows you to increase precision successively by evaluating the data structure successively. All of the implementations below use some kind of digit stream as number representation.<br />
Sharing of results is simple.<br />
The implementations are either fast on simple expressions, because they use large blocks/bases, or they are fast on complex expressions, because they consume as little as possible input digits in order to emit the required output digits.<br />
<br />
;[http://medialab.freaknet.org/bignum/ BigFloat] is an implementation by Martin Guy.<br />
:It works with streams of decimal digits (strictly in the range from 0 to 9) and a separate sign. The produced digits are always correct. Output is postponed until the code is certain what the next digit is. This sometimes means that [http://medialab.freaknet.org/bignum/dudeney.html no more data is output].<br />
<br />
;In [http://users.info.unicaen.fr/~karczma/arpap/lazypi.ps.gz "The Most Unreliable Technique in the World to compute pi"] Jerzy Karczmarczuk develops some functions for computing pi lazily.<br />
<br />
;[http://darcs.haskell.org/numericprelude/src/Number/Positional.hs NumericPrelude: positional numbers]<br />
:Represents a real number as pair <hask>(exponent,[digit])</hask>, where the digits are <hask>Int</hask>s in the open range <hask>(-basis,basis)</hask>. There is no need for an extra sign item in the number data structure. The <hask>basis</hask> can range from <hask>10</hask> to <hask>1000</hask>. (Binary representations can be derived from the hexadecimal representation.) Showing the numbers in traditional format (non-negative digits) fails for fractions ending with a run of zeros. However the internal representation with negative digits can always be shown and is probably more useful for further processing. An interface for the numeric type hierarchy of the NumericPrelude project is provided.<br />
:It features<br />
:* basis conversion<br />
:* basic arithmetic: addition, subtraction, multiplication, division<br />
:* algebraic arithmetic: square root, other roots (no general polynomial roots)<br />
:* transcendental arithmetic: pi, exponential, logarithm, trigonometric and inverse trigonometric functions<br />
<br />
=== Type class hierarchies ===<br />
<br />
There are several approaches to improve the [[Mathematical prelude discussion|numeric type class hierarchy]].<br />
<br />
;Dylan Thurston and Henning Thielemann's [[Numeric Prelude]]<br />
:Experimental revised framework for numeric type classes. Needs hiding of Prelude, overriding hidden functions like fromInteger and multi-parameter type classes. Probably restricted to GHC.<br />
<br />
;Jerzy Karczmarczuk's [http://www.haskell.org/pipermail/haskell-cafe/2001-February/001510.html approach]<br />
<br />
;Serge D. Mechveliani's [ftp://ftp.botik.ru/pub/local/Mechveliani/basAlgPropos/ Basic Algebra proposal]<br />
<br />
;Andrew Frank's [http://www.haskell.org/pipermail/haskell-cafe/2006-April/015326.html approach]<br />
:The proposal: ftp://ftp.geoinfo.tuwien.ac.at/frank/numbersPrelude_v1.pdf<br />
<br />
;Haskell Prime: [http://prime.haskell.org/ticket/112 Ongoing efforts for the language revision]<br />
<br />
=== Discrete mathematics ===<br />
<br />
;[http://andrew.bromage.org/darcs/numbertheory/ Number Theory Library]<br />
:Andrew Bromage's Haskell number theory library, providing operations on primes, fibonacci sequences and combinatorics.<br />
<br />
;[http://users.skynet.be/jyp/HGAL/ HGAL]<br />
:An haskell implementation of Brendan McKay's algorithm for graph canonic labeling and automorphism group. (aka Nauty)<br />
<br />
;[http://www.cambridge.org/uk/catalogue/catalogue.asp?isbn=0521849306 Computational Oriented Matroids]<br />
:is a book by [http://wwwopt.mathematik.tu-darmstadt.de/~bokowski/ Jürgen G. Bokowski], where he develops Haskell code for Matroid computations.<br />
<br />
See also [[Libraries and tools/Cryptography]]<br />
<br />
=== Computer Algebra ===<br />
<br />
<!-- Older link: http://haskell.org/docon/ --><br />
; [http://homepages.inf.ed.ac.uk/wadler/realworld/docon2.html DoCon], the Algebraic Domain Constructor<br />
: A library by Sergey D. Mechveliani for Algebra, turns GHCi into a kind of Computer Algebra System<br />
<br />
;[http://www.info.unicaen.fr/~karczma/arpap/ Papers by Jerzy Karczmarczuk]<br />
:Some interesting uses of Haskell in mathematics, including [[functional differentiation]], power series, continued fractions.<br />
<br />
;[http://www.robtougher.com/HCAS/ HCAS] by Rob Tougher.<br />
<br />
=== Statistics ===<br />
;[http://hackage.haskell.org/package/hstats hstats]<br />
: Statistical Computing with Haskell<br />
<br />
;[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hmatrix-gsl-stats hmatrix-gsl-stats]<br />
: A binding to the statistics portion of GSL. Works with hmatrix<br />
<br />
;[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hstatistics hstatistics]<br />
: A library for doing statistics. Works with hmatrix<br />
<br />
=== Plotting ===<br />
<br />
;[http://hackage.haskell.org/package/easyplot easyplot]<br />
: Simple and easy wrapper to gnuplot.<br />
<br />
;[[Gnuplot]]<br />
: Simple wrapper to gnuplot<br />
<br />
;[http://hackage.haskell.org/packages/archive/hmatrix/latest/doc/html/Graphics-Plot.html hmatrix]<br />
: contains a deprecated gnuplot wrapper<br />
<br />
;[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Chart Chart]<br />
: A library for generating 2D Charts and Plots, based upon the cairo graphics library.<br />
<br />
;[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/plot plot]<br />
: A library for generating figures, based upon the cairo graphics libary with<br />
a simple, monadic interface.<br />
<br />
;[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/probability probability]<br />
: the module Numeric.Probability.Visualize contains a wrapper to [http://www.r-project.org/ R]<br />
<br />
;[https://github.com/abarbu/matplotlib-haskell matplotlib-haskell]<br />
: Haskell bindings for Python's Matplotlib<br />
<br />
;[https://github.com/ocramz/bokeh-hs bokeh-hs]<br />
: Haskell bindings for Bokeh<br />
<br />
=== Numerical optimization ===<br />
This classification is somewhat arbitrary. Something more systematic like GAMS might be helpful.<br />
<br />
==== bindings ====<br />
;[http://repetae.net/john/recent/out/HsASA.html Adaptive Simulated Annealing]<br />
:A Haskell interface to Lester Ingber's adaptive simulating annealing code.<br />
<br />
;[http://hackage.haskell.org/package/cmaes CMA-ES]<br />
:A wrapper for Covariance Matrix Adaptation Evolution Strategy<br />
<br />
;[https://github.com/ghorn/nlopt-haskell nlopt-haskell]<br />
:A low-level binding to the nlopt library<br />
<br />
;[http://hackage.haskell.org/package/ipopt-hs ipopt-hs]<br />
:A haskell binding to ipopt including automatic differentiation<br />
<br />
;[http://hackage.haskell.org/package/glpk-hs glpk-hs]<br />
:A high-level interface to GLPK's linear programming and mixed integer programming features.<br />
<br />
==== pure haskell ====<br />
;[http://hackage.haskell.org/package/nonlinear-optimization nonlinear-optimization]<br />
:A pure-haskell CG_DESCENT method is implemented<br />
<br />
=== Miscellaneous libraries ===<br />
<br />
;[http://www.robtougher.com/HaskellMath/ HaskellMath]<br />
:The HaskellMath library is a sandbox for experimenting with mathematics algorithms. So far I've implemented a few quantitative finance models (Black Scholes, Binomial Trees, etc) and basic linear algebra functions. Next I might work on either computer algebra or linear programming. All comments welcome!<br />
<br />
;[http://hackage.haskell.org/package/HaskellForMaths HaskellForMaths]<br />
:David Amos' library for combinatorics, group theory, commutative algebra and non-commutative algebra, which is described in an [http://haskellformaths.blogspot.com/ accompanying blog].<br />
<br />
;[http://darcs.haskell.org/htam/ Various math stuff by Henning Thielemann]<br />
:This is some unsorted mathematical stuff including: gnuplot wrapper (now maintained as separate package), portable grey map (PGM) image reader and writer, simplest numerical integration, differentiation, zero finding, interpolation, solution of differential equations, combinatorics, some solutions of math riddles, computation of fractal dimensions of iterated function systems (IFS)<br />
<br />
;[[Numeric Quest]]<br />
:Jan Skibinski wrote a collection of Haskell modules that are useful for Mathematics in general, and Quantum Mechanics in particular.<br />
<br />
:Some of the modules are hosted on [http://darcs.haskell.org/numeric-quest/ haskell.org]. They include modules for:<br />
:* Rational numbers with transcendental functions<br />
:* Roots of polynomials<br />
:* Eigensystems<br />
:* Tensors<br />
:* Dirac quantum mechanics<br />
<br />
:Other modules in Numeric Quest are currently only available via the [http://web.archive.org/web/20010605003250/http://www.numeric-quest.com/haskell/ Internet Archive]. They include, among many other things:<br />
:* [http://web.archive.org/web/*/http://www.numeric-quest.com/haskell/ State vector evolution]<br />
:* [http://web.archive.org/web/*/http://www.numeric-quest.com/haskell/ Short study of fuzzy oscillator]<br />
<br />
:See the [[Numeric Quest]] page for more information.<br />
<br />
;[http://www.dinkla.net/fp/cglib.html Geometric Algorithms]<br />
:A small Haskell library, containing algorithms for two-dimensional convex hulls, triangulations of polygons, Voronoi-diagrams and Delaunay-triangulations, the QEDS data structure, kd-trees and range-trees.<br />
<br />
;[http://home.solcon.nl/mklooster/repos/hmm/ Hmm: Haskell Metamath]<br />
:Hmm is a small Haskell library to parse and verify Metamath databases.<br />
<br />
;[[Probabilistic Functional Programming]]<br />
:The PFP library is a collection of modules for Haskell that facilitates probabilistic functional programming, that is, programming with stochastic values. The probabilistic functional programming approach is based on a data type for representing distributions. A distribution represent the outcome of a probabilistic event as a collection of all possible values, tagged with their likelihood. A nice aspect of this system is that simulations can be specified independently from their method of execution. That is, we can either fully simulate or randomize any simulation without altering the code which defines it.<br />
<br />
;[[Sinc function]]<br />
<br />
;[[Gamma and Beta function]]<br />
<br />
;[http://repetae.net/john/recent/out/Boolean.html Boolean]<br />
:A general boolean algebra class and some instances for Haskell.<br />
<br />
;[http://darcs.haskell.org/~lemmih/hode/ HODE]<br />
:HODE is a binding to the Open Dynamics Engine. ODE is an open source, high performance library for simulating rigid body dynamics.<br />
<br />
;[http://sourceforge.net/projects/ranged-sets Ranged Sets]<br />
:A ranged set is a list of non-overlapping ranges. The ranges have upper and lower boundaries, and a boundary divides the base type into values above and below. No value can ever sit on a boundary. So you can have the set <math>(2.0, 3.0] \cup (5.3, 6)</math>.<br />
<br />
;[http://code.google.com/p/hhydra/ hhydra]<br />
:Hhydra is a tool to compute Goodstein successions and hydra puzzles described by Bernard Hodgson in his article 'Herculean or Sisyphean tasks?' published in No 51 March 2004 of the Newsletter of the European Mathematical Society.<br />
<br />
[[Category:Mathematics|*]]<br />
{{LibrariesPage}}</div>Ysangkokhttps://wiki.haskell.org/index.php?title=Haskell_programming_tips/Discussion&diff=62875Haskell programming tips/Discussion2019-04-04T19:45:28Z<p>Ysangkok: fix prime wiki link</p>
<hr />
<div>== About ==<br />
This page is meant for discussions about ThingsToAvoid, as consensus seems to be difficult to reach, and it'd be nice if newbies wouldn't bump into all kinds of Holy Wars during their first day of using Haskell ;)<br />
<br />
You may want to add your name to your comments to make it easier to refer to your words and ridicule you in public.<br />
<br />
== Other Suggestions ==<br />
This article is about elegance, so could we please inject some elegance into the article itself? Why do many of the functions have no type declaration? It took me quite some time to figure out the type declaration on foreach2: Monad m => [a] -> [b] -> (a -> b -> m c) -> m ()<br />
<br />
These functions should actually be tested. The way linify is currently defined, it produces 4 GHC warnings. I do not even know how to get rid of 2 of them.<br />
<br />
Readability could be considerably improved. At the moment, many sections start out fine, but then they suffer from a long list of additions which have not been properly integrated, so it reads something like this: Do this. Oh, but there is this too, and there is this caveat, but you could also do this, and performance is sometimes better if you do this, ...<br />
<br />
May I also suggest that periods be left off the end of a sentence whose last word is a code section? Currently, the article is formatted such that I have this: Words words words, see my code here:<br /><br />
\n<br /><br />
[ Code section<br /><br />
Code section<br /><br />
Code section]<br /><br />
\n<br /><br />
.<br /><br />
\n<br />
<br />
That is ridiculous. Just remove the period and the entailing massive whitespace.<br />
<br />
== Flame Away ==<br />
<br />
=== Avoid recursion ===<br />
<br />
Many times explicit recursion is the fastest way to implement a loop.<br />
e.g.<br />
<haskell><br />
loop 0 _ acc = acc<br />
loop i v acc = ...<br />
</haskell><br />
<br />
Using HOFs is more elegant, but makes it harder to reason about space usage,<br />
also explicit recursion does not make the code hard to read - just explicit<br />
about what it is doing.<br />
<br />
-- EinarKarttunen<br />
<br />
I disagree with this. Sometimes explicit recursion is simpler to design, but I don't see how it makes space usage any easier to reason about and can see how it makes it harder. By using combinators you only have to know the properties of the combinator to know how it behaves, whereas I have to reanalyze each explicitly implemented function. StackOverflow gives a good example of this for stack usage and folds. As far as being "faster" I have no idea what the basis for that is; most likely GHC would inline into the recursive version anyways, and using higher-order list combinators makes deforesting easier. At any rate, if using combinators makes it easier to correctly implement the function, then that should be the overriding concern.<br />
<br />
-- DerekElkins<br />
<br />
----<br />
I read lots of code with recursion -- and it was hard to read, because it is hard to retrieve the data flow from it. -- HenningThielemann<br />
<br />
----<br />
IMO explicit recursion usually ''does'' make code harder to read, as it's trying to do two things at once: Recursing and performing the actual work it's supposed to do. Phrases like OnceAndOnlyOnce and SeparationOfConcerns come to the mind.<br />
However, the concern about efficiency is (partly) justified. HOFs defined for certain recursion patterns often need additional care to achieve the same performance as functions using explicit recursion. As an example, in the following code, two sum functions are defined using two equivalent left folds, but only one of the folds is exported. Due to various peculiarities of GHCs strictness analyzer, simplifier etc, the call from main to mysum_2 works, yet the call to mysum_1 fails with a stack-overflow.<br />
<haskell><br />
module Foo (myfoldl_1, mysum_1, mysum_2) where<br />
<br />
-- exported<br />
myfoldl_1 f z xs = fold z xs<br />
where<br />
fold z [] = z<br />
fold z (x:xs) = fold (f z x) xs<br />
<br />
-- not exported<br />
myfoldl_2 f z xs = fold z xs<br />
where<br />
fold z [] = z<br />
fold z (x:xs) = fold (f z x) xs<br />
<br />
mysum_1 = myfoldl_1 (+) 0<br />
mysum_2 = myfoldl_2 (+) 0<br />
</haskell><br />
<haskell><br />
module Main where<br />
<br />
import Foo<br />
<br />
xs = [1..1000*1000]<br />
<br />
main = do<br />
print (mysum_2 xs)<br />
print (mysum_1 xs)<br />
</haskell><br />
(Results might differ for your particular GHC version, of course...)<br />
-- RemiTurk<br />
<br />
GHC made "broken" code work. As covered in StackOverflow, foldl is simply not tail-recursive in a non-strict language. Writing out mysum would still be broken. The problem here isn't the use of a HOF, but simply the use of non-tail-recursive function. The only "care" needed here is not relying on compiler optimizations (the code doesn't work in my version of GHC) or the care needed when relying on compiler optimizations. Heck, the potential failure of inlining (and subsequent optimizations following from it) could be handled by restating recursion combinator definitions in each module that uses them; this would still be better than explicit recursion which essentially restates the definition for each expression that uses it.<br />
<br />
-- DerekElkins<br />
<br />
Here is a demonstration of the problem - with the classic sum as the problem.<br />
Of course microbenchmarking has little sense, but it tells<br />
us a little bit which combinator should be used.<br />
<br />
<haskell><br />
import Data.List<br />
import System<br />
<br />
sum' :: Int -> Int -> Int<br />
<br />
sum' 0 n = sum [1..n]<br />
sum' 1 n = foldl (\a e -> a+e) 0 [1..n]<br />
sum' 2 n = foldl (\a e -> let v = a+e in v `seq` v) 0 [1..n]<br />
sum' 3 n = foldr (\a e -> a+e) 0 [1..n]<br />
sum' 4 n = foldr (\a e -> let v = a+e in v `seq` v) 0 [1..n]<br />
sum' 5 n = foldl' (\a e -> a+e) 0 [1..n]<br />
sum' 6 n = foldl' (\a e -> let v = a+e in v `seq` v) 0 [1..n]<br />
sum' 7 n = loop n 0<br />
where loop 0 acc = acc<br />
loop n acc = loop (n-1) (n+acc)<br />
sum' 8 n = loop n 0<br />
where loop 0 acc = acc<br />
loop n acc = loop (n-1) $! n+acc<br />
<br />
<br />
main = do [v,n] <- getArgs<br />
print $ sum' (read v) (read n)<br />
</haskell><br />
<br />
When executing with n = 1000000 it produces the following results:<br />
* seq does not affect performance - as excepted.<br />
* foldr overflows stack - as excepted.<br />
* explicit loop takes 0.006s<br />
* foldl takes 0.040s<br />
* foldl' takes 0.080s<br />
<br />
In this case the "correct" choice would be foldl' - ten times slower than explicit recursion.<br />
This is not to say that using a fold would not be better for most code. Just that it can<br />
have subtle evil effects in inner loops.<br />
<br />
-- EinarKarttunen<br />
<br />
This is ridiculous. The "explicit recursion" version is not the explicit recursion version of the foldl' version. Here is another set of programs and the results I get:<br />
<haskell><br />
import Data.List<br />
import System<br />
<br />
paraNat :: (Int -> a -> a) -> a -> Int -> a<br />
paraNat s = fold<br />
where fold z 0 = z<br />
fold z n = (fold $! s n z) (n-1)<br />
<br />
localFoldl' c = fold<br />
where fold n [] = n<br />
fold n (x:xs) = (fold $! c n x) xs<br />
<br />
sumFoldl' :: Int -> Int<br />
sumFoldl' n = foldl' (+) 0 [1..n]<br />
<br />
sumLocalFoldl' :: Int -> Int<br />
sumLocalFoldl' n = localFoldl' (+) 0 [1..n]<br />
<br />
sumParaNat :: Int -> Int<br />
sumParaNat n = paraNat (+) 0 n<br />
<br />
sumRecursionNat :: Int -> Int<br />
sumRecursionNat n = loop n 0<br />
where loop 0 acc = acc<br />
loop n acc = loop (n-1) $! n+acc<br />
<br />
sumRecursionList :: Int -> Int<br />
sumRecursionList n = loop [1..n] 0<br />
where loop [] acc = acc<br />
loop (n:ns) acc = loop ns $! n+acc<br />
<br />
main = do<br />
[v,n] <- getArgs<br />
case v of<br />
"1" -> print (sumFoldl' (read n))<br />
"2" -> print (sumLocalFoldl' (read n))<br />
"3" -> print (sumParaNat (read n))<br />
"4" -> print (sumRecursionNat (read n))<br />
"5" -> print (sumRecursionList (read n))<br />
</haskell><br />
<br />
(best but typical real times according to time of a few trials each)<br />
<haskell><br />
sumFoldl' takes 2.872s<br />
sumLocalFoldl' takes 1.683s<br />
sumParaNat takes 0.212s<br />
sumRecursionNat takes 0.213s<br />
sumRecursionList takes 1.669s<br />
</haskell><br />
<br />
sumLocalFoldl' and sumRecursionList were practically identical in performance and sumParaNat and sumRecursionNat were practically identical in performance. All that's demonstrated is the cost of detouring through lists (and the cost of module boundaries I guess).<br />
<br />
-- DerekElkins<br />
<br />
=== n+k patterns ===<br />
<br />
n+k patterns are similar to the definition of infix functions,<br />
thus they make it harder to understand patterns.<br />
http://www.dcs.gla.ac.uk/mail-www/haskell/msg01131.html (Why I hate n+k)<br />
<br />
So far I have seen only one rule for Good Coding Practice in Haskell: Do Not<br />
Use n+k Patterns. I hope someone can give some directions, how to avoid known<br />
pitfalls (especially Space Leaks).<br />
-- On the haskell mailing list<br />
<br />
The most natural definition of many functions on the natural numbers is by induction, a fact that can very nicely be expressed with the (n+1)-pattern notation. Also, (n+k)-patterns are unlikely to produce space leaks, since if anything, they make the function stricter. The possible ambiguities don't seem to appear in real code.<br />
--ThomasJäger<br />
<br />
If natural numbers would be defined by PeanoNumbers then pattern matching on successors would be straightforward. This would be fairly slow and space consuming, that's why natural numbers are not implemented this way. They are implemented using binary numbers and it is not even tried to simulate the behaviour of <hask>Natural</hask> (e.g. laziness). Thus I wouldn't state, that <hask>3</hask> matches the pattern <hask>2+1</hask>. -- HenningThielemann<br />
<br />
Lazyness/Strictness isn't really an argument in this situation, since when using a strict natural type, e.g.<br />
<haskell><br />
data Nat = Zero | Succ !Nat<br />
</haskell><br />
pattern matching on Nat behaves exactly like n+1 patterns. -- ThomasJaeger<br />
<br />
n+k patterns also apply to negative numbers - don't they?<br />
Yes, I see the analogy but in the current implementation it's nothing than sugar.<br />
-- HenningThielemann<br />
<br />
No, they don't. `let f (n+2) = n in f 1` is a runtime error. -- DerekElkins<br />
<br />
But translating it into pattern matching is impossible, thus it must be a static error. -- HenningThielemann<br />
<br />
=== Use syntactic sugar wisely ===<br />
I have to say, i strongly disagree with most of what is said in this section. First of all the claim<br />
<br />
''Syntactic extensions make source code processors complicated and error prone. But they don't help to make programs safer (like type checks and contracts) or easier to maintain (like modularization and scoping).''<br />
<br />
is obviously wrong. There certainly are applications of syntatic sugar that make programs easier to read, therefore easier to understand, easier to maintain, and safer, as you are more likely to spot bugs.<br />
<br />
:My statement was: Don't use syntactic sugar by default because you believe it makes your program more readable automatically (I've read lots of code of programmers who seem to believe that), but use syntactic sugar '''if''' (and only if) it makes the program '''more''' readable. Syntactic sugar is only a matter of readability not of safety in the sense of scoping and type checking. If I accidentally introduce inconsistencies into my code, the name resolver or the type checker will report problems, but not the de-sugarizer. -- HenningThielemann<br />
<br />
ad. right sections are evil<br />
<br />
I can't believe someone is seriously advocating to replace <hask>(&$ x)</hask> with the less readable <hask>flip (&$) x</hask> just because that's the way one specific haskell implementation is reporting errors. Most of the time, I don't even care to read type errors because once I know which line the error occured in, it is usually immediately clear what the error was. Even if you have to read the error message, there should be no difficulty to see that (+1) and flip (+) 1 is the same thing, especially when used in a context.<br />
<br />
:Nobody advocated for replacing <hask>($ x)</hask> by <hask>flip ($) x</hask> this was just to demonstrate the problems arising with syntactic sugar. I believe that many people don't take that into account when requesting more sugar (such as parallel list comprehension). -- HenningThielemann<br />
<br />
''Infix notation is problematic for both human readers and source code formatters.''<br />
<br />
No, infix notation isn't problematic for human readers, it enables them to read the code faster in many cases.<br />
<br />
:... if he knows the precedences, which is only true for (some) of the predefined operators. I guess you don't know all of the precedences of the Prelude operators. I also use infix operations like (+) and (:) but I'm very concerned with introducing lots of new operator symbols and `f` notation. -- HenningThielemann<br />
<br />
:Introducing new operators should definitely not be done careless (then again, one shouldn't be careless in programming anyway), and operator percedences might be better defined as a partial order. (e.g. there is an order between (+) and (*), and between (&&) and (||), but not between (+) and (&&)). Other proposals for replacing the current left/right associative + precedence system do exist. However, doing away with infix operators entirely appears to me to practically render combinator libraries unusable, which would make Haskell a lot less attractive. -- RemiTurk<br />
<br />
:The nice thing about precedences in Haskell is that it's often not necessary to know them exactly in order<br />
to use them. If the types of you operators are sufficiently general, or sufficiently distinct, only the sight way to parse them will lead to type-checking code, so you can just give it a shot without parenthesis and hopefully remember the precedence the next time you're in a similar situation. -- ThomasJaeger<br />
<br />
<hask>(+1) `fmap` m</hask> expresses that the <hask>fmap</hask> is just a fancy function application, when writing interpreter-like code <hask>Var "f" `App` Var "x" `App` "y"</hask> is certainly more readable and can be written much faster than <hask>App (App (Var "f") (Var "x")) (Var "y"))</hask> and our brains have been trained to parse + and * with different precendences since elementary school.<br />
<br />
:If you make it for readability, I agree, if you make it for fancyness, I disagree. In the case of <hask>App</hask> it looks like the list can become longer, so it's worth of thinking about using <hask>foldl</hask>, <hask>App</hask> and a list - though then I would certainly also use some syntactic sugar to enter the list <hask>["f", "x", "y"]</hask>. Btw. even the regular list notation is disputable since in the infix notation <hask>("f":"x":"y":[])</hask> it is easier move elements around. So I end up with infix notation, ok. Even more, <hask>foldl</hask> shows clearly the left associativity, whereas <hask>`App`</hask> does not.<br />
:In the case of <hask>`on`</hask> and <hask>compose2</hask>, I disagree. <hask>on</hask> is less informative than <hask>compose2</hask>. And yes, <hask>compose2</hask> is a kind of generalization of <hask>.</hask>, though it is not the most popular one. -- HenningThielemann<br />
<br />
:You do indeed have a point there: it's indeed ''an'' extension of <hask>(.)</hask>, which I incorrectly denied. However, as it's not ''the'' extension, and AFAIK not even ''the most used'' extension, I consider the name <hask>compose2</hask> to be slightly misleading. In addition, I think "group by equality on isAlpha" (<hask>groupBy ((==) `on` isAlpha)</hask>) is just too cute too resist. -- RemiTurk<br />
<br />
::So, do you do it for readability or for fanciness? I find an infix function application hard to read, since it looks like just another argument. That is, <hask>((==) `on` isAlpha)</hask> reads very similar to <hask>((==) on isAlpha)</hask>. In your example you really switch the prefered usage of the identifiers, you use the infix symbol <hask>==</hask> in prefix notation and the prefix function name <hask>on</hask> in infix notation. -- HenningThielemann<br />
<br />
::Any kind of syntax highlighting should make the difference between <hask>((==) `on` isAlpha)</hask> and <hask>((==) on isAlpha)</hask> obvious. Another argument for using an infix <hask>on</hask> here is that it explains the order of the elements: Deciding if <hask>on (==) isAlpha</hask> or <hask>on isAlpha (==)</hask> is better and trying to remember which way the implementor choose is certainly more difficult than realizing that <hask>isAlpha `on` (==)</hask> makes no sense (There are better examples for this such as <hask>`elem`</hask>, or think about the confusion between the order of arguments in <hask>Data.FiniteMap</hask> vs. <hask>Data.Map</hask>). -- ThomasJaeger<br />
<br />
:::Btw. the function <hask>comparing</hask> has found its way to the module <hask>Data.Ord</hask> (http://www.haskell.org/ghc/dist/current/docs/libraries/base/Data-Ord.html). It is a composition of <hask>compare</hask> and <hask>on</hask>/<hask>compose2</hask>. However it does not satisfyingly help to implement extensions of <hask>*By</hask> functions, because the key for sorting/grouping/maximising must be re-computed for each comparison if you write, say <hask>sortBy (comparing length)</hask>. -- HenningThielemann<br />
<br />
:Of course, <hask>foldl App</hask> only works if <hask>App</hask> models application in an untyped language. Using GADTs, <hask>App</hask> could be of type <hask>Expr (a -> b) -> Expr a -> Expr b</hask>, also, many combinator that works on different types can't be "sugared" using functions. -- ThomasJaeger<br />
<br />
<br />
Finally, there is no reason why one should expect a tool that processes haskell code not to be aware of Haskell 98's syntax. All mentioned syntactic extensions (list comprehension, guards, sections, infix stuff) fall under this category and can be used without any bad conscience.<br />
<br />
Sorry for having become so "religous" -- ThomasJaeger<br />
<br />
<br />
I agree. -- CaleGibbard<br />
<br />
<br />
:If you want a good example for unnecessary sugar, take this one:<br />
<haskell><br />
tuples :: Int -> [a] -> [[a]]<br />
tuples 0 _ = return []<br />
tuples (r+1) xs = do<br />
y:ys <- tails xs<br />
(y:) `fmap` tuples r ys<br />
</haskell><br />
:Why is infix <hask>`fmap`</hask> more readable than prefix <hask>fmap</hask>? Where is the analogy to <hask>map</hask>? Why don't you use <hask>map</hask> at all? I see <hask>map</hask> as an operator which lifts scalar functions to list functions, this is perfectly expressed by prefix notation. What is the readability benefit of <hask>(r+1)</hask> pattern and why is <hask>do</hask> more readable than explicit <hask>init (tails xs) >>= (\(y:ys) -> map (y:) (tuples (r-1) ys))</hask> here? ('''Mostly because this is not the correct translation and the correct translation ''is'' unreadable -- DerekElkins''') It's even worse than <hask>[(y:) `fmap` tuples r ys | (y:ys) <- tails xs]</hask>. You rewrote my code just with sugar but the structure which must be understood remained the same. Sorry, I don't find it easier to understand. Maybe people who believe a common notation rather than to try to understand the meaning are happy with the sugar. -- HenningThielemann<br />
<br />
:''The pattern <hask>m >>= \x -> f x</hask> is exactly the reason the do-notation was introduced, so each time I write something like this, I replace it with a do notation for the following reason: It is definitely the more common style (nobody is using <hask>m >>= \x -> \n</hask>-style these days), so much more likely to be understood faster (at least for myself), the do notation expresses nicely that monadic (in this case notdeterminstic) effects are taking place, and finally it is much easier to make changes to the code if it's in do-form (e.g. add additional guards). Of course you CAN do the same changes in <hask>>>=</hask>-style, too, after all there is a straightforward translation (although complicated by the fact that you have to check if pattern matchings are exhaustive), but I'm not the kind of guy who does all kinds of verbose translation in his head just because he wants to stay away from syntactic sugar.<br />
<br />
::I disagree with arguments like "nobody is using ...". What does it tell about the quality of a technique? I write here to give reasons against too much syntactic sugar rather than to record today's habits of some programmers. -- HenningThielemann<br />
<br />
:You are further critizing that I am using <hask>fmap</hask> instead of the more special <hask>map</hask>. I find it natural to use <hask>fmap</hask> in monadic code to abstract from lists. If it weren't for <hask>tails</hask>, the code would even have type <hask>(MonadPlus m, Functor m) => Int -> [a] -> m [a]</hask>, increasing usability. <hask>liftM</hask> would also be acceptable (and for some strange reason even slightly faster), but it feels awfully wrong to me to use <hask>liftM</hask>, so that I'm willing to live with additional <hask>Functor</hask> constraints. This is also the reason while your list comprehension solution is clearly inferior to a monadic one.<br />
<br />
:One more thing about pattern match failure vs. <hask>init</hask>. Though it doesn't matter match in this simple example, the version exploiting pattern match failure is closer to the conceptional algorithm, because it doesn't rely on the "low-level-property" of <hask>tails</hask> that the empty list is the last element of the returned list (I can never remember this kind of things, even though one of the possible behaviors makes much more sense).<br />
<br />
:The function <hask>tuples</hask> is defined by recursion on an Int and only uses the case of the predecessor, so this is a classical example for (n+1)-patterns. Note that the LHSs in your implementation are overlapped, so a reader might need more time to figure out what is going on in your implementation (I admit the effect is small, but this is a very tiny example).<br />
<br />
:Using <hask>fmap</hask> infix is a personal habit of mine, but when you think about it, it makes a lot of sense. As we can't overload a space, it's the closest thing to application syntax we can get. I know you prefer <hask>App (App f x) y</hask>-style, which seems more difficult to understand for most people. This just is a matter of personal style. Please do not mistake your own personal style for the only sensible one.<br />
<br />
:If no one else objects, I'd like to put my implementation back on the main page, possibly with a less controversial comment. --ThomasJaeger''<br />
<br />
::My argument is that the syntactic sugared version may be readable ''like'' the unsugared version, but it does not ''improve'' the readability, thus it should be avoided. Sugar shouldn't be the default, it shouldn't used just because it exists. That's the basic opinion where we disagree. Btw. I find the <hask>do</hask> notation in connection with the <hask>List</hask> monad very confusing because it looks imperative and it suggests that first something is chosen from the list then it is returned. -- HenningThielemann<br />
<br />
::While it may not be more readable for you, it is for me, for the reasons I'm getting tired of stating. Also, your opinions on the do-notation seem very strange to me. If we have monads - a way to unify different notions of effects - why make the artificial distinction between IO/State effects and more general ones again? The do-notation expresses in which order the effects are happening - that's the same for a list and an IO monad. However, a distinction between commutative and non-commutative monads would make sense, but unfortunately, there's no way to prove the commutativity of a monad statically in Haskell.<br />
<br />
There are still issues that aren't implemented in GHC which belong to the Haskell 98 standard and which are of more importance, I think, such as mutual recursive modules and some special case of polymorphic mutual function recursion. So I don't vote for wasting the time with syntactic sugar when real enhancements are deferred by it. If I would write a Haskell code processor I would certainly prevent me from the trouble of supporting guards and (n+k) patterns. I'm also fed up with the similar situation in HTML with its tons of extensions and the buggy code which is accepted by most browsers (which is also a sort of inofficial extension) - there is simply no fun in processing HTML code. Not to mention C++.<br />
<br />
By the way I'd like to have a real function <hask>if</hask> instead of the sugarized version with <hask>then</hask> and <hask>else</hask> in Haskell 98. Then I could use it in connection with <hask>zipWith3</hask>. See ["Case"] for another application. -- HenningThielemann<br />
<br />
: Agrees with that. I'm not using <hask>if</hask> all that often, and could easily add a few braces. And, it would free <hask>then</hask> and <hask>else</hask> for normal identifier use. -- RemiTurk<br />
<br />
Personally, I like the explicit `then` and `else` and find that they help when reading code to separate where the break is between the sections. It's not that I necessarily disagree with the inclusion of such a function, it is an easy one to write in any case, but I think that some sugar in the form of a few extra words to mark important points in common structures is useful. Human languages have many such words, and their presence makes reading or listening much easier. - CaleGibbard<br />
<br />
: Other people seem to have problems with this special syntax, too. And they propose even more special syntax to solve the problem. http://prime.haskell.org/wiki/DoAndIfThenElse -- HenningThielemann</div>Ysangkokhttps://wiki.haskell.org/index.php?title=Language_extensions&diff=62874Language extensions2019-04-04T19:42:54Z<p>Ysangkok: don't link to gitlab version of docs (it is a development version)</p>
<hr />
<div>Language extensions are used to enable language features in Haskell that may seem useful in certain cases. They can be used to loosen restrictions in the type system or add completely new language constructs to Haskell.<br />
<br />
They can be enabled using the [http://www.haskell.org/ghc/docs/7.0.4/html/users_guide/pragmas.html#language-pragma LANGUAGE pragma] <br />
<br />
<hask><br />
{-# LANGUAGE <Extension>, <Extension> #-}<br />
</hask> <br />
<br />
or (in GHC) using [https://downloads.haskell.org/ghc/latest/docs/html/users_guide/lang.html flags] <code>-X<Extension></code>. <br />
<br />
Before just using the language extension that fits your need, [[Use of language extensions|think about<br />
when it is useful]] and what risk it may bring to your program.<br />
<br />
== List of language extensions by name ==<br />
<br />
This list is far from complete and needs extension.<br />
<br />
* [[Datatype contexts|DatatypeContexts]] : Add type constraints to your datatype.<br />
* [[Default signatures|DefaultSignatures]]<br />
* Derive:<br />
** [http://www.haskell.org/ghc/docs/latest/html/users_guide/deriving.html#deriving-typeable DeriveDataTypeable]<br />
** [http://www.haskell.org/ghc/docs/latest/html/users_guide/deriving.html#deriving-typeable DeriveGeneric]<br />
** [http://www.haskell.org/ghc/docs/latest/html/users_guide/deriving.html#deriving-typeable DeriveFunctor]<br />
** [http://www.haskell.org/ghc/docs/latest/html/users_guide/deriving.html#deriving-typeable DeriveFoldable]<br />
** [http://www.haskell.org/ghc/docs/latest/html/users_guide/deriving.html#deriving-typeable DeriveTraversable]<br />
** [http://www.haskell.org/ghc/docs/latest/html/users_guide/deriving.html#id616911 GeneralizedNewtypeDeriving]<br />
* [https://downloads.haskell.org/ghc/latest/docs/html/users_guide/glasgow_exts.html#duplicate-record-fields DuplicateRecordFields] (GHC 8.0.1+) : Allow definition of record types with identically-named fields.<br />
* [[Existential type|ExistentialQuantification]]<br />
* [[Flexible contexts|FlexibleContexts]]<br />
* [[Flexiblae instances|FlexibleInstances]] : Allow a type parameter to occure twice within a type class instance.<br />
* [[Functional dependencies|FunctionalDependencies]] : Are used to constrain the parameters of type classes.<br />
* [[GADT]]s : Generalised algebraic datatypes - A more general approach to algebraic datatypes.<br />
* [[Implicit parameters|ImplicitParams]]<br />
* [[KindSignatures]]<br />
* [[Multi-parameter type class|MultiParamTypeClasses]] : Enable multiple type parameters in type classes.<br />
* [[Monomorphism restriction|NoMonomorphismRestriction]]<br />
* [[Overlapping instance|OverlappingInstances]]<br />
* [[Rank-N types|Rank2Types]]<br />
* [[Rank-N types|RankNTypes]]<br />
* [[Scoped type variables|ScopedTypeVariables]]<br />
* [[Template Haskell|TemplateHaskell]]<br />
* [http://www.haskell.org/ghc/docs/latest/html/users_guide/syntax-extns.html#tuple-sections TupleSections] : Allow tuples to be partially applied.<br />
* [[GHC/Type families|TypeFamilies]]<br />
* [[Undecidable instance|UndecidableInstances]]<br />
* [http://www.haskell.org/ghc/docs/latest/html/users_guide/syntax-extns.html#view-patterns ViewPatterns]<br />
<br />
= See also =<br />
<br />
* [[Use of language extensions]]<br />
<br />
<br />
[[Category:Language extensions]]</div>Ysangkokhttps://wiki.haskell.org/index.php?title=Name_clashes_in_record_fields&diff=62873Name clashes in record fields2019-04-04T19:41:51Z<p>Ysangkok: link to latest released user guide, not master</p>
<hr />
<div>== Question ==<br />
<code> error| Multiple declarations of ‘xxx’ </code><br />
<br />
I like to define:<br />
<haskell><br />
data Human = Human {name :: String}<br />
data Dog = Dog {name :: String}<br />
</haskell><br />
<br />
Why is this forbidden? <br />
<br />
I like to define:<br />
<haskell><br />
data Human = Human {name :: String}<br />
<br />
name :: Cat -> String<br />
name = ...<br />
</haskell><br />
Why is this forbidden, too?<br />
<br />
== Answer ==<br />
<br />
The record field accessors <hask>name</hask> are just functions<br />
that retrieve the field's value from a particular record.<br />
They are in the global scope together with top-level functions<br />
and thus cannot have the same name.<br />
For resolving this you may:<br />
* rename the accessor or the top-level function<br />
* put the data declaration or the top-level function in another module and [[Qualified names|import qualified]]<br />
* write a typeclass with a <hask>name</hask> function and fit the non-accessor function <hask>name</hask> somehow into that.<br />
<br />
=== Using [[language extension]] ===<br />
<br />
<code>[https://downloads.haskell.org/ghc/latest/docs/html/users_guide/glasgow_exts.html#duplicate-record-fields DuplicateRecordFields]</code> extension (GHC 8.0.1+) allow definition of record types with identically-named fields.<br />
<br />
== See also ==<br />
<br />
* [http://prime.haskell.org/wiki/TypeDirectedNameResolution Type directed name resolution]<br />
* Haskell-Cafe on [http://www.haskell.org/pipermail/haskell-cafe/2010-December/087859.html Record types and unique names]<br />
<br />
[[Category:FAQ]]</div>Ysangkokhttps://wiki.haskell.org/index.php?title=Foreign_Function_Interface&diff=62872Foreign Function Interface2019-04-04T19:40:54Z<p>Ysangkok: do not link gitlab docs, link to latest version on downloads.haskell.org</p>
<hr />
<div>[[Category:FFI]]<br />
<br />
== Introduction ==<br />
<br />
The Foreign Function Interface (FFI) allows Haskell programs to cooperate with programs written with other languages. Haskell programs can call foreign functions and foreign functions can call Haskell code.<br />
<br />
Compared to many other languages, Haskell FFI is very easy to use: in the most common case, you only have to translate the prototype of the foreign function into the equivalent Haskell prototype and you're done. For instance, to call the exponential function ("exp") of the libc, you only have to translate its prototype:<br />
<br />
<source lang="c"><br />
double exp(double);<br />
</source><br />
<br />
into the following Haskell code<br />
<br />
<haskell><br />
foreign import ccall "exp" c_exp :: Double -> Double<br />
</haskell><br />
<br />
Now you can use the function "c_exp" just like any other Haskell function. When evaluated, it will call "exp".<br />
<br />
Similarly, to export the following Haskell function:<br />
<br />
<haskell><br />
triple :: Int -> Int<br />
triple x = 3*x<br />
</haskell><br />
<br />
so that it can be used in foreign codes, you only have to write:<br />
<br />
<haskell><br />
foreign export ccall triple :: Int -> Int<br />
</haskell><br />
<br />
It can get at little more complicated depending on what you want to do, the function parameters, the foreign code you target, etc. This page is here to explain all of this to you.<br />
<br />
== Generalities ==<br />
<br />
=== FFI extension ===<br />
<br />
The Foreign Function Interface (FFI) is an extension to the Haskell standard. To use it, you need to enable it with the following compiler pragma at the beginning of your source file:<br />
<br />
<haskell><br />
{-# LANGUAGE ForeignFunctionInterface #-}<br />
</haskell><br />
<br />
=== Calling conventions ===<br />
<br />
When a program (in any language) is compiled into machine code, functions and procedures become labels: a label is a symbol (a string) associated to a position into the machine code. Calling a function only consists in putting parameters at appropriate places into memory and registers and then branching at the label position. The caller needs to know where to store parameters and the callee needs to know where to retrieve parameters from: there is a '''calling convention'''.<br />
<br />
To interact with foreign code, you need to know the calling conventions that are used by the other language implementation on the given architecture. It can also depend on the operating system.<br />
<br />
GHC supports standard calling conventions with the FFI: it can generate code to convert between its internal (non-standard) convention and the foreign one. If we consider the previous example:<br />
<br />
<haskell><br />
foreign import ccall "exp" c_exp :: Double -> Double<br />
</haskell><br />
<br />
we see that the C calling convention ("ccall") is used. GHC will generate code to put (and to retrieve) parameters into memory and registers conforming to what is expected by a code generated with a C compiler (or any other compiler conforming to this convention).<br />
<br />
Other available conventions supported by GHC include "stdcall" (i.e. Pascal convention).<br />
<br />
=== Foreign types ===<br />
<br />
Calling conventions depend on parameter types. For instance, floating-point values (Double, Float) may be passed into floating-point registers. Several values can be combined into a single vector register. And so on. As an example, in http://www.x86-64.org/documentation/abi.pdf you can find the algorithm describing how to pass parameters to functions on Linux on a x86-64 architecture depending on the types of the parameters.<br />
<br />
Only some Haskell types can be directly used as parameters for foreign functions, because they correspond to basic types of low-level languages such as C and are used to define calling conventions.<br />
<br />
According to [https://hackage.haskell.org/package/base/docs/Foreign-Ptr.html#g:2], the type of a foreign function is a ''foreign type'', that is a function type with zero or more arguments where:<br />
* the argument types can be ''marshallable foreign types'', i.e. Char, Int, Double, Float, Bool, Int8, Int16, Int32, Int64, Word8, Word16, Word32, Word64, Ptr a, FunPtr a, StablePtr a or a renaming of any of these using newtype.<br />
* the return type is either a ''marshallable foreign type'' or has the form IO t where t is a marshallable foreign type or ().<br />
<br />
'''Warning''': GHC does not support passing structures as values yet.<br />
<br />
The [http://hackage.haskell.org/package/base/docs/Foreign-C-Types.html Foreign.C.Types] module contains renaming of some of these ''marshallable foreign types'' with names closer to those of C types (e.g. CLong, CShort).<br />
<br />
If the foreign function performs side-effects, you have to explicitly indicate it in its type (using IO). GHC has no other way to detect it.<br />
<br />
<haskell><br />
foreign import ccall "my_func" myFunc :: Int -> IO Double<br />
</haskell><br />
<br />
Data structures have to passed by reference (using pointers). We will see how to use them later in this document.<br />
<br />
=== Exported functions ===<br />
<br />
GHC can generate wrappers so that a foreign code can call Haskell code:<br />
<br />
<haskell><br />
triple :: Int -> Int<br />
triple x = 3*x<br />
<br />
foreign export ccall triple :: Int -> Int<br />
</haskell><br />
<br />
In the generated binary object, there will be a label "triple" that can be called from a language using the C convention.<br />
<br />
Note that to call a Haskell function, the runtime system must have been initialized with a call to "hs_init". It must be released with a call to "hs_exit" when it is no longer required.<br />
<br />
See the [https://downloads.haskell.org/ghc/latest/docs/html/users_guide/ffi-chap.html user guide] for more details.<br />
<br />
== Function pointers ==<br />
<br />
Sometimes you want to manipulate foreign pointers to foreign functions: these are [https://hackage.haskell.org/package/base/docs/Foreign-Ptr.html#g:2 FunPtr] in Haskell.<br />
<br />
You can get a function pointer by using "&" before a foreign function symbol:<br />
<haskell><br />
foreign import ccall "&exp" a_exp :: FunPtr (Double -> Double)<br />
</haskell><br />
<br />
Some foreign functions can also return function pointers.<br />
<br />
To call a function pointer from Haskell, GHC needs to convert between its own calling convention and the one expected by the foreign code. To create a function doing this conversion, you must use "dynamic" wrappers:<br />
<br />
<haskell><br />
foreign import ccall "dynamic" mkFun :: FunPtr (Double -> Double) -> (Double -> Double)<br />
</haskell><br />
<br />
Then you can apply this wrapper to a FunPtr to get a Haskell function:<br />
<br />
<haskell><br />
c_exp :: Double -> Double<br />
c_exp = mkFun a_exp<br />
</haskell><br />
<br />
You can also perform the opposite operation to give to the foreign code a pointer to a Haskell function. You need a "wrapper" wrapper. GHC generates the callable code to execute the wrapped Haskell closure with the appropriate calling convention and returns a pointer (FunPtr) on it. You have to release the generated code explicitly with `freeHaskellFunPtr` to avoid memory leaks: GHC has no way to know if the function pointer is still referenced in some foreign code, hence it doesn't collect it.<br />
<br />
<haskell><br />
add :: Int -> Int<br />
add = x+y<br />
<br />
foreign import ccall "wrapper" createAddPtr :: (Int -> Int) -> IO (FunPtr (Int -> Int))<br />
<br />
main = do<br />
addPtr <- createAddPtr add<br />
-- you can use addPtr like any other FunPtr (e.g. give it to foreign code)<br />
...<br />
-- you MUST free the FunPtr, otherwise it won't be collected<br />
freeHaskellFunPtr addPtr<br />
</haskell><br />
<br />
== Marshalling data ==<br />
<br />
In Haskell we are accustomed to let the runtime system -- especially the garbage collector -- manage memory. When we use the FFI, however, we sometimes need to do some manual memory management to comply with the data representations of the foreign codes. Hopefully, Haskell makes it very easy to manipulate low-level objects such as pointers. Moreover, many useful Haskell tools have been designed to simplify conversions between data representations.<br />
<br />
=== Pointers ===<br />
<br />
A pointer is an offset in memory. In Haskell, it is represented with the [https://hackage.haskell.org/package/base/docs/Foreign-Ptr.html Ptr a] data type. Where "a" is a phantom type that can be used to differentiate two pointers. You can think of "Ptr Stuff" as being equivalent to a "Stuff *" type in C (i.e. a pointer to a "Stuff" data). This analogy may not hold if "a" is a Haskell type not representable in the foreign language. For instance, you can have a pointer with the type "Ptr (Stuff -> OtherStuff)" but it is not function pointer in the foreign language: it is just a pointer tagged with the "Stuff -> OtherStuff" type.<br />
<br />
You can easily cast between pointer types using `castPtr` or perform pointer arithmetic using `plusPtr`, `minusPtr` and `alignPtr`. NULL pointer is represented with `nullPtr`.<br />
<br />
=== Memory allocation ===<br />
<br />
There are basically two ways to allocate memory:<br />
* on the Haskell heap, using `alloca*` functions in [https://hackage.haskell.org/package/base/docs/Foreign-Marshal-Alloc.html Foreign.Marshal.Alloc]<br />
<br />
The allocation is ephemeral: it lasts the time of the execution of an IO action, as in the following example:<br />
<haskell><br />
do<br />
allocaBytes 128 $ \ptr -> do<br />
-- do stuff with the pointer ptr...<br />
-- ...<br />
-- do not return "ptr" in any way because it will become an invalid pointer<br />
-- here the 128 bytes have been released and should not be accessed<br />
</haskell><br />
<br />
* on the "low-level" heap (the same as the runtime system uses), using `malloc*` functions in [https://hackage.haskell.org/package/base/docs/Foreign-Marshal-Alloc.html Foreign.Marshal.Alloc]<br />
<br />
Allocations on the low-level heap are not managed by the Haskell implementation and must be freed explicitly with `free`.<br />
<br />
<haskell><br />
do<br />
ptr <- mallocBytes 128<br />
-- do stuff with the pointer ptr...<br />
-- ...<br />
free ptr<br />
-- here the 128 bytes have been released and should not be accessed<br />
</haskell><br />
<br />
=== Foreign Pointers ===<br />
<br />
An hybrid approach is to use [https://hackage.haskell.org/package/base/docs/Foreign-ForeignPtr.html#t:ForeignPtr ForeignPtr]. Foreign pointers are similar to Ptr except that they have finalizers (i.e. actions) attached to them. When the garbage collector detects that a ForeignPtr is no longer accessible, it executes its associated finalizers. A basic finalizer is `finalizerFree` [https://hackage.haskell.org/package/base/docs/Foreign-Marshal-Alloc.html] that calls `free` on the pointer.<br />
<br />
You can convert a Ptr into a ForeignPtr using `newForeignPtr`, add additional finalizers, etc. [https://hackage.haskell.org/package/base/docs/Foreign-ForeignPtr.html#t:ForeignPtr].<br />
<br />
In the following example, we use `mallocForeignPtrBytes`. It is equivalent to call `malloc` and then to associate the `finalizerFree` finalizer with `newForeignPtr`. GHC has optimized implementations for `mallocForeignPtr*` functions, hence they should be preferred.<br />
<br />
<haskell><br />
do<br />
ptr <- mallocForeignPtrBytes 128<br />
-- do stuff with the pointer ptr...<br />
-- ...<br />
--<br />
-- ptr is freed when it is collected<br />
</haskell><br />
<br />
=== Using pointers: Storable instances ===<br />
<br />
You often want to read or to write at the address a of pointer. Reading consists in obtaining a Haskell value from a pointer; writing consists in somehow writing a representation of the Haskell value at the pointed address. Writing and reading a value depends on the type of the value, hence these methods are encapsulated into the [https://hackage.haskell.org/package/base/docs/Foreign-Storable.html Storable] type class.<br />
<br />
For any type T such that it exists a Storable T instance:<br />
* you can read a value, using <haskell>peek :: Ptr T -> IO T</haskell><br />
* you can write a value, using <haskell>poke :: Ptr T -> T -> IO ()</haskell><br />
<br />
`Storable a` also defines a `sizeOf :: a -> Int` method that returns the size of the stored value in bytes.<br />
<br />
All the ''marshallable foreign types'' (i.e. basic types) have Storable instances. Hence we can use these to write new Storable instances for more involved data types. In the following example, we create a Storable instance for a Complex data type:<br />
<br />
<haskell><br />
data Complex = Complex Double Double<br />
<br />
instance Storable Complex where<br />
sizeOf _ = 2 * sizeOf (undefined :: Double) -- stored complex size = 2 * size of a stored Double<br />
peek ptr = do<br />
real <- peek ptr<br />
img <- peekByteOff ptr (sizeOf real) -- we skip the bytes containing the real part<br />
return $ Complex real img<br />
poke ptr (Complex real img) = do<br />
poke ptr real<br />
pokeByteOff ptr (sizeOf real) img<br />
...<br />
</haskell><br />
<br />
This is not very complicated but it can become very cumbersome if our data type has many fields. Several tools have been developed to automatically or semi-automatically create the Storable instances.<br />
<br />
==== Renaming and Storable instances ====<br />
<br />
It is very common to use type renaming (i.e. newtype) to wrap a data type as in the following example, where we declare a type Pair that contains a pair of Double values just like our Complex type.<br />
<br />
<haskell><br />
newtype Pair = Pair Complex<br />
</haskell><br />
<br />
If we want to store Pair values exactly like Complex values, we have several possibilities:<br />
* unwrap the Complex value each time we want to use its Storable instance<br />
* create a new Storable Pair instance that does the same thing<br />
* automatically derive the Storable Pair instance<br />
<br />
The last solution is obviously the simplest one. It requires an extension however:<br />
<br />
<haskell><br />
{-# LANGUAGE GeneralizedNewtypeDeriving #-}<br />
<br />
newtype Pair = Pair Complex deriving (Storable)<br />
</haskell><br />
<br />
=== Arrays ===<br />
<br />
It is very common to read and to write arrays of values. [http://hackage.haskell.org/package/base/docs/Foreign-Marshal-Array.html Foreign.Marshal.Array] provides many functions to deal with pointers to arrays. You can easily write an Haskell list of storable values as an array of values, and vice versa.<br />
<br />
=== Strings ===<br />
<br />
Strings in Haskell are lists of Char, where Char represents a unicode character. Many foreign codes use the C representation for strings ([https://hackage.haskell.org/package/base/docs/Foreign-C-String.html CString] in Haskell): an array of bytes where each byte is a extended ASCII character terminated with a NUL character.<br />
<br />
In [https://hackage.haskell.org/package/base/docs/Foreign-C-String.html Foreign.C.String], you have many functions to convert between both representations. Be careful because Unicode characters outside of the ASCII range may not be representable with the C representation.<br />
<br />
<haskell><br />
foreign import ccall "echo" c_echo :: CString -> IO ()<br />
<br />
echo :: String -> IO ()<br />
echo str = withCString str $ \c_str -><br />
c_echo c_str<br />
</haskell><br />
<br />
=== Data structures ===<br />
<br />
Marshalling data structures of foreign languages is the most cumbersome task: you have to find out the offset of each field of the data structure (considering padding bytes, etc.). Hopefully, there are Haskell tools to help with this task.<br />
<br />
Suppose you have a C data structure like this:<br />
struct MyStruct {<br />
double d;<br />
char c;<br />
int32_t i;<br />
};<br />
<br />
And its Haskell counterpart:<br />
<haskell><br />
data MyStruct = MyStruct<br />
{ d :: Double<br />
, c :: Word8<br />
, i :: Int32<br />
}<br />
</haskell><br />
<br />
The following sub-sections present the different ways to write the Storable instance for MyStruct. <br />
<br />
The following header is implied:<br />
<haskell><br />
import Control.Applicative ((<$>), (<*>))<br />
import Foreign.Storable<br />
</haskell><br />
<br />
==== The explicit way ====<br />
<br />
<haskell><br />
instance Storable MyStruct where<br />
alignment _ = 8<br />
sizeOf _ = 16<br />
peek ptr = MyStruct<br />
<$> peekByteOff ptr 0<br />
<*> peekByteOff ptr 8<br />
<*> peekByteOff ptr 12 -- skip padding bytes after "c"<br />
poke ptr (MyStruct d c i) = do<br />
pokeByteOff ptr 0 d<br />
pokeByteOff ptr 8 c<br />
pokeByteOff ptr 12 i<br />
</haskell><br />
<br />
* The structure alignment is the least common multiple of the alignments of the structure fields. The alignment of primitive types is equal to their size in bytes (e.g. 8 for Double, 1 for Word8 and 4 for Word32). Hence the alignment for MyStruct is 8.<br />
<br />
* We indicate the offset of each field explicitly for peek and poke methods. We introduce padding bytes to align the "i" field (Word32) on 4 bytes. A C compiler does the same thing (except for packed structures).<br />
<br />
* The size of the structure is the total number of bytes, including padding bytes between fields.<br />
<br />
==== hsc2hs ====<br />
<br />
[https://downloads.haskell.org/ghc/latest/docs/html/users_guide/utils.html#writing-haskell-interfaces-to-c-code-hsc2hs hsc2hs] is a tool that can help you compute field offsets by using C headers directly.<br />
<br />
Save your Haskell file with a .hsc extension to enable the support of hsc2hs.<br />
<br />
<haskell><br />
#include <myheader.h><br />
<br />
instance Storable MyStruct where<br />
peek ptr = MyStruct<br />
<$> (#peek MyStruct, d) ptr<br />
<*> (#peek MyStruct, c) ptr<br />
<*> (#peek MyStruct, i) ptr<br />
...<br />
</haskell><br />
<br />
==== c2hs ====<br />
<br />
[https://hackage.haskell.org/package/c2hs c2hs] is another tool that can help you doing the same thing as hsc2hs for data structure marshalling. [http://stackoverflow.com/questions/6009031/difference-between-hsc2hs-and-c2hs They have differences in other aspects though].<br />
<br />
<haskell><br />
#include <myheader.h><br />
<br />
instance Storable MyStruct where<br />
peek ptr = MyStruct<br />
<$> {#get MyStruct->d} ptr<br />
<*> {#get MyStruct->c} ptr<br />
<*> {#get MyStruct->i} ptr<br />
...<br />
</haskell><br />
<br />
<br />
==== c-storable-deriving ====<br />
<br />
You can also derive the Storable instances from the types of the fields and their order in the Haskell data type by using [https://hackage.haskell.org/package/c-storable-deriving c-storable-deriving package].<br />
<br />
<haskell><br />
{-# LANGUAGE DeriveGeneric #-}<br />
<br />
import GHC.Generics (Generic)<br />
import Foreign.CStorable<br />
<br />
data MyStruct = MyStruct {...} deriving (Generic)<br />
<br />
instance CStorable MyStruct<br />
<br />
instance Storable MyStruct where<br />
sizeOf = cSizeOf<br />
alignment = cAlignment<br />
poke = cPoke<br />
peek = cPeek<br />
</haskell><br />
<br />
The CStorable type-class is equivalent to the Storable type-class but has additional default implementations for its methods if the type has an instance of Generic.<br />
<br />
=== Pointers to Haskell data ===<br />
<br />
In some cases, you may want to give to the foreign code an opaque reference to a Haskell value that you will retrieve later on. You need to be sure that the value is not collected between the time you give it and the time you retrieve it. [https://hackage.haskell.org/package/base/docs/Foreign-StablePtr.html Stable pointers] have been created exactly to do this. You can wrap a value into a StablePtr and give it to the foreign code (StablePtr is one of the marshallable foreign types).<br />
<br />
You need to manually free stable pointers using `freeStablePtr` when they are not required anymore.<br />
<br />
== Tools ==<br />
<br />
There are several tools to help writing bindings using the FFI. In particular by using C headers.<br />
<br />
=== Using C headers ===<br />
* [https://downloads.haskell.org/ghc/latest/docs/html/users_guide/utils.html#writing-haskell-interfaces-to-c-code-hsc2hs hsc2hs]<br />
* [https://hackage.haskell.org/package/c2hs c2hs]<br />
* [http://hackage.haskell.org/package/bindings-DSL-1.0.22 bindings-DSL]<br />
* [http://hackage.haskell.org/package/c2hsc c2hsc]<br />
<br />
=== Haskell ===<br />
* [https://hackage.haskell.org/package/c-storable-deriving c-storable-deriving]<br />
<br />
=== Dynamic function call ===<br />
* [https://hackage.haskell.org/package/libffi libffi]: allow to call a C function without knowing its type at compile time.<br />
<br />
== Linking ==<br />
<br />
There are several ways for GHC to find the foreign code to link with:<br />
* Static linking: the foreign code binary object is merged with the Haskell one to form the final executable<br />
* Dynamic linking: the generated binary uses libraries (e.g. .dll or .so) that are automatically linked when the binary is executed<br />
* Explicit dynamic linking: the Haskell code explicitly loads libraries, finds symbols in them and makes calls to them<br />
<br />
The first two modes are well described in GHC and Cabal manuals. For the last one, you need to use platform dependent methods:<br />
* on UNIX, you can use [http://hackage.haskell.org/package/unix/docs/System-Posix-DynamicLinker.html System.Posix.DynamicLinker]<br />
<br />
Explicit dynamic linking helps you obtaining [https://hackage.haskell.org/package/base/docs/Foreign-Ptr.html#g:2 function pointers (FunPtr)]. You need to write "dynamic" wrappers to call the functions from Haskell.<br />
<br />
=== Dynamic linker template ===<br />
<br />
[https://hackage.haskell.org/package/dynamic-linker-template dynamic-linker-template] is a package that uses template Haskell to automatically generate "dynamic" wrappers for explicit dynamic linking (only supporting Unix for now).<br />
<br />
The idea is that a library is like a record containing functions, hence it is easy to generate the code that load symbols from a library and store them into a Haskell record.<br />
<br />
In the following code, the record matching library symbols is the data type MyLib. The generated code will apply "myModifier" to each field name of the record to find corresponding symbols in the library. myModifier should often be "id" but it is sometimes useful when symbols are not pretty. Here in the foreign code "_v2" is appended at the end of each symbol to avoid symbol clashes with the first version of the library.<br />
<br />
The package supports optional symbols: functions that may or may not be present in the library. These optional functions are represented by encapsulating the function type into Maybe.<br />
<br />
The `libHandle` field is mandatory and contains a pointer to the loaded library. You can use it to unload the library.<br />
<br />
A function called `loadMyLib` is generated to load symbols from a library, wrap them using "dynamic" wrappers and store them into a MyLib value that is returned.<br />
<br />
<haskell><br />
{-# LANGUAGE TemplateHaskell, ForeignFunctionInterface #-}<br />
<br />
import System.Posix.DynamicLinker.Template<br />
<br />
data MyLib = MyLib {<br />
libHandle :: DL,<br />
thing1 :: Double -> IO Int, -- Mandatory symbol<br />
thing2 :: Maybe (Int -> Int -> Int) -- Optional symbol<br />
}<br />
<br />
myModifier :: String -> String<br />
myModifier = (++ "_v2")<br />
<br />
$(makeDynamicLinker ''MyLib CCall 'myModifier)<br />
<br />
-- Load your library with:<br />
-- loadMyLib :: FilePath -> [RTLDFlags] -> IO MyLib<br />
</haskell><br />
<br />
== Enhancing performance and advanced topics ==<br />
<br />
To enhance performance of a call to a foreign function, you first need to understand how GHC runtime system works. GHC uses user-space threads. It uses a set of system threads (called "Tasks"). Each system thread can execute a "capability" (i.e. a user-space thread manager). User-space threads are distributed on capabilities. Each capability executes its associated user-space threads, one at a time, using cooperative scheduling or preemption if necessary.<br />
<br />
All the capabilities have to synchronize to perform garbage collection.<br />
<br />
When a FFI call is made:<br />
* the user-space thread is suspended (indicating it is waiting for the result of a foreign call)<br />
* the current system thread executing the capability executing the user-space thread releases the capability<br />
** the capability can be picked up by another system thread<br />
** the user-space threads that are not suspended in the capability can be executed<br />
** garbage collection can occur<br />
* the system thread executes the FFI call<br />
* when the FFI call returns, the user-space thread is woken up<br />
<br />
If there are too many blocked system threads, the runtime system can spawn new ones.<br />
<br />
=== Unsafe calls ===<br />
<br />
All the capability management before and after a FFI call adds some overhead. It is possible to avoid it in some cases by adding the "unsafe" keyword as in the following example:<br />
<br />
<haskell><br />
foreign import ccall unsafe "exp" c_exp :: Double -> Double<br />
</haskell><br />
<br />
By doing this, the foreign code will be directly called but the capability won't be released by the system thread during the call. Here are the drawbacks of this approach:<br />
* if the foreign function blocks indefinitely, the other user-space threads of the capability won't be executed anymore (deadlock)<br />
* if the foreign code calls back into the Haskell code, a deadlock may occur<br />
** it may wait for a value produced by one of the locked user-space threads on the capability<br />
** there may not be enough capabilities to execute the code<br />
<br />
=== Foreign PrimOps ===<br />
<br />
If unsafe foreign calls are not fast enough for you, you can try the GHCForeignImportPrim extension.<br />
<br />
<haskell><br />
{-# LANGUAGE GHCForeignImportPrim,<br />
MagicHash,<br />
UnboxedTuples,<br />
UnliftedFFITypes #-}<br />
<br />
import GHC.Base<br />
import GHC.Int<br />
<br />
-- Primitive with type :: Int -> Int -> IO Int<br />
foreign import prim "my_primop_cmm"<br />
my_primop# :: Int# -> Int# -> State# RealWorld -> (# State# RealWorld, Int# #)<br />
<br />
my_primop :: Int64 -> Int64 -> IO Int64<br />
my_primop (I64# x) (I64# y) = IO $ \s -><br />
case (my_primop# x y s) of (# s1, r #) -> (# s1, I64# r #)<br />
</haskell><br />
<br />
Then you have to write your foreign function "my_primop_cmm" using [https://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler/CmmType C--] language used internally by GHC.<br />
<br />
As an alternative, if you know how C-- is compiled on your architecture, you can write code in other languages. For instance [https://github.com/hsyl20/haskus-system/blob/fa9a4057c38f1e2808ba570eb57636c51a809c29/src/lib/Haskus/Arch/X86_64/Linux/syscall.c#L95 directly in assembly] or [http://breaks.for.alienz.org/blog/2012/02/09/parsing-market-data-feeds-with-ragel/ using C and LLVM].<br />
<br />
[http://breaks.for.alienz.org/blog/2012/05/23/ffi-vs-primops/ Here] is a comparison of the different approaches on a specific case.<br />
<br />
=== Bound threads ===<br />
<br />
Some foreign codes use (system) thread-local storage. Some others are not thread-safe. In both case, you have to be sure that the same '''system thread''' executes the FFI calls. To control how user-space threads are scheduled on system threads, GHC provide [http://hackage.haskell.org/package/base/docs/Control-Concurrent.html#g:8 bound threads]. Bound threads are user-space threads (Haskell threads) that can only be executed by a single system thread.<br />
<br />
Note that bound threads are more expensive to schedule than normal threads. The first thread executing "main" is a bound thread.<br />
<br />
=== Inline FFI calls ===<br />
<br />
If you want to make a one-shot FFI call without the hassle of writing the foreign import, you can use the following technique (using Template Haskell).<br />
<br />
In AddTopDecls.hs:<br />
<haskell><br />
{-# LANGUAGE TemplateHaskell #-}<br />
<br />
module AddTopDecls where<br />
<br />
import Language.Haskell.TH<br />
import Language.Haskell.TH.Syntax<br />
<br />
importDoubleToDouble :: String -> ExpQ<br />
importDoubleToDouble fname = do<br />
n <- newName fname<br />
d <- forImpD CCall unsafe fname n [t|Double -> Double|]<br />
addTopDecls [d]<br />
[|$(varE n)|]<br />
</haskell><br />
<br />
In your module:<br />
<haskell><br />
{-# LANGUAGE TemplateHaskell #-}<br />
<br />
module Main where<br />
<br />
import Language.Haskell.TH<br />
import Language.Haskell.TH.Syntax<br />
<br />
import AddTopDecls<br />
<br />
main :: IO ()<br />
main = do<br />
print ($(importDoubleToDouble "sin") pi)<br />
print ($(importDoubleToDouble "cos") pi)<br />
</haskell><br />
<br />
== History ==<br />
<br />
=== Header inclusion ===<br />
<br />
In old versions of GHC (6.8.3 and earlier), the compiler was able to check the prototypes of the foreign imports by including C header files into the generated C code. For instance, you could write:<br />
<haskell><br />
{-# INCLUDE <math.h> #-}<br />
</haskell><br />
or <br />
<haskell><br />
foreign import ccall "math.h sin" c_sin :: Double -> Double<br />
</haskell><br />
to include the "math.h" header.<br />
<br />
This is deprecated in GHC. Nevertheless you may still find examples using this syntax so it is good to know that it has been used. Moreover, other compilers may still use this feature.<br />
<br />
* Justification of the deprecation from the [http://www.haskell.org/ghc/docs/6.10.1/html/users_guide/ffi-ghc.html#glasgow-foreign-headers GHC 6.10.1 manual]:<br />
<br />
"C functions are normally declared using prototypes in a C header file. Earlier versions of GHC (6.8.3 and earlier) #included the header file in the C source file generated from the Haskell code, and the C compiler could therefore check that the C function being called via the FFI was being called at the right type.<br />
<br />
GHC no longer includes external header files when compiling via C, so this checking is not performed. The change was made for compatibility with the native code backend (-fasm) and to comply strictly with the FFI specification, which requires that FFI calls are not subject to macro expansion and other CPP conversions that may be applied when using C header files. This approach also simplifies the inlining of foreign calls across module and package boundaries: there's no need for the header file to be available when compiling an inlined version of a foreign call, so the compiler is free to inline foreign calls in any context.<br />
<br />
The -#include option is now deprecated, and the include-files field in a Cabal package specification is ignored."<br />
<br />
* [http://www.haskell.org/ghc/docs/6.8.3/html/users_guide/ffi-ghc.html#glasgow-foreign-headers Documentation of this feature in the GHC 6.8.3 manual]<br />
<br />
<br />
<br />
== References ==<br />
<br />
* FFI addendum<br />
* The [http://www.haskell.org/onlinereport/haskell2010/haskellch8.html#x15-1490008 Foreign Function Interface section] of the Haskell 2010 report<br />
* [https://downloads.haskell.org/ghc/latest/docs/html/users_guide/ffi-chap.html FFI chapter in the GHC user guide]<br />
* [http://research.microsoft.com/en-us/um/people/simonpj/papers/marktoberdorf/ "Tackling the awkward squad" paper]<br />
* [http://community.haskell.org/~simonmar/papers/conc-ffi.pdf "Extending the Haskell FFI with Concurrency" paper] (the number of capabilities is now greater than 1)<br />
* http://blog.melding-monads.com/2011/10/24/concurrency-and-foreign-functions-in-the-glasgow-haskell-compiler/<br />
<br />
<br />
=== Related links ===<br />
<br />
* [https://github.com/GaloisInc/ivory Ivory]: EDSL for writing safer low-level C.<br />
<br />
=== Old links ===<br />
<br />
Select one of the following links for more information:<br />
* [[FFI Introduction]]<br />
* GHC manual: [https://downloads.haskell.org/ghc/latest/docs/html/users_guide/utils.html#writing-haskell-interfaces-to-c-code-hsc2hs Writing Haskell interfaces to C code: hsc2hs]<br />
* [https://github.com/ifesdjeen/haskell-ffi-tutorial haskell-ffi-tutorial] at GitHub<br />
* The official description: chapters 8 and 24 to 37 of [http://www.haskell.org/onlinereport/haskell2010/#QQ2-15-159 The Haskell 2010 Language Report] (a draft: [http://www.cse.unsw.edu.au/~chak/haskell/ffi/ The Haskell 98 Foreign Function Interface 1.0. An Addendum to the Haskell 98 Report])<br />
* [[FFI cook book]]<br />
* [[FFI complete examples]]<br />
* [[GHC/Using the FFI]]<br />
* [http://research.microsoft.com/~simonpj/papers/marktoberdorf/ Tackling the awkward squad]<br />
* [https://github.com/wavewave/fficxx fficxx], a Haskell-C++ Foreign Function Interface Generator<br />
* [[Applications and libraries/Interfacing other languages]]<br />
* [http://rosettacode.org/wiki/Use_another_language_to_call_a_function#Haskell Use another language to call a function; Haskell]<br />
* [https://code.google.com/p/tabi/ TABI] a typeful tagged cross-language calling convention<br />
<br />
=== Blog articles ===<br />
<br />
* [http://www.serpentine.com/blog/2010/09/04/dealing-with-fragile-c-libraries-e-g-mysql-from-haskell/ Dealing with fragile C libraries (e.g. MySQL) from Haskell] <br />
* [http://blog.danieroux.com/2007/01/01/simple-demonstration-of-haskell-ffi/ Simple demonstration of Haskell FFI]<br />
* [http://therning.org/magnus/posts/2006-12-08-238-c-and-haskell-sitting-in-a-tree.html C and Haskell sitting in a tree…]<br />
* [https://web.archive.org/web/20161110104503/vis.renci.org/jeff/2009/07/10/c2hs-example-to-save-other-people-frustration/ C2HS example: To save other people frustration] <br />
* [[Cxx foreign function interface]]; how to link to a C++ library<br />
* [http://blog.ezyang.com/2010/07/safety-first-ffi-and-threading/ Safety first: FFI and threading]<br />
<br />
== TODO ==<br />
<br />
* Fix References section<br />
<br />
* Foreign language specific issues<br />
** C++ symbol mangling<br />
** Embedded Objective C<br />
<br />
* Precision<br />
<br />
<code>The Haskell report only guarantees that Int has 30 bits of signed precision, so converting CInt to Int is not safe! On the other hand, many classes have instances for Int and Integer but not CInt, so it's generally more convenient to convert from the C types. To convert, I suppose you could either write a 'checkedFromIntegral' function if you're sure it's small or just use Integer.</code><br />
<br />
* Fix [https://wiki.haskell.org/C2hs]<br />
** One page per tool?<br />
** Links to external tool specific tutorials<br />
<br />
* Linking<br />
** pkgconfig<br />
** cabal<br />
** explicit (ghc parameters)<br />
** cf http://stackoverflow.com/questions/4959802/how-to-specify-dependency-on-external-c-library-in-cabal<br />
<br />
[[Category:FFI]]</div>Ysangkokhttps://wiki.haskell.org/index.php?title=Haskell_Tutorial_for_C_Programmers&diff=62871Haskell Tutorial for C Programmers2019-04-04T19:35:29Z<p>Ysangkok: link base-4.12 and not base-4.11</p>
<hr />
<div>Haskell Tutorial for C Programmers, by Eric Etheridge<br />
<br />
version 3.0 - please increment with major updates<br \><br />
original author: Eric Etheridge<br \><br />
last major update by the original author: August 28, 2011<br \><br />
year of original release (on old haskell.org site): 2005<br />
<br />
__TOC__<br />
<br />
==Introduction==<br />
<br />
===Abstract===<br />
<br />
Many people are accustomed to imperative languagues, which include C, C++, Java, Python, and Pascal. For computer science students, Haskell is weird and abstruse. This tutorial assumes that the reader is familiar with C/C++, Python, Java, or Pascal. I am writing for you because it seems that no other tutorial was written to help students overcome the difficulty of moving from C/C++, Java, and the like to Haskell.<br />
<br />
I write this assuming that you have checked out the Gentle Introduction to Haskell, but still don't understand what's going on.<br />
<br />
Haskell is not 'a little different,' and will not 'take a little time.' It is very different and you cannot simply pick it up, although I hope that this tutorial will help.<br />
<br />
I am going to put many pauses in this tutorial because learning Haskell hurt a lot, at least for me. I needed breaks, and my brain hurt while I was trying to understand.<br />
<br />
Haskell has both more flexibility and more control than most languages. Nothing that I know of beats C's control, but Haskell has everything C does unless you need to control specific bytes in memory. So I call Haskell powerful, rather than just 'good.'<br />
<br />
I wrote this tutorial because Haskell was very hard for me to learn, but now I love it. &quot;Haskell is hard!&quot; &quot;You can't write code the way I know how!&quot; &quot;My brain hurts!&quot; &quot;There aren't any good references!&quot; That's what I said when I was in college. There were good references, but they didn't cover the real problem: coders know C.<br />
<br />
This abstract was pieced together by Mark Evans, [http://lambda-the-ultimate.org/node/view/724 here], from my own work. I have had no contact with Mark Evans, but since he did't contact me when he editted together this abstract from my work and posted it on lambda-the-ultimate, I doubt he'll care that I've taken that edit and used it as my abstract here. If he wishes, he may contact me regarding the legal status of this work. For now, I assume I still hold the copyright on all of it, including the abstract (released in [http://haskell.org/haskellwiki/HaskellWiki:Copyrights the license for this site]).<br />
<br />
<br />
===Downloads===<br />
<br />
In the former form of this tutorial, I had a zipped version of the html files available at this point. However, this wiki provides a "printable version" button and the tutorial is now one long page (which may be a poor design choice, we'll see). In addition, a bundled version might quickly become out of date from minor corrections by site patrons. Therefore, it doesn't seem necessary at the moment to include a zipped bundle of the tutorial text.<br />
<br />
Here are the source files and text for all examples for this tutorial, including all those in the sections and the large examples at the end, zipped using bzip2: [[Media:HaskellForC_Examples.tar.bz2|bzip2 of sources, 28K]], and zipped as a zip: [[Media:HaskellForC_Examples.zip|zip of sources, 43K]].<br />
<br />
Sources for the in-text examples in the coming sections are given in the following files:<br />
* ExampleSectionsCode.hs<br />
* ExampleSectionsTry.txt<br />
<br />
If you don't have bzip2, you can get the latest version at [http://www.bzip.org/ www.bzip.org].<br />
<br />
<br />
===License===<br />
<br />
The original form of the tutorial was available under a Creative Commons License, specifically Attribution-Share Alike 3.0. That license still applies to any form downloaded or read while that version was available. This wiki requires submitted work to be subject to a specific license, so this work is now available under this [http://haskell.org/haskellwiki/HaskellWiki:Copyrights simple permissive license]. I would still prefer some attribution if the work was used wholesale.<br />
<br />
<br />
===This Tutorial's Purpose and Other Online References===<br />
<br />
Many people are accustomed to imperative languagues, which include C, C++, Java, Python, and Pascal. In fact, most languages in common usage are imperative, other than LISP, Scheme, ML, and OCaml. For computer science students in high school or early college, it is virtually guaranteed that Haskell is weird and abstruse. I first encountered Haskell in the classroom when I was a freshman at UT Austin, and then in another class at UT two years later. I was only familiar with C/C++, Pascal, and QBASIC, and all of the Haskell tutorials and books seemed to assume more of my education. This tutorial assumes that the reader is familiar with C/C++, Python, Java, or Pascal. This tutorial is specifically for '''students''' of computer science, people in their first few years of college, or even in high school. I am writing for you because it seems that no other tutorial was written to help students overcome the difficulty of moving from C/C++, Java, and the like to Haskell.<br />
<br />
====GHC and Hugs====<br />
<br />
To learn and use Haskell, you should install GHC, and perhaps Hugs. GHC is the "de facto standard" compiler for Haskell, and almost all projects in Haskell use it. The Hugs interpreter is a simpler tool that will let you play around and learn. Start with Hugs if you are having trouble using GHC. GHC also ships with GHCi, "GHC interactive", which is a command line interpreter much like Hugs, but no GUI. Getting these programs is easy. If you use Debian, GHC and Hugs are packages. For everyone else, the homepages are here:<br />
<br />
[http://www.haskell.org/ghc/ http://www.haskell.org/ghc/]<br />
<br />
[http://www.haskell.org/hugs/ http://www.haskell.org/hugs/]<br />
<br />
====The Gentle Introduction to Haskell====<br />
<br />
I write this assuming that you have checked out the following tutorial, the Gentle Introduction to Haskell, but found that you still don't understand what's going on:<br />
<br />
[http://www.haskell.org/tutorial/ http://www.haskell.org/tutorial/]<br />
<br />
====Tour of the Haskell Syntax====<br />
<br />
The Gentle Introduction to Haskell is a good reference for basic syntax. In this tutorial we will skip most syntax details until later. First we will cover defining functions in Haskell and why it is central to the language. For more syntax details, here is another tutorial, a Tour of the Haskell Syntax, which has much more specific information:<br />
<br />
[http://www.cse.chalmers.se/edu/year/2014/course/TDA452/haskell-syntax.html http://www.cse.chalmers.se/edu/year/2014/course/TDA452/haskell-syntax.html]<br />
<br />
You should look through the Tour, since it describes the appropriate syntax for most of the things I discuss. The Tour is useful because you can understand it without knowing everything about Haskell. Reading these can help you before, after, or during this tutorial.<br />
<br />
====The Prelude File====<br />
<br />
One of the best references is the source code for the Prelude, which is the file &quot;Prelude.hs&quot;. This file holds the code for all of the general-purpose functions in the Prelude module. If any function shows up that you don't understand, you can look up its definition in source code and figure out what it's really doing. This is a very good practice for those unfamiliar with general Haskell use.<br />
<br />
There are (at least) three ways to get a copy of the Prelude.hs file. If you download and install Hugs, Prelude.hs will be in the libraries directory. I do not think that GHC ships with the uncompiled library sources. You can download a source version of GHC from its download page. You may be able to find a gzipped copy in the ghc "libsrc" Debian package.<br />
<br />
====GHC Hierarchical Libraries====<br />
<br />
Another important resource is the GHC Hierarchical Libraries documentation. The data types and functions of every module are defined here, including the Prelude. Whenever you use a library function, you'll want to refer to these to find the module and specific usage. All the standard modules are well documented. If your GHC installation includes the docs, these webpages are also on your local machine.<br />
<br />
[http://www.haskell.org/ghc/docs/latest/html/libraries/index.html http://www.haskell.org/ghc/docs/latest/html/libraries/index.html]<br />
<br />
====Monads for the Working Haskell Programmer====<br />
<br />
When I was working on the large examples that included monads, I used a lot of help from here:<br />
<br />
[http://www.engr.mun.ca/~theo/Misc/haskell_and_monads.htm http://www.engr.mun.ca/~theo/Misc/haskell_and_monads.htm]<br />
<br />
<br />
===Preface and Style Notes===<br />
<br />
I am not writing a Haskell reference. This is a tutorial designed to take someone having trouble understanding Haskell and help them. This tutorial is for people who, like me, needed to learn enough concepts to understand the code covered in a classroom. Haskell allows things to be done easily and clearly, but it is not easy or clear, and it can be extremely challenging for a novice. You cannot pick up Haskell code and understand it. What I have attempted to write is a tutorial that covers the common aspects of Haskell that are the most obtuse.<br />
<br />
As the tutorial progresses, one thing should become clear about Haskell: its real power comes into play when you attack difficult problems. Because of this, I use some difficult problems in this tutorial. Don't worry if you don't understand the solutions after reading the tutorial once. Haskell is not a toy language, and even a moderately sized set of functions will include several of Haskell's complicated tools all working together. This has left educators with a dilemma: do I use ridiculously simple code in order to cover a single topic at once, or do I use something actually useful and try to explain all the pieces and how they all fit together? Many tutorials and lessons have chosen the former, but I prefer the latter. That means that each example requires a lot of explaining. Often concepts must be explained once in extremely simplistic terms, and then explained again later after other related topics have also been briefly discussed. As you read this tutorial, remember this: Haskell's real power is the fact that all of its pieces fit so well together, not just that they are good pieces.<br />
<br />
The syntax and variable name conventions I use in this tutorial are those used in the Haskell source code and libraries, and what I learned in college. Haskell programs tend to be short, but wide. I recommend using descriptive variable names, even for indices and so forth.<br />
<br />
<br />
==Section I: What the Heck is Going On?==<br />
<br />
===Part I: Haskell's Oddity===<br />
<br />
To begin, Haskell has no update operator. If that sentence did not make sense, then please keep reading, because this tutorial was written with you in mind. By 'update operator', I mean that the following does not happen in normal Haskell:<br />
<br />
int a<br />
a := 4<br />
print a<br />
a := 5<br />
print a<br />
<br />
> 4<br />
> 5<br />
<br />
The above programming style, i.e. 'making a variable, putting data in it, using it, then replacing the data in it, using it again' does not happen in normal Haskell. Those of you who have used LISP or Scheme will be familiar with this concept, but I am sure that the rest of you are probably baffled. Here is how Haskell works, again in pseudo-code:<br />
<br />
print a<br />
<br />
int a<br />
a = 5<br />
<br />
> 5<br />
<br />
or<br />
<br />
int a<br />
a = 5<br />
<br />
print a<br />
<br />
> 5<br />
<br />
The order of these actions does not matter. There is also a reason that the first example used ':=' and the second example used '='. In 'imperative' languages, storing data is an operation, and it happens in a sequence. In 'functional' languages like Haskell, the equal sign means an exact definition. In other words, each variable is equal to its value not only after the assignment statement is reached in sequence, but in fact at all points during execution.<br />
<br />
Some of you may be saying, &quot;That's nice, Eric, but what good is a language where everything is hardcoded? Wouldn't I have to define every variable with its correct value as I coded? Isn't 'computing' values the whole point of a 'computer'?&quot; And you would be right; knowing results ahead of time would make computing weird. The 'redeeming' feature of Haskell is that you don't need to store data to return a result.<br />
<br />
I am going to put many pauses in this tutorial because learning Haskell hurt a lot, at least for me. I needed breaks, and my brain hurt while I was trying to understand. Let's look at that statement again: you don't need to store data to return a result. I'll illustrate. Here is an example of a function in C:<br />
<br />
int foo (int bar) {<br />
int result;<br />
result = bar * 10 + 4;<br />
return result;<br />
}<br />
<br />
The important part is the expression in the middle. It can also be written as follows:<br />
<br />
int foo (int bar) {<br />
return bar * 10 + 4;<br />
}<br />
<br />
These are the same, but the second is shorter and clearer. With a function like this, you could state the following: &quot;The value of foo(x) is equal to (x * 10 + 4).&quot; Or, more simply, &quot;foo(x) = x * 10 + 4&quot;. I know you're s