Ben Franksen | 25 Feb 03:05 2015
Picon

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?

Cheers
Ben
--

-- 
"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> haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users
adam vogt | 20 Feb 03:48 2015
Picon

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:

https://github.com/aavogt/HListPlugin/blob/master/ex/Coerce.hs#L19

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?

Thanks,
Adam
Thomas Bereknyei | 18 Feb 16:34 2015
Picon

ApplicativeDo

There is a library for TH: http://hackage.haskell.org/package/applicative-quoters-0.1.0.8 (broken at the moment)
There is a proposal at: https://ghc.haskell.org/trac/ghc/wiki/ApplicativeDo

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

-Tom
_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users <at> haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users
adam vogt | 14 Feb 11:31 2015
Picon

type checker plugin does not affect inferred type signatures

Hello,

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 https://github.com/aavogt/HListPlugin

cd HListPlugin/ex

make

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

Regards,
Adam
Picon
Picon

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 s.th. 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,
Christian

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 #-}

CORE:

testConcatMapM
testConcatMapM =
  \ k_aCA ->
    let! { I# ipv_s1xv ~ _ <- k_aCA } in
### inner loop
    letrec {
      $s$wfoldlM'_loop_s29q
      $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 ->
              $s$wfoldlM'_loop_s29q
### reboxing
                (+# sc_s29i x_a1LA) (I# (+# x_a1LA 1)) sc2_s29k
          };
### outer loop
      $s$wfoldlM'_loop1_s29c
      $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.


Thanks,
Greg Weber


_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users <at> haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
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:

    https://downloads.haskell.org/~ghc/7.10.1-rc2/

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!

--

-- 
Regards,

Austin Seipp, Haskell Consultant
Well-Typed LLP, http://www.well-typed.com/
harry | 25 Jan 11:18 2015
Picon

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
`/ghc-7.10.0.20141222/libffi/build/x86_64-unknown-linux-gnu':
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_BUGREPORT "http://github.com/atgreen/libffi/issues"
| #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
`/ghc-7.10.0.20141222/libffi/build/x86_64-unknown-linux-gnu':
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
curl
http://downloads.haskell.org/~ghc/7.10.1-rc1/ghc-7.10.0.20141222-src.tar.xz
| tar xJ
cd ghc-*
./configure
make

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

--
View this message in context: http://haskell.1045720.n5.nabble.com/Unable-to-build-7-10-1-RC1-on-Jessie-tp5764254.html
Sent from the Haskell - Glasgow-haskell-users mailing list archive at Nabble.com.
Evan Laforge | 23 Jan 15:16 2015
Picon

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.

    http://hackage.haskell.org/package/git-monitor

    https://github.com/jwiegley/git-monitor

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
Picon

How to remove a cabal package from the local system?

Hi!

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/hackage.haskell.org, but the defective 
version isn't included. 

bye
V.W.

Gmane