Ben Franksen | 25 Feb 03:05 2015

Record Puns/Wildcards

I just noted that code like

my_config = default_config {..} where
  name = "my project"
  description = "some longer text"

gives me a syntax error, even if I have NamedFieldPuns and RecordWildCards 
extensions enabled. It seems that these extensions only work for record 
constructors and not for updating values.

Is there a special reason puns/wildcards are not allowed in record updates?


"There are two ways of constructing a software design: One way is to
make it so simple that there are obviously no deficiencies and the other
way is to make it so complicated that there are no obvious deficiencies.
The first method is far more difficult."   ― C.A.R. Hoare

Glasgow-haskell-users mailing list
Glasgow-haskell-users <at>
adam vogt | 20 Feb 03:48 2015

type checker plugin success depends on whether an expression is manually inlined

Hello list,

The following file compiles with my plugin. It makes a data family
HList have role representational in a way that I believe is safe:

I expect the highlighted line to be acceptable. However, it seems that
the plugin never sees anything from line 19, when I uncomment it. Is
there something I can do to make that L19 work? Is this a known or
intentional limitation of type checker plugins?

Thomas Bereknyei | 18 Feb 16:34 2015


There is a library for TH: (broken at the moment)
There is a proposal at:

Now with AMP, is this worth revisiting? Why or why not?

Glasgow-haskell-users mailing list
Glasgow-haskell-users <at>
adam vogt | 14 Feb 11:31 2015

type checker plugin does not affect inferred type signatures


Using ghc-7.10 rc1, I am trying to write a type checker plugin that
adds wanted constraint which helps ghc to infer more types. However,
it seems that the wanted constraints I add don't get added to the
inferred type of the declaration, so that I get a type error like:

a.hs:1:1: Warning:
    Could not deduce (SameLength y x) arising from an application
    from the context (HLength x ~ HLength y)
      bound by the inferred type of
               p :: (HLength x ~ HLength y) => Proxy '(y, x)
      at a.hs:11:1-69

I think ghc should be able to figure out p :: (SameLength x y, HLength
x ~ HLength y) => Proxy '(x,y).

The code is self-contained:

git clone

cd HListPlugin/ex


Is this approach supposed to be possible, or am I supposed to rewrite
things such that I only produce CtGivenS from the plugin?


stream fusion, concatMap, exisential seed unboxing

Hi everybody,

I'm playing around with concatMap in stream fusion (the vector package
to be exact).

concatMapM :: Monad m => (a->m (Stream m b)) -> Stream m a -> Stream m b
concatMapM f (Stream ...) = ...

I can get my concatMap to behave nicely and erase all Stream and Step
constructors but due to the existential nature of the Stream seeds, they
are re-boxed for the inner stream (which is kind-of annoying given that
the seed is immediately unboxed again ;-). seq doesn't help here.

Otherwise, fusion happens for streams and vectors, so that is ok. But boxing
kills performance, criterion says.

Do we have in place that could help here? Currently I could use the
vector-concatMap which creates intermediate arrays, my version which has boxed
seeds, or hermit but that is too inconvenient for non-ghc savy users.

Viele Gruesse,

Fusing concatMapM:

concatMapM f (SM.Stream ostep t _) = SM.Stream step (Left t) Unknown
  where step (Left t) = do r <- ostep t
                           case r of
                            SM.Done       -> return $ SM.Done
                            SM.Skip    t' -> return $ SM.Skip (Left t')
                            SM.Yield a t' -> do s <- f a
                                                return $ SM.Skip (Right (s,t'))
        step (Right (SM.Stream istep s _,t)) = do r <- istep s
                                                  case r of
                                                    SM.Done       -> return $ SM.Skip    (Left t)
                                                    SM.Skip    s' -> return $ SM.Skip    (Right (SM.Stream istep s' Unknown,t))
                                                    SM.Yield x s' -> return $ SM.Yield x (Right (SM.Stream istep s' Unknown,t))
        {-# INLINE [0] step #-}
{-# INLINE [1] concatMapM #-}

testConcatMapM :: Int -> Int
testConcatMapM k = seq k $ U.unId
                 . SM.foldl' (+) 0
                 . concatMap (\i -> SM.enumFromTo 5 k)
                 $ SM.enumFromTo 3 k
{-# NOINLINE testConcatMapM #-}


testConcatMapM =
  \ k_aCA ->
    let! { I# ipv_s1xv ~ _ <- k_aCA } in
### inner loop
    letrec {
      $s$wfoldlM'_loop_s29q =
        \ sc_s29i sc1_s29j sc2_s29k ->
### unboxing
          let! { I# x_a1LA ~ _ <- sc1_s29j } in
          case tagToEnum# (<=# x_a1LA ipv_s1xv) of _ {
            False -> $s$wfoldlM'_loop1_s29c sc_s29i sc2_s29k;
            True ->
### reboxing
                (+# sc_s29i x_a1LA) (I# (+# x_a1LA 1)) sc2_s29k
### outer loop
      $s$wfoldlM'_loop1_s29c =
        \ sc_s29a sc1_s29b ->
          case tagToEnum# (<=# sc1_s29b ipv_s1xv) of _ {
            False -> sc_s29a;
            True ->
              case tagToEnum# (<=# 5 ipv_s1xv) of _ {
                False -> $s$wfoldlM'_loop1_s29c sc_s29a (+# sc1_s29b 1);
### boxed seed (I# 6)
                True -> $s$wfoldlM'_loop_s29q (+# sc_s29a 5) (I# 6) (+# sc1_s29b 1)
          }; } in
    let! { __DEFAULT ~ ww_s20G <- $s$wfoldlM'_loop1_s29c 0 3 } in
    I# ww_s20G
Greg Weber | 31 Jan 00:39 2015

Restricted Template Haskell

Hello GHC friends!

I am starting up a proposal for variants of Template Haskell that restrict what operations are available. The goal is to make TH easier for users to reason about and to allow for an easier compilation story.

Here is the proposal page:

Right now the proposal does not have any details and the goal is to write out a clear specification.
If this sounds interesting to you, let me know or leave some feedback on the wiki.

Greg Weber

Glasgow-haskell-users mailing list
Glasgow-haskell-users <at>
Austin Seipp | 27 Jan 01:13 2015

ANNOUNCE: GHC 7.10.1 Release Candidate 2

We are pleased to announce the second release candidate for GHC 7.10.1:

This includes the source tarball and bindists for 64bit/32bit Linux
and Windows. Binary builds for other platforms will be available
shortly. (CentOS 6.5 binaries are not available at this time like they
were for 7.8.x). These binaries and tarballs have an accompanying
SHA256SUMS file signed by my GPG key id (0x3B58D86F).

We plan to make the 7.10.1 release sometime in February of 2015.

Please test as much as possible; bugs are much cheaper if we find them
before the release!



Austin Seipp, Haskell Consultant
Well-Typed LLP,
harry | 25 Jan 11:18 2015

Unable to build 7.10.1 RC1 on Jessie

I'm trying to build 7.10.1 RC on Debian Jessie. I get an error:

configure: error: in
configure: error: C++ preprocessor "/lib/cpp" fails sanity check

config.log shows:

configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "libffi"
| #define PACKAGE_TARNAME "libffi"
| #define PACKAGE_VERSION "3.1"
| #define PACKAGE_STRING "libffi 3.1"
| #define PACKAGE_URL ""
| #define PACKAGE "libffi"
| #define VERSION "3.1"
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_DLFCN_H 1
| #define LT_OBJDIR ".libs/"
| /* end confdefs.h.  */
| #ifdef __STDC__
| # include <limits.h>
| #else
| # include <assert.h>
| #endif
|                    Syntax error
configure:12860: error: in
configure:12862: error: C++ preprocessor "/lib/cpp" fails sanity check

This can be reproduced by running the following commands in the
debian:jessie docker image:

apt-get update
apt-get install ncurses-dev curl gcc ghc make libgmp-dev xz-utils
| tar xJ
cd ghc-*

Any suggestions for someone who knows nothing about c or cpp?

View this message in context:
Sent from the Haskell - Glasgow-haskell-users mailing list archive at
Evan Laforge | 23 Jan 15:16 2015

template haskell vs. -prof

I ran into trouble compiling template haskell with -prof, and came
across the ghc manual "7.9.4. Using Template Haskell with Profiling".
Unfortunately I can't use its advice directly since I put profiling
and non-profiling .o files into different directories.  But in
principle it seems it should work, I just have to get ghc to load TH
from the debug build directory, which is built with -dynamic, while
continuing to load from the profile build directory.

But are there flags to get it to do that?  I'm using "-osuf .hs.o
-ibuild/profile/obj".  If I put ":build/debug/obj" on the -i line, it
still seems to find the profiling one.  The ghc manual advice probably
gets around it by using different -osufs... I guess TH somehow ignores
-osuf?  Except when I compile the debug version with osuf, if finds
them fine, so I don't really know how it works.

Is there a way I can directly tell TH where to look?  It seems awkward
to rely on all these implicit and seemingly undocumented heuristics.

And, this is somewhat beside the point, but shouldn't TH theoretically
be able to load directly from .hs and compile to bytecode like ghci
can do if it doesn't find the .o file?

And, even more beside the point, the only reason I'm messing with TH
is for a really simple (one line) multi-line string literal
quasiquote.  Surely I'm not the only person who would enjoy a
-XMultiLineStringLiteral extension?  The alternative seems to be a
program to add or strip all of the "\n\"s, and when I want to edit,
copy out, strip, edit, paste back in, add back.  At that point maybe
it's easier to just get used to all the \s... but then indentation is
all a bit off due to the leading \.
John Wiegley | 22 Jan 19:41 2015

ANN: git-monitor

git-monitor auto-commits all changes to a Git working tree, within a special
branch named "refs/snapshots/refs/heads/≤branch>".  It has no impact on the
Git repository otherwise, and will not effect your real branches.

It has the following features:

  - It is designed to be extremely resource efficient, both in CPU cost and
    memory.  I wanted something I could run several instances of on my laptop,
    without paying much of a battery cost.

    This efficiency is achieved by using gitlib with the libgit2 backend.  The
    current state of the working tree is maintained as a Git object in memory,
    and is updated in place before being written back out to disk.  Thus, the
    amount of computation done remains minimal, as we do not need to rebuild
    the Git tree at each iteration (as "git-commit" would do).

  - Whenever git-monitor is exited and restarted, the previous snapshot
    "branch" is discarded.  These are only intended to be viable during and
    between runs.

  - By having such a branch, you can easily browse through the diffs of your
    changes throughout the day.

By default, every action taken is printed to the console where git-monitor is
run, but it can also be run in silent mode, for example if you choose to
background it for the rest of the day.

Please report issues to the GitHub page.  I have been using git-monitor on a
regular basis for more than a year now, so I felt it finally deserved an
announcement here.

Thank you,
  John Wiegley (johnw on IRC/freenode)
Volker Wysk | 21 Jan 16:36 2015

How to remove a cabal package from the local system?


I have installed/registered a new version of a package with cabal by accident. 
How can I remove it again?

There is something in ~/.cabal/packages/, but the defective 
version isn't included.