preprocessor and library for Causal Commutative Arrows (CCA) not available

Latest on Hackage:

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow to host generated Haddocks.

BSD3 licensed by Paul H Liu, Eric Cheng
Maintained by Paul H Liu
A prototype preprocessor for arrow notation.

Ross Paterson <>

Note that recent versions of GHC support this notation directly, and
give better error messages to boot.


The program supports the following options:

--pretty=STYLE pretty print in STYLE
[offside|semicolon|inline|none] (default = offside)
--help display usage information

Typically you create a Haskell module using the extended syntax, and
call it (for arrow script). To convert this into a corresponding
Haskell module, you say

arrowp >Foo.hs
arrowp Foo.hs

and then use Foo.hs with your favourite Haskell implementation.
You can also run it with no arguments at all:

arrowp < >Foo.hs

but then it won't have a file name to put in the error messages.
Sometimes the input has already been preprocessed, e.g. with unlit
(from the GHC distribution). For this situation, you can specify both
the original file name (for error messages) and the input file name, as
well as the output file name (which is obligatory in this situation), e.g.

unlit Foo.las
arrowp Foo.las Foo.hs

or equivalently as

unlit Foo.las - | arrowp Foo.las - Foo.hs

(both unlit and arrowp allow filename arguments of "-", meaning standard
input or output as appropriate.)

WARNING: if you give the program 2 (or 3) arguments, the last one will
be overwritten.


Syntax errors will be detected by the preprocessor, and the position in
the source where they were detected is reported. (As usual, the actual
error may occur earlier.) The preprocessor understands Haskell 98 plus
multiparameter type classes and the arrow extensions, but not some of
the other extensions supported by various Haskell implementations.
The preprocessor doesn't handle operator precedence, so it may copy
some erroneous expressions like `x == y == z'. Otherwise, the output
of the preprocessor should not generate any syntax errors -- if it does,
please report it.

Semantic errors are more difficult for simple preprocessors like this one.
They will be detected by your Haskell implementation, whether they occur
in the Haskell part or the arrows part, and are thus rather hard to
trace back to the original source. If you use --pretty=none and feed
the output to GHC, the error it reports will refer to the first line
of the declaration containing the error. But if you need to read the
preprocessor output to find the problem, omit the --pretty option.

You can reduce the above problems by putting the parts of your program
that need arrow syntax (and thus the preprocessor) in separate modules.


- there is no type checking until the output is compiled,
resulting in incomprehensible error messages.
- failable patterns are not handled as promised yet.
(And I'm starting to think they shouldn't be.)


This is based on hsparser, by Sven Panne, Simon Marlow and Noel Winstanley.
It is now the haskell-src package distributed with GHC.

My changes are

Lexer -- a few lines adding extra symbols (all marked)
Parser -- a few marked lines and several rules at the end,
mostly modified versions of existing rules.
ArrSyn, ArrCode, Utils -- new modules for arrow syntax.

The parser gives 2 shift/reduce conflicts, inherited from the original.

There was a reduce/reduce conflict:

qual -> 'let' declist .
qualA -> 'let' declist .

but I've kludged the grammar (see stmtA) to avoid it.


commit fa6eeb086fb5330fed17d5d87626bb5f3ab5c0d8
Author: Paul H. Liu <>
Date: Thu May 7 20:05:34 2015 -0700

Bump version to

commit 4c2a396a4f7e1589c37049e03bedc414ce7a745c
Merge: 31801f2 633e991
Author: Paul H. Liu <>
Date: Mon May 4 11:42:41 2015 -0700

Merge branch 'alex-segura-master'

commit 633e99109df45083de835a2a95bff9f64b50b600
Author: Paul H. Liu <>
Date: Mon May 4 11:42:19 2015 -0700

Import Control.Applicative just in case

commit 11d39c28d510b7385c08f260da9dc0c5e0199ef4
Author: Alex Segura <>
Date: Sun May 3 13:37:58 2015 -0400

Conditionals for TH version compatibility

commit fd94207ca583d5dc0cbc34ebd71d6a24525660c6
Author: Alex Segura <>
Date: Sun May 3 13:37:39 2015 -0400

Functor and applicative instances for State

commit 31801f274b1ad1d568ff6d0c6c3f31bd38e4210d
Author: Paul H. Liu <>
Date: Sat Jan 31 20:54:45 2015 -0800

Bump version to to repack for hackage

commit be97a355398da2972d48e35a58277b7bc2e81ad3
Author: Paul H. Liu <>
Date: Wed Jan 14 14:30:00 2015 -0800

Bump version to

commit 1f378c1bedb1775e68a150e0e8eea54ef24a1a4d
Author: Paul H. Liu <>
Date: Wed Jan 14 14:29:28 2015 -0800

Add happy in build-tools

commit 720b4d1c753837d30c968e4ae885905da4ebc702
Author: Paul H. Liu <>
Date: Tue Sep 16 21:06:35 2014 -0700

Bump version to 0.1.5

commit b8e02e9541dc7792eb10faed41fc5a8abebb6992
Author: Paul H. Liu <>
Date: Mon May 12 13:32:56 2014 -0700

Minor updates after importing from darcs repo

commit 7f60b7942d22b85c09162d18a43e89ddd6942e0f
Author: Paul Liu <>
Date: Thu May 30 00:38:10 2013 -0700

Bump version to 0.1.4

Ignore-this: db43c3ab8aa7ac71aa760aec41c111de


commit 99d812076e9a99a05936ca9108058802170f1116
Author: Paul Liu <>
Date: Tue May 14 20:09:56 2013 -0700

Remove obsolete GHC options from Makefile

Ignore-this: 646e5aafb5e22e348f89d549d9999c2a


commit 6ac9aee8b3383410df74b74ccbdda31e384a0021
Author: svenkeidel <>
Date: Tue May 14 07:22:04 2013 -0700

fixes for compilation with ghc 7.6.3

Ignore-this: 892f3664fb5b6838bf8eaea00f68fbac

Problem 1 Template Haskell:
In template-haskell <=, "Kind" is a own data type (see [1]).
In template-haskell ==, they made "Kind" a type alias of "Type" to
avoid duplication (see [2]).

Problem 2 Catch:
Prelude in base == discards the "catch" function. See [3] and [4]



commit 4418c6e99cfb959fddeaf6ba8d6ed258091c5ffa
Author: jwlato <>
Date: Sun Jan 16 04:04:50 2011 -0800

add some type signatures to CCNF.lhs

Ignore-this: 398ad2e31a3a5b946b22e7c19fd5c9a7


commit d2329a5999e4c6cbd280273e4cbb67be450379fd
Author: jwlato <>
Date: Sun Dec 5 11:59:35 2010 -0800

add "normOpt" result for "Arr" constructor (pure function arrows)

Ignore-this: cb14152c16918dd7073f0e2bc79b7ee6


commit e640e5a3701cff5d348cdae511a0bbd7e36aa817
Author: paul <>
Date: Mon Apr 12 21:01:06 2010 -0700

Normalize to loopD instead of loopB

Ignore-this: 104960eb5f2f07ba6871b4417fbe578c
add more test cases
add support for GHC 6.12.1
bump version to 0.1.3.


commit 6fee434ae8366b4e766c085d613fd863a01bd54c
Author: paul <>
Date: Thu Sep 10 04:48:37 2009 -0700

initial code import from CCA-0.1.1

Ignore-this: 881e07e5163079af2723890e4d84a005

Used by 1 package:
comments powered byDisqus