Re: [ANNOUNCE] GHC 8.4.1 released

2018-03-09 Thread Niklas Larsson
Hi!

It says on the download page that the Windows versions is “excluding the 
Windows 10 Creator’s Update”. I’m assuming that is a copy-paste error from the 
release that fixed the Windows 10 CU bug. 

Regards,
Niklas

> 8 mars 2018 kl. 17:57 skrev Ben Gamari <b...@well-typed.com>:
> 
> 
> The GHC developers are very happy to announce the 8.4.1 release of
> Glasgow Haskell Compiler. Binary and source distributions can be found
> at
> 
>https://downloads.haskell.org/~ghc/8.4.1/
> 
> This is the third major release in the GHC 8 series. As such, the focus
> of this release is performance, stability, and consolidation.
> Consequently numerous cleanups can be seen throughout the compiler
> including,
> 
> * Further refinement of TypeInType, including significant improvements
>   in error messages.
> 
> * Improvements in code generation resulting in noticable performance
>   improvements in some types of programs.
> 
> * Core library improvements, including phase 2 of the Semigroup/Monoid
>   proposal
> 
> * Many improvements to instance deriving
> 
> * The resolution of nearly 300 other tickets
> 
> A more thorough list of the changes in this release can be found in the
> release notes,
> 
>  
> https://downloads.haskell.org/~ghc/8.4.1/docs/html/users_guide/8.4.1-notes.html
> 
> There are a few changes in release-engineering matters that should be
> noted,
> 
> * This is GHC's first release on it's new, accelerated release
>   schedule. From now on GHC will produce one release every six months.
> 
> * While we typically strive to produce OpenBSD builds, the gcc shipped
>   with OpenBSD 6.1 is unfortunately too old to compile this release.
> 
> * FreeBSD builds are still in progress
> 
> This release has been the result of approximately six months of work by
> over one hundred code contributors. Thanks to everyone who has helped in
> writing patches, testing, reporting bugs, and offering feedback over the
> last year.
> 
> As always, let us know if you encounter trouble.
> 
> 
> How to get it
> ~
> 
> The easy way is to go to the web page, which should be self-explanatory:
> 
>http://www.haskell.org/ghc/
> 
> We supply binary builds in the native package format for many
> platforms, and the source distribution is available from the same
> place.
> 
> Packages will appear as they are built - if the package for your
> system isn't available yet, please try again later.
> 
> 
> Background
> ~~
> 
> Haskell is a standard lazy functional programming language.
> 
> GHC is a state-of-the-art programming suite for Haskell.  Included is
> an optimising compiler generating efficient code for a variety of
> platforms, together with an interactive system for convenient, quick
> development.  The distribution includes space and time profiling
> facilities, a large collection of libraries, and support for various
> language extensions, including concurrency, exceptions, and foreign
> language interfaces. GHC is distributed under a BSD-style open source license.
> 
> A wide variety of Haskell related resources (tutorials, libraries,
> specifications, documentation, compilers, interpreters, references,
> contact information, links to research groups) are available from the
> Haskell home page (see below).
> 
> 
> On-line GHC-related resources
> ~~
> 
> Relevant URLs on the World-Wide Web:
> 
> GHC home page  http://www.haskell.org/ghc/
> GHC developers' home page  http://ghc.haskell.org/trac/ghc/
> Haskell home page  http://www.haskell.org/
> 
> 
> Supported Platforms
> ~~~
> 
> The list of platforms we support, and the people responsible for them,
> is here:
> 
>   http://ghc.haskell.org/trac/ghc/wiki/Contributors
> 
> Ports to other platforms are possible with varying degrees of
> difficulty.  The Building Guide describes how to go about porting to a
> new platform:
> 
>http://ghc.haskell.org/trac/ghc/wiki/Building
> 
> 
> Developers
> ~~
> 
> We welcome new contributors.  Instructions on accessing our source
> code repository, and getting started with hacking on GHC, are
> available from the GHC's developer's site run by Trac:
> 
>  http://ghc.haskell.org/trac/ghc/
> 
> 
> Mailing lists
> ~
> 
> We run mailing lists for GHC users and bug reports; to subscribe, use
> the web interfaces at
> 
>http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users
>http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
> 
> There are several other haskell a

Re: Proposal process status

2016-07-20 Thread Niklas Larsson


> 20 juli 2016 kl. 19:38 skrev amin...@gmail.com:
> 
> 
> 
>> El 20 jul 2016, a las 12:45, Ben Gamari <b...@well-typed.com> escribió:
>> 
>> Iavor Diatchki <iavor.diatc...@gmail.com> writes:
>> 
>>> Hello Ben,
>>> 
>>> I posted this when you originally asked for feed-back, but perhaps it
>>> got buried among the rest of the e-mails.
>> Indeed it seems that way. Sorry about that!
>> 
>>> I think the proposal sounds fairly reasonable, but it is hard to say how
>>> well it will work in practice until we try it, and we should be ready to
>>> change it if needs be.
>> Right. I fully expect that we will have to iterate on it.
>> 
>>> Some clarifying questions on the intended process:
>>> 1.  After submitting the initial merge request, is the person making the
>>> proposal to wait for any kind of acknowledgment, or just move on to step 2?
>> The discussion phase can happen asynchronously from any action by the
>> Committee. Of course, the Committee should engauge in discussion early,
>> but I don't think any sort of acknowledgement is needed. An open pull
>> request should be taken to mean "let's discuss this idea."
>> 
>>> 2. Is the discussion going to happen on one of the mailing lists, if so
>>> which?   Is it the job of the proposing person to involve/notify the
>>> committee about the discussion?  If so, how are they to find out who is on
>>> the committee?
>> 
>> The proposed process places the discussion in a pull request. The idea
>> here is to use well-understood and widely-used code review tools to
>> faciliate the conversation.
> 
> This part runs strongly against the grain of what I'd prefer: email is 
> lightweight, decentralized, standard, and has many clients. We can read 
> discussion of Haskell proposals any way we like. Github on the other hand 
> only allows us to read issues by going to Github, and using whatever 
> interface Github has given us (which personally I find very annoying, esp. on 
> mobile). In addition, reading proposals offline becomes very difficult. Many 
> of us read discussion when commuting, where, e.g. in NYC, there isn't cell 
> service.
> 
> For reviewing code that implements a proposal, I'm a lot more flexible 
> (although again I'm not a fan of Github)
> 
> For the people who like having history tracked with git: gitit is a 
> possibility, and is written in Haskell.
> 
> Tom
> 

It's possible both follow and contribute to issues in a github repo via email. 
I do it all the time for Idris.

// Niklas

> 
> 
>> The Committee members will be notified of the open pull request by the
>> usual event notification mechanism (e.g. in GitHub one can subscribe to
>> a repository).
>> 
>>> 3. How does one actually perform step 3, another pull request or simply
>>> an e-mail to someone?
>> The opening of the pull request would mark the beginning of the
>> discussion period. When the author feels that the discussion has come to
>> something of a conclusion, they will request that the GHC Committee
>> consider the proposal for acceptable by leaving a comment on the pull
>> request.
>> 
>>> Typo: two separate bullets in the proposal are labelled as 4.
>> I believe this should be fixed now. Thanks!
>> 
>> Cheers,
>> 
>> - Ben
>> 
>> ___
>> Glasgow-haskell-users mailing list
>> Glasgow-haskell-users@haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users
> ___
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users@haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users


[Haskell] ANNOUNCE: call-haskell-from-anything 1.0

2016-01-30 Thread Niklas Hambüchen
Heya,

I'm happy to announce a new release of call-haskell-from-anything [1],
my library for FFI-via-serialisation that allows to easily call Haskell
functions from any other language that can open shared object files
(`.so` via `dlopen()`) and has a MessagePack library available.

This is almost all programming languages; for examples for Python and
Ruby see [2].

The FFI-via-serialisation approach makes it possible to export most
functions to other languages "for free": no FFI type unpacking
boilerplate, everything that has a MessagePack instance (much easier to
write than `Storable` instances) will do.

For example if you have a function

  chooseMax :: [Int] -> Int

all you have do to make it callable is

  foreign export ccall chooseMax_export :: CString -> IO CString
  chooseMax_export = export chooseMax

Version 1.0 uses closed type families to remove the restriction that so
far, pure functions has to be wrapped into the Identity monad to be
exported:

  a -> b -> ... -> Identity r

With 1.0, this is no longer necessary. You can now export any function
of type

  a -> b -> ... -> r

to be called from your favourite Haskell contender languages (of course
those have no chance ...).

Cheers,
Niklas

[1]: https://hackage.haskell.org/package/call-haskell-from-anything-1.0.0.0
[2]: https://github.com/nh2/call-haskell-from-anything
___
Haskell mailing list
Haskell@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell


SV: [Haskell-cafe] RFC: Native -XCPP Proposal

2015-05-08 Thread Niklas Larsson
If the intention is to use cpphs as a library, won't the license affect every 
program built with the GHC API? That seems to be a high price to pay.


- Ursprungligt meddelande -
Från: Herbert Valerio Riedel hvrie...@gmail.com
Skickat: ‎2015-‎05-‎08 11:02
Till: Christian Maeder c.mae...@jacobs-university.de
Kopia: Malcolm Wallace malcolm.wall...@cs.york.ac.uk; 
glasgow-haskell-users@haskell.org glasgow-haskell-users@haskell.org; 
librar...@haskell.org librar...@haskell.org; ghc-d...@haskell.org 
ghc-d...@haskell.org; haskell-cafe haskell-c...@haskell.org
Ämne: Re: [Haskell-cafe] RFC: Native -XCPP Proposal

Hello Christian,

(I've re-CC'ed haskell-cafe, assuming this wasn't deliberate)

On 2015-05-08 at 09:50:46 +0200, Christian Maeder wrote:
 using cpphs is the right way to go!

 Rewriting it from scratch may be a good exercise but is (essentially) a
 waste of time.

 However, always asking Malcolm to get source changes into cpphs would
 be annoying.

 Therefore it would be great if the sources were just part of the ghc
 sources (under git).

 Another problem might be the dependency polyparse that is currently
 not part of the core libraries.

A scheme was actually discussed privately to address this:

We certainly don't want to expose cpphs/polyparse (and text!) as new
packages in GHC's global pkg-db. Which we'd end up, if we handled cpphs
as the other exposed boot libraries.

Therefore we'd only use the few relevant modules from cpphs/polyparse as
other-modules (i.e. internal hidden dependencies -- i.e. we wouldn't
use cpphs/polyparse's .cabal files) compiled into GHC, but not
exposed. We'd either create a new Git submodule to hold our fork of
cpphs/polyparse, or just add it somewhere inside ghc.git

 (I guess that replacing polyparse by something else would also be a nice
 exercise.)

 So (for me) the only question is, if Malcolm is willing to transfer
 control over cpphs to the haskell-community (or ghc head) - of course
 with due acknowledgements!

I don't think this will be necessary, as we don't need the
cpphs-upstream to mirror each modifications immediately. The benefit of
the scheme described above is that we'd be somewhat decoupled from cpphs'
upstream, and can freely experiment in our fork, and can sync up with
Malcolm from time to time to merge improvements in both directions.

-- hvr
___
ghc-devs mailing list
ghc-d...@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users


Re: [Haskell] [ANN] cabal-dev officially deprecated in favor of cabal sandboxes

2014-09-24 Thread Niklas Hambüchen
On 24/09/14 00:59, Jonathan Daugherty wrote:
 I'm pleased to announce (really!) that cabal-dev is being deprecated in
 favor of cabal sandboxes.

It might also make sense to tag
http://hackage.haskell.org/package/cabal-dev as a deprecated package.
___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell


Re: [Haskell] [accelerate-haskell] [ANN] accelerate-0.15

2014-09-15 Thread Niklas Hambüchen
Excellent!

Now here comes my number 1 feature request for the next version:

IO/ST arrays/computations in accelerate, so that I can implement stuff
that can work on a 1GB device array with interleaved IO, without having
to download and-re-upload that array every time.

Keep up the good work!
___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell


[Haskell] ANNOUNCE: hemokit 0.6.3 - Now with OpenVibe compatibility

2014-08-31 Thread Niklas Hambüchen
Heya,

out is Hemokit 0.6.3, which can now be connected to the OpenVibe EEG
framework.

OpenVibe allows fancy stuff like spelling words with your mind:
  Video: https://www.youtube.com/watch?v=08GNE6OdNcs
  Docs: http://openvibe.inria.fr/coadapt-p300-stimulator-tutorial

There is a new tutorial on how to set up Hemokit+OpenVibe at:
  https://github.com/nh2/hemokit/wiki/OpenVibe

If you set up something cool with that, don't forget to tell me about it!

Grab Hemokit:
  https://hackage.haskell.org/package/hemokit

Stand-alone Linux and Windows binaries are also available:
  https://github.com/nh2/hemokit/releases
___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell


Re: GHC 7.8.3 release

2014-05-27 Thread Niklas Larsson
Hi!

It would be great if the patch I added on #9080 was put into 7.8.3 (well, I
guess someone has to commit it to master first).

Niklas


2014-05-27 10:06 GMT+02:00 Austin Seipp aus...@well-typed.com:

 Hello all,

 After a long week, I've finally gotten a little time to reply to
 emails, and I mainly have one question I'd like to ask.

 First, please direct your attention to this:


 https://ghc.haskell.org/trac/ghc/query?status=closedstatus=mergestatus=patchmilestone=7.8.3group=resolutioncol=idcol=summarycol=ownercol=typecol=prioritycol=componentcol=versionorder=priority

 This is the 7.8.3 milestone, but it only considers things that are:

  - 1) Fixed
  - 2) Going to be merged
  - 3) Are a patch to be still merged.

 That is, it is a solid representation of the difference between 7.8.2
 and the 7.8 branch tip.

 The question is: when should we do the release? There are several bugs
 there that seem quite problematic for users - #9045, #7097, #9001,
 #8768 and #9078 in particular.

 If these bugs are really problematic (and I sort of feel they are)
 then the release can happen soon. I can do it within a week from now,
 and we could punt more to a 7.8.4 release.

 I ask this because my time to dedicate to GHC is a bit thin right now,
 so you must help me decide what's important! So please let me know -
 just a general vote in favor of doing it within some X timeframe (even
 'real soon' or 'a week would be great') would be nice.

 PS: I apologize for the lack of status updates and brief email - my
 time for GHC has been in very short order the past two weeks in
 particular, and I've finally just returned to a computer (not mine)
 for right now to ask this.

 PPS: This might also impact the 7.10 schedule, but last Simon and I
 talked, we thought perhaps shooting for ICFP this time (and actually
 hitting it) was a good plan. So I'd estimate on that a 7.8.4 might
 happen a few months from now, after summer.

 --
 Regards,

 Austin Seipp, Haskell Consultant
 Well-Typed LLP, http://www.well-typed.com/
 ___
 Glasgow-haskell-users mailing list
 Glasgow-haskell-users@haskell.org
 http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: RFC: include a cabal-install executable in future GHC releases

2014-05-04 Thread Niklas Larsson
Hi!

I put a Windows build here:
https://www.dropbox.com/s/at7wc1dh0lfr7lc/cabal.exe.zip

Niklas
2014-05-04 2:24 GMT+02:00 Johan Tibell johan.tib...@gmail.com:

 I just uploaded 1.20.0.1 so there's only an OS X binary so far. I'm
 waiting for someone to send me a Windows one.


 On Sun, May 4, 2014 at 2:06 AM, Ashley Yakeley ash...@semantic.orgwrote:

 I couldn't find them, and they're not listed at 
 http://www.haskell.org/cabal/download.html (except OS X), or at 
 http://www.haskell.org/haskellwiki/Cabal-Install, or at 
 http://hackage.haskell.org/package/cabal-install.

 -- Ashley


 On 2014-05-03 17:00, Carter Schonwald wrote:

 I think there's now hosted official cabal install binaries online.  I'm
 Afk but they should be a short google away. Should be linked more
 prominently though

 On Saturday, May 3, 2014, Ashley Yakeley ash...@semantic.org mailto:
 ash...@semantic.org wrote:

 So I want to install GHC + cabal on a new system, building cabal
 packages with profiling and documentation. Here's what I have to do:

 1. Download, unpack and install GHC.

 2. Download and unpack cabal-install, and run bootstrap.sh. As
 part of the bootstrap, it will download and build a bunch of
 packages.

 3. Delete the downloaded packages (rm -rf ~/.ghc/*) because they
 were built without profiling or documentation.

 4. Call cabal update to get a default .cabal/config file.

 5. Edit .cabal/config to switch on library-profiling,
 executable-profiling, and documentation.

 6. Build my stuff.

 This would be much simplified if binary versions of cabal-install
 were available. (It would be even simpler if they were just
 included in the GHC builds -- I could eliminate 2  3.)

 -- Ashley Yakeley
 ___
 Glasgow-haskell-users mailing list
 Glasgow-haskell-users@haskell.org
 http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


 ___
 Glasgow-haskell-users mailing list
 Glasgow-haskell-users@haskell.org
 http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



 ___
 Glasgow-haskell-users mailing list
 Glasgow-haskell-users@haskell.org
 http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


SV: Haskell Support on Windows

2014-03-31 Thread Niklas Larsson
Seems to me that a less pessimistic solution would be to set up a windows 
buildbot. 

Niklas

- Ursprungligt meddelande -
Från: harry volderm...@hotmail.com
Skickat: ‎2014-‎03-‎31 14:27
Till: glasgow-haskell-users@haskell.org glasgow-haskell-users@haskell.org
Ämne: Haskell Support on Windows

I've been getting the impression that a lot of the stickier GHC bugs are
Windows specific, while very few GHC hackers actually use Windows, other
than to ensure that GHC works on it.

Windows is already somewhat of a second-class citizen in Hackage, where
platform-sensitive packages tend to only work out-of-the box on Linux.
Perhaps it should be demoted to second-tier GHC support as well, at least
to the extent that Windows bugs won't hold up a release?

(I write this as a Windows user who also manages some Linux servers. I agree
that Windows support is important, but it seems to be unreasonably taking
far more than it gives.)



--
View this message in context: 
http://haskell.1045720.n5.nabble.com/Haskell-Support-on-Windows-tp5746711.html
Sent from the Haskell - Glasgow-haskell-users mailing list archive at 
Nabble.com.
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


SV: PROPOSAL: Literate haskell and module file names

2014-03-17 Thread Niklas Larsson
I tested and it works on Windows. 

Niklas

- Ursprungligt meddelande -
Från: Brandon Allbery allber...@gmail.com
Skickat: ‎2014-‎03-‎17 14:22
Till: Edward Kmett ekm...@gmail.com
Kopia: glasgow-haskell-users@haskell.org glasgow-haskell-users@haskell.org; 
haskell-pr...@haskell.org Prime haskell-pr...@haskell.org
Ämne: Re: PROPOSAL: Literate haskell and module file names

On Mon, Mar 17, 2014 at 9:08 AM, Edward Kmett ekm...@gmail.com wrote:

Foo+rst.lhs does nicely dodge the collision with jhc. 


Is this legal on Windows?


-- 

brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: [Haskell] [Haskell-cafe] ANNOUNCE: Haskell Pdf Presenter (hpdfp) 0.2.2

2013-11-14 Thread Niklas Hambüchen
On 14/11/13 08:14, Michael D. Adams wrote:
 When the program is doing background rendering, it will go to 100% CPU
 time, but once the background rendering completes, it should settle
 down to almost no CPU usage at all (my task manager literally shows 0%
 CPU once pre-rending completes).
 
 Does this high CPU usage happen even when you don't load a PDF?
 
 After loading a PDF, there will be a small progress bar that races
 across the bottom of the presenter window.  This represents the
 pre-rendering process.  Does the CPU usage lower after that process
 completes?  (If you need to run the experiment a few times, note that
 pressing Ctrl-R will flush the cache and re-trigger pre-rending.)

You are right, it is the background rendering.

I accidentally re-triggered it multiple times by re-sizing the window.

Thanks for your explanation!
___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell


Re: [Haskell] [Haskell-cafe] ANNOUNCE: Haskell Pdf Presenter (hpdfp) 0.2.2

2013-11-13 Thread Niklas Hambüchen
That is great, I've been interested in that program since your POPL 
talk.

One problem I've had with it so far:
It takes 100% CPU time when idle, which makes my laptop go quite hot.
Any idea why that could be?

On Wed 13 Nov 2013 18:16:48 GMT, Michael D. Adams wrote:
 ANNOUNCE: Haskell Pdf Presenter (hpdfp) 0.2.2

 I'm pleased to announce the first public release of the Haskell Pdf
 Presenter (hpdfp).

 Project home page:
   http://michaeldadams.org/projects/haskell-pdf-presenter/

 Project on Hackage:
   http://hackage.haskell.org/package/haskell-pdf-presenter/

 Project repository:
   http://michaeldadams.org/repos-pub/hg/haskell-pdf-presenter/

 What it is
 ==
 The Haskell Pdf Presenter (hpdfp) is a tool for presenting PDF-based
 slide shows.  For example, as a presenter, I like to see the next slide
 before it is shown to the audience as well as how much allotted time
 remains.  I was never quite satisfied with the existing tools for this,
 so I wrote my own and hpdfp is the result.

 Though I originally wrote it for my own use, the tool has matured over
 time, and I now wish to share it with others.  Aside from being a
 useful tool, I think hpdfp is a good example of elegance and economy
 in program design.  Despite being only a thousand lines long, this
 program is full of features that may not be obvious at first glance so
 please be sure to look at the available help.

 Status
 ==
 I've been using this tool in my own talks for over a year now, and
 it is fairly stable and feature complete.  I've only tested it on
 Ubuntu so I don't know if it ports to other platforms.  I'd love to
 hear any field reports about how it runs on other platforms.

 Future Directions
 =
 I have a long TODO list of ideas I may implement in the future, but
 most development has been driven by the practical considerations that
 I discover as I use the tool.  If you have a use case for a particular
 feature, please let me know.

 

 Feature requests, bug reports, suggestions or feedback as well as
 contributions to the documentation or implementation are most welcome.

 Michael D. Adams
 ___
 Haskell-Cafe mailing list
 haskell-c...@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe
___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell


Re: [Haskell-cafe] ordNub

2013-10-13 Thread Niklas Hambüchen
On 13/10/13 21:42, AntC wrote:
 Niklas Hambüchen mail at nh2.me writes:

 In sets, the order does not matter, while for nub it does.

 
 Let's be careful here!. Niklas, when you say order, do you mean:
 * the _ordering_ from the Ord instance? Or
 * the relative sequence of elements in the list?
 
 ... the fact that Set is used inside my proposed 
 ordNub implementation is a detail not visible to the caller.
 
 If you use the Set library, that fact may be very visible!
 Because Set re-sequences the whole list, as per its Ord instance.
 
 But List.nub preserves the list sequence (except for omitting duplicates).

I mean *exactly* what you say here.

ordNub behaves has the same behaviour as nub, while (Set.toList .
Set.fromList) doesn't.

 [BTW I am still less than convinced that overall a Set-based ordNub is 
 significantly more efficient. I suspect it depends on how big is your 
 list.]

What do you mean?

ordNub is clearly in a different complexity class, and the benchmarks
that I provided show not only this, but also that ordNub is *always*
faster than nub, even for singleton lists.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ordNub

2013-10-13 Thread Niklas Hambüchen
On 14/10/13 03:20, AntC wrote:
 Thanks Niklas, I hadn't spotted those benchmarks back in July.

No worries :)

 I'm surprised at that result for singletons 
 (and for very small numbers of elements which are in fact each different).

I think one of the main reasons for the performance difference is that a
list node and a Set binary tree node have pretty much the same
performance, with the difference that in


http://hackage.haskell.org/package/containers-0.5.2.1/docs/src/Data-Set-Base.html

   data Set a = Bin {-# UNPACK #-} !Size !a !(Set a) !(Set a) | Tip

there are strictness and unpack annotations, while for

   data [a] = [] | a : [a] -- pseudo syntax

there are not.

Good for us in this case, I guess.

 It seems to me that for small numbers, the Set-based approach still 
 requires comparing each element to each other.

This I don't understand.

 Then here's a further possible optimisation, instead of making separate 
 calls to `member` and `insert`:

This I understand again. Where do you get insert' from? containers
doesn't seem to have it. Do you suggest adding it?

Niklas
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ordNub

2013-10-12 Thread Niklas Hambüchen
I would like to come back to the original question:

How can ordNub be added to base?

I guess we agree that Data.List is the right module for a function of
type Ord a = [a] - [a], but this introduces

* a cyclic dependency between Data.List and Data.Set
* a base dependency on containers.

What is the right way to go with that?

Should ordNub be introduced as part of Data.Set, as Conrad suggested?

It does not really have anything to do with Set, apart from being
implemented with it.

On 14/07/13 14:12, Roman Cheplyaka wrote:
 Something like that should definitely be included in Data.List.
 Thanks for working on it.
 
 Roman
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ordNub

2013-10-12 Thread Niklas Hambüchen
On 12/10/13 20:43, Anthony Cowley wrote:
 I think nub's behavior is rather set-related, so I don't really understand 
 the objection to putting it in Data.Set.

In sets, the order does not matter, while for nub it does.

nub:: Eq a  = [a] - [a]
ordNub :: Ord a = [a] - [a]

both do not mention Set, and the fact that Set is used inside my
proposed ordNub implementation is a detail not visible to the caller.

That's why it looks like a Data.List function to me.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Lenses that work with Arrows

2013-10-07 Thread Niklas Haas
On Mon, 7 Oct 2013 10:40:13 +0100, Tom Ellis 
tom-lists-haskell-cafe-2...@jaguarpaw.co.uk wrote:
 Dear all,
 
 I introduce a very simple extension to the Lens datatype from Control.Lens
 that allows it to work with Arrows:
 
 https://gist.github.com/tomjaguarpaw/6865080
 
 I would particularly like to discuss this with authors of Control.Lens to
 see if such an idea is suitable for inclusion in their library.
 
 I have also started a Reddit discussion here:
 
 
 http://www.reddit.com/r/haskell/comments/1nwetz/lenses_that_work_with_arrows/
 
 Tom
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

The reason we don't tend to have combinators like ‘view’ or ‘over’
generalized in their return profunctor like that is because you very
quickly run into type ambiguity issues.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Seeking Control.Lens Combinator

2013-10-05 Thread Niklas Haas
On Fri, 4 Oct 2013 16:23:23 -0700, Charlie Paul charli...@gmail.com wrote:
 Hello,
 
 I'm looking for a combinator along the lines of
 () :: Lens' a b - Lens' a b' - Lens' a (b,b')
 I can see how it could lead to lenses that don't follow the laws, but
 for Lenses which are somehow independent (like _1 and _2), it works
 perfectly well. Is there a way in lens to specify this independence?

If you don't mind violating the laws (ie. ensuring you access fields
non-independently),  then you could do this manually with a
splitting/joining “isomorphism” at one end, and joining the other lenses
using ‘alongside’. For example:

iso (join (,)) (fst *** snd).alongside _1 _2 :: Lens (a,b) (a',b') (a,b) (a',b')

Of course, this particular lens is utterly trivial (it's just id). And I'm
not sure how much sense it makes to extend this pattern to more
complicated cases.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Using lenses

2013-10-03 Thread Niklas Haas
Another great use of lenses is the lens-aeson library (not to be
confused with aeson-lens). It's technically based around prisms, though,
so it's outside the scope of your talk; but you may wish to at least
reference it - it makes working with JSON really elegant!
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Using lenses

2013-10-03 Thread Niklas Haas
On Thu, 3 Oct 2013 22:06:22 +1000, Tony Morris tmor...@tmorris.net wrote:
 Lenses for nested sum types e.g. Either.

I think those would be leaning more in the direction of prisms.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Any precedent or plan for guaranteed-safe Eq and Ord instances?

2013-10-02 Thread Niklas Haas
On Wed, 2 Oct 2013 15:46:42 +0200, Stijn van Drongelen rhym...@gmail.com 
wrote:
 I do think something has to be done to have an Eq and Ord with more strict
 laws.
 
 * Operators in Eq and Ord diverge iff any of their parameters are bottom.
 * The default definitions of (/=), (), () and `compare` are law.
 * (==) is reflexive and transitive
 * (=) is antisymmetric ((x = y  y = x) `implies` (x == y))
 * (=) is 'total' (x = y || y = x)
 * (=) is transitive
 
 Currently, reflexivity of (==) is broken in the Prelude (let x = 0/0 in x
 == x). I know this is for IEEE 754 compliance, but c'mon, this is Haskell,
 we can have better ways of dealing with NaNs.

Like making Double not be an instance of Eq?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Lifting IO actions into Applicatives

2013-10-01 Thread Niklas Haas
On Tue, 1 Oct 2013 02:21:13 -0500, John Lato jwl...@gmail.com wrote:
 It's not a solution per se, but it seems to me that there's no need for the
 Monad superclass constraint on MonadIO.  If that were removed, we could
 just have
 
 class LiftIO t where
 liftIO :: IO a - t a
 
 and it would Just Work.

One concern with this is that it's not exactly clear what the semantics
are on LiftIO (is liftIO a  liftIO b equal to liftIO (a  b) or not?)
and the interaction between LiftIO and Applicative/Monad would have to
be some sort of ugly ad-hoc law like we have with Bounded/Enum etc.

Furthermore, you might end up specifying a lot of ‘redundant’
constraints like (Monad m, LiftIO m) that way, just a thing to keep in
mind.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] FFI: how to handle external dll crashes

2013-09-23 Thread Niklas Hambüchen
If you cannot do it with Haskell exceptions, I guess you need to look 
how you would do it in plain C in do the same.

Keep in mind that if something crashes in a C library, that library 
might have corrupted (or leaked) any memory it had access to.

I guess a somewhat reliable way is to fork an OS process, and run your 
crashy DLL in that; if it dies, the OS will keep care of cleaning up 
the low level garbage.

On Mon 23 Sep 2013 17:37:49 SGT, Miro Karpis wrote:
 Please, can you help me with following: I have an external dll that
 I'm importing in my haskell program. In some particular cases the dll
 crashes.

 Simplified: first I need to send to dll with MethodA some parameters
 and then call MethodB to do some calculations on those parameters. If
 I didn't give enough parameters then MethodB will crash the whole dll
 and my Haskell application.

 Is there a way to handle this? Unfortunately there are no exceptions
 thrown from the dll.

 In ghci I'm getting following message: ERROR in
 InitNumericalSystem::initializeSystem. JuncLabel.

 I have tried to use catchAny but that didn't help. c_run is my
 external dll method which takes 4 input parameters:

 catchAny :: IO a - (SomeException - IO a) - IO a
 catchAny = Control.Exception.catch

 main :: IO ()
 main = do
   let timeTot = []::[CDouble]
   timeNow = []::[CDouble]
   runType = 2::CInt
   timeTotPtr - newArray timeTot
   timeNowPtr - newArray timeNow
   result - (catchAny $ c_run timeTotPtr runType timeNowPtr 0) $ \e - do
 putStrLn $ Got an exception:  ++ show e
 putStrLn Returning dummy value of -1
 return (-1)
   free timeTotPtr
   free timeNowPtr
   print result



 I have tried also with withAsync, and no luck

 tryAny :: IO a - IO (Either SomeException a)
 tryAny action = withAsync action waitCatch

 catchAny :: IO a - (SomeException - IO a) - IO a
 catchAny action onE = tryAny action = either onE return

 try2 :: IO ()
 try2 = do
   let timeTot = []::[CDouble]
   timeNow = []::[CDouble]
   runType = 2::CInt
   timeTotPtr - newArray timeTot
   timeNowPtr - newArray timeNow
   putStrLn $ c_run going to call c_run..
   result - catchAny (c_run timeTotPtr runType timeNowPtr 0)
 (const $ return (-1))
   free timeTotPtr
   free timeNowPtr
   putStrLn $ Result:  ++ show result


 Is there a way how I can handle this?

 cheers,
 m.


 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] FFI: how to handle external dll crashes

2013-09-23 Thread Niklas Hambüchen
Hey,

I don't think any of your code actually forks of an *OS process*.

There three main kinds of threading constructs:

* Haskell threads (forkIO)
* Operating System threads (forkOS)
* Operating System processes (forkProcess, fork() in C)

Async uses the first one, you will need last one (which is similar to
effectively start two Haskell programs).

On 23/09/13 20:41, Miro Karpis wrote:
 Hi Niklas,
 I think that I'm doing this in my try2 function with tryAny and catchAny
 functions. Unfortunately that didn't work. I'm just starting with
 Haskell so maybe also my implementation of my haskell code is not 100%
 correct.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Readable GHC 7.6.3 docs (Bootstrapped)

2013-09-11 Thread Niklas Hambüchen
Looks pleasing! I have one feature request:

Could you make headings links, or add anchors next to them (github 
readme style), such that I can directly share what I'm reading with 
people?

On Wed 11 Sep 2013 20:31:30 JST, Obscaenvs wrote:
 At [1] you can find links to the GHC documentation that I use myself,
 since the official version is a bit too TimesNewRoman-y for my
 ...developed taste. It available in a downloadable Bzipped TAR aswell
 as being browsable online.

 [1] http://bugthunk.net/

 /fredrik
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Proposal: New syntax for Haskell

2013-09-10 Thread Niklas Hambüchen
Impressed by the productivity of my Ruby-writing friends, I have
recently come across Cucumber: http://cukes.info


It is a great tool for specifying tests and programs in natural
language, and especially easy to learn for beginners.

I propose that we add a Cucumber syntax for Haskell, with the extension
.chs, next to .hs and .lhs.


Code written in cucumber syntax is concise and easy to read: You can
find some example code in https://gist.github.com/nh2/6505995. Quoting
from that:

  Feature: The Data.List module

In order to be able to use lists
As a programmer
I want a module that defines list functions

Scenario: Defining the function foldl
  Given I want do define foldl
  Which has the type (in brackets) a to b to a (end of brackets),
 to a, to list of b, to a
  And my arguments are called f, acc, and l
  When l is empty
  Then the result better be acc
  Otherwise l is x cons xs
  Then the result should be foldl f (in brackets) f acc x
(end of brackets) xs


PS: People even already started a testing framework for Haskell in it:
https://github.com/sol/cucumber-haskell#cucumber-for-haskell

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GHC API + Cabal API + Cabal version checks: is there a way out?

2013-09-07 Thread Niklas Hambüchen
Would you mind hanging around in #ghc when working on it?

A few people found this interesting, so this might be useful to avoid 
duplicate effort.

On Sat 07 Sep 2013 18:24:43 JST, JP Moresmau wrote:
 I'll be happy to give it a shot!


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GHC API + Cabal API + Cabal version checks: is there a way out?

2013-09-06 Thread Niklas Hambüchen
On Fri 06 Sep 2013 22:13:58 JST, Yuri de Wit wrote:
 The right solution, imho, is to review these dependencies and move
 the low level ones out into a separate package that is shared by both
 ghc and cabal and that will rarely change. The direct side effect of
 this is that ghc would not be tied directly to a specific cabal
 version and you would not have to deal with this issue.

This sounds very right to me.

There should be something that describes what a GHC package database 
is, as minimally as possible (perhaps even only the data types).

In the end, ghc is the defining side here - cabal is only a tool that 
builds on top of these definitions.

Then ghc could finally be decoupled from Cabal.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GHC API + Cabal API + Cabal version checks: is there a way out?

2013-09-06 Thread Niklas Hambüchen
On Fri 06 Sep 2013 22:52:40 JST, Roman Cheplyaka wrote:
 The right solution for Cabal would be not to know anything about the
 GHC's database format at all.

 GHC and cabal communicate via a command line interface (`ghc-pkg dump`
 in our direction; `ghc-pkg update` in the other). So it would suffice to
 have a library which implements parsing and printing of the package
 description, and have that library shared between GHC and Cabal.

You are right. This is better.

GHC's dependency on cabal seems to actually be quite minimal!

I did a quick grep:

% grep -rI import Distribution --include *.hs --include *.lhs* . 
| grep -v libraries/ | grep -v Setup.hs | grep -v Setup.lhs | grep -v 
utils/haddock
./utils/ghc-cabal/Main.hs:import Distribution.PackageDescription
./utils/ghc-cabal/Main.hs:import Distribution.PackageDescription.Check 
hiding (doesFileExist)
./utils/ghc-cabal/Main.hs:import 
Distribution.PackageDescription.Configuration
./utils/ghc-cabal/Main.hs:import Distribution.PackageDescription.Parse
./utils/ghc-cabal/Main.hs:import Distribution.System
./utils/ghc-cabal/Main.hs:import Distribution.Simple
./utils/ghc-cabal/Main.hs:import Distribution.Simple.Configure
./utils/ghc-cabal/Main.hs:import Distribution.Simple.LocalBuildInfo
./utils/ghc-cabal/Main.hs:import Distribution.Simple.Program
./utils/ghc-cabal/Main.hs:import Distribution.Simple.Program.HcPkg
./utils/ghc-cabal/Main.hs:import Distribution.Simple.Utils 
(defaultPackageDesc, writeFileAtomic, toUTF8)
./utils/ghc-cabal/Main.hs:import Distribution.Simple.Build 
(writeAutogenFiles)
./utils/ghc-cabal/Main.hs:import Distribution.Simple.Register
./utils/ghc-cabal/Main.hs:import Distribution.Text
./utils/ghc-cabal/Main.hs:import Distribution.Verbosity
./utils/ghctags/Main.hs:import Distribution.Simple.GHC ( 
componentGhcOptions )
./utils/ghctags/Main.hs:import Distribution.Simple.Configure ( 
getPersistBuildConfig )
./utils/ghctags/Main.hs:import Distribution.Simple.Compiler ( 
compilerVersion )
./utils/ghctags/Main.hs:import Distribution.Simple.Program.GHC ( 
renderGhcOptions )
./utils/ghctags/Main.hs:import Distribution.PackageDescription ( 
library, libBuildInfo )
./utils/ghctags/Main.hs:import Distribution.Simple.LocalBuildInfo
./utils/ghc-pkg/Main.hs:import 
Distribution.InstalledPackageInfo.Binary()
./utils/ghc-pkg/Main.hs:import Distribution.ModuleName hiding (main)
./utils/ghc-pkg/Main.hs:import Distribution.InstalledPackageInfo
./utils/ghc-pkg/Main.hs:import Distribution.Compat.ReadP
./utils/ghc-pkg/Main.hs:import Distribution.ParseUtils
./utils/ghc-pkg/Main.hs:import Distribution.Package hiding (depends)
./utils/ghc-pkg/Main.hs:import Distribution.Text
./utils/ghc-pkg/Main.hs:import Distribution.Version
./compiler/ghci/Linker.lhs:import Distribution.Package hiding (depends, 
PackageId)
./compiler/main/Packages.lhs:import Distribution.InstalledPackageInfo
./compiler/main/Packages.lhs:import 
Distribution.InstalledPackageInfo.Binary
./compiler/main/Packages.lhs:import Distribution.Package hiding 
(PackageId,depends)
./compiler/main/PackageConfig.hs:import 
Distribution.InstalledPackageInfo
./compiler/main/PackageConfig.hs:import Distribution.ModuleName
./compiler/main/PackageConfig.hs:import Distribution.Package hiding 
(PackageId)
./compiler/main/PackageConfig.hs:import Distribution.Text
./compiler/main/PackageConfig.hs:import Distribution.Version
./compiler/main/Finder.lhs:import Distribution.Text
./compiler/main/Finder.lhs:import Distribution.Package hiding 
(PackageId)

As you can see, there are only 4 files in ghc itself that depend on 
Cabal:

./compiler/ghci/Linker.lhs
./compiler/main/Packages.lhs
./compiler/main/PackageConfig.hs
./compiler/main/Finder.lhs

(plus 1 file for ghc-pkg: ./utils/ghc-pkg/Main.hs)

The ones in GHC core seem to rely only on quite basic data types.

 From this, I would boldly claim that people have spent more time making 
the GHC build system work with this Cabal dependency than it would take 
stripping it off!

(In fact, I would try to do this right now if the GHC build system 
wouldn't take so long to compile even the smallest changes ...)

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GHC API + Cabal API + Cabal version checks: is there a way out?

2013-09-06 Thread Niklas Hambüchen
It looks to me that technically it should be easy to split off the part
required by GHC.

Maybe somebody could just try that (currently it does not seem to take
longer than a few hours) so that we have some basic proposal and momentum.

On 07/09/13 00:04, JP Moresmau wrote:
 Oh, I'm happy to help as well if somebody is needed to do the change

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GHC API + Cabal API + Cabal version checks: is there a way out?

2013-09-06 Thread Niklas Hambüchen
We just had a short discussion on #ghc, I copy-paste:

http://lpaste.net/92639

dcoutts_: nh2: Cabal does not depend on the ghc-pkg format. Cabal
specifies a compiler-independent package registration format. GHC uses
it in its external interface (and internally too). It uses the Cabal lib
for the parser+printer because it's easier than making its own and
keeping up with spec changes..
dcoutts_: type+parser+printer
nh2: dcoutts_: would it still not be easier to make this package
database specification a separate thing that both ghc and cabal can
depend on? It seems to me that this would be much less a moving target
than Cabal-the-build-system is
dcoutts_: nh2: what does make sense is to split the Cabal lib into the
Distribution.* bits and the Distribution.Simple.* bits
dcoutts_: nh2: it's not a natural split
hvr: nh2: btw, a related thread:
http://www.haskell.org/pipermail/ghc-devs/2013-March/000800.html
dcoutts_: nh2: there's a lot of types shared between the .cabal format
and the InstalledPackageInfo type
dcoutts_: as well as parser + printer infrastructure
dcoutts_: nh2: it makes sense to keep that all together, that's the
Distribution.* stuff
dcoutts_: as I said, what does make sense to split (it's been
deliberately kept mostly-separate) is the Distribution.Simple.* part
dcoutts_: nh2: and we need a parser for that part, that's the dependency
that's annoying
thoughtpolice: so yes, i'm going to look into it today if at all possible
nh2: dcoutts_: that makes sense. ghc does not depend on
Distribution.PackageDescription either, right?
dcoutts_: nh2: right, it doesn't need the source package type
(PackageDescription), just the installed package type (InstalledPackageInfo)
dcoutts_: nh2: but splitting these into different packages would not buy
us much and it's not a natural split
nh2: leaving away Distribution.Simple.*, the remaining part is already
so small that it indeed looks like a small enough interface
dcoutts_: nh2: it'd only help JP M if the remaining part (lets call it
cabal-build-simple) could build with an earlier core part (lets call it
cabal-lib) (in his request in
http://www.haskell.org/pipermail/haskell-cafe/2013-September/108746.html)
dcoutts_: nh2: and doesn't help me with my parser problems, we still
cannot depend on a decent parser combinator lib
dcoutts_: still have to use the crappy ReadP
nh2: dcoutts_: Distribution.PackageDescription is the .cabal file format
itself, right? Not sure if that should be part of the package DB spec,
it changes more often and ghc can't make use of it
nh2: why is it that you cannot depend on something better?
dcoutts_: nh2: because ghc cannot depend on parsec easily
dcoutts_: because it pulls in too many other things
dcoutts_: the ghc devs objected to my suggestion
dcoutts_: nh2: that's true but what does it really buy us if they're in
separate packages? We still cannot guarantee to support JP M's request
dcoutts_: e.g. in the switch to 1.18, there have been enough changes
that we'd need the latest version of the InstalledPackageInfo
hvr: dcoutts_: ...seems you have to explain that again everytime
somebody brings it up =)
nh2: dcoutts_: but do I not understand it right that if you put
PackageDescription not into cabal-lib and only in Cabal, Cabal could
actually depend on a proper parser since GHC doesn't depend on it any more?
dcoutts_: nh2: it's not a monolithic parser
dcoutts_: nh2: we have that Text class
dcoutts_: with the combinator parsers for all the various types used in
.cabal and installed package files
dcoutts_: these types + parser/printer infrastructure are shared between
the source and installed package files
dcoutts_: so even if we split it, we still have the problem of needing a
parser lib
lemao: dcoutts_: I hear you wrt to the difficulties and mixed results of
splitting Distribution.Simple at the same time that this GHC dependency
on cabal is really problematic for all the reasons already discussed
dcoutts_: lemao: I don't think splitting it would fix that
lemao: dcoutts_: yes, I hear you. Maybe the right solution here is to
have GHC own their own internal package info impl so Cabal and GHC can
go their separate ways
dcoutts_: you'd still have ghc depending on this smaller part, and
Cabal/cabal-install would still depend on (usually) the latest version
of that
dcoutts_: lemao: but that's also not satisfactory (for cabal-lib to be a
private dep of ghc) because ghc api exposes the InstalledPackageInfo type
dcoutts_: it's not a private dependency of the ghc api package, it's a
public dependency
lemao: dcoutts_: I guess what I meant is that ghc-pkg package
format/parser/etc would be a complete fork
dcoutts_: which then means you cannot pass the InstalledPackageInfo from
ghc api functions to anything else
lemao: dcoutts_: at the same time that there are issues with the split
there are real issues witht he current status quo
dcoutts_: as well as meaning it'd get out of sync
nh2: dcoutts_: InstalledPackageInfo looks like a very

Re: [Haskell-cafe] GHC API + Cabal API + Cabal version checks: is there a way out?

2013-09-06 Thread Niklas Hambüchen
I have filed a GHC ticket under

http://ghc.haskell.org/trac/ghc/ticket/8244

I hope this way we can find a solution soon.

On 07/09/13 00:04, JP Moresmau wrote:
 Oh, I'm happy to help as well if somebody is needed to do the change,
 since I have much to win in the future if EclipseFP can take advantage
 of a new version of Cabal without having to wait for a new GHC. The
 split in two libraries that Duncan mentions seems the best approach to
 me, having InstalledPackageInfo and related classes + parsers + pretty
 printers available as one reasonably stable library, while having
 another one for the real Cabal functionality...

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Strange IO sequence behaviour (Was: sequence causing stack overflow on pretty small lists)

2013-09-06 Thread Niklas Hambüchen
Ah, that's enlightening, and a good addition to 
http://ghc.haskell.org/trac/ghc/ticket/8189

On Sat 07 Sep 2013 04:31:31 JST, Tom Ellis wrote:
 FYI, rwbarton on Reddit produced a nice answer:

 
 http://www.reddit.com/r/haskell/comments/1luan1/strange_io_sequence_behaviour/cc32ec4


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Tutorial on JS with Haskell: Fay or GHCJS?

2013-09-04 Thread Niklas Hambüchen
Hi, I'm also interested in that.

Have you already evaluated haste?

It does not seem to have any of your cons, but maybe others.

What I particularly miss from all solutions is the ability to simply 
call parts written in Haskell from Javascript, e.g. to write `fib` and 
then integrate it into an existing Javascript application (they are all 
more interested in doing the other direction).

On Wed 04 Sep 2013 17:14:55 JST, Alejandro Serrano Mena wrote:
 Hi,
 I'm currently writing a tutorial on web applications using Haskell. I
 know the pros and cons of each server-side library (Yesod, Snap,
 Scotty, Warp, Happstack), but I'm looking for the right choice for
 client-side programming that converts Haskell to JavaScript. I've
 finally come to Fay vs. GHCJS, and would like your opinion on what's
 the best to tackle. My current list of pros and cons is:

 Fay
 ===
 Pros:
 - Does not need GHC 7.8
 - Easy FFI with JS
 - Has libraries for integration with Yesod and Snap

 Cons:
 - Only supports a subset of GHC (in particular, no type classes)


 GHCJS
 ==
 Pros:
 - Supports full GHC
 - Easy FFI with JS
 - Highly opinionated point: will stay longer than Fay (but it's very
 important for not having a tutorial that is old in few months)

 Cons:
 - Needs GHC 7.8 (but provides a Vagrant image)


 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] On Markdown in Haddock and why it's not going to happen

2013-09-03 Thread Niklas Hambüchen
On 30/08/13 10:30, Mateusz Kowalczyk wrote:
 I would also like to remind you that if there's something that you'd
 like to see in Haddock or something that you feel is broken, a good way
 express this is to make a ticket on the Haddock Trac[2].

I made one:

http://trac.haskell.org/haddock/ticket/257

This is very useful for us because haddock is broken by some TH issue.
This way, we can have most of our docs anyway.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] On Markdown in Haddock and why it's not going to happen

2013-09-01 Thread Niklas Hambüchen
On 01/09/13 04:27, Mateusz Kowalczyk wrote:
 It doesn't have to be 1-to-1 but the features have to be expressible in
 both: it's useless if we have different features with one syntax but not
 the other.

I don't find that useless. Markdown does not have definition lists, but
we use a normal list to achieve the same documentation goals.

Already being able to simply write basic markdown would bring me big
practical benefits, and I would prefer minor theoretical misalignments
not to outweigh them.

 If Markdown can do
 something new, that something can be added; if something doesn't make
 sense in Haddock (like horizontal rules), we ignore them.
 This is precisely what I have been doing and why my post went over every
 point from the original Markdown documentation, talking about why each
 of these does or doesn't make sense. In the end, Markdown offers us
 nothing new feature wise

If the features are the same, I would prefer to write them in markdown.

 and either forces us to make up new syntax for
 things it doesn't know about (definition lists) or makes us remove
 existing features all together.

As I said, I think it doesn't matter. The basic functionality that
people use is all there. I have not seen a haddock definition list in my
life, the first one is encountered is the single one in attoparsec
because I grepped for [@ after reading your post.

 As for which markdown implementation to use: I think it really doesn't
 matter that much in practice. Github and pandoc can both render
 documentation to my pleasing; I have yet to find a difference between
 them that would be a practical problem for my documentation efforts.
 Unfortunately it _does_ matter in practice because each flavour solves
 Markdown quirks differently. On top of this, we have to accomodate for
 Haddock specific features. We're effectively creating our own flavour of
 Markdown + extra syntax. This sounds like… Haddock markup!

Once we have picked one of the flavours, I do not care about the others.
These quirks have little practical relevance: I have put the markdown
from my main github projects into the tool you mentioned, and into
pandoc, and there were no bad surprises for me.

Given that, even if I were to step into a pathologic case, after I write
the documentation, a quick look at it immediately tells me whether
everything is to my liking or not.

 Regarding module and type links: They are links, so probably just
 representing them as Markdown links would be cleanest. [SomeThing]()
 with an empty reference could make haddock automatically figure out what
 is wanted or default to a type, and you could be explicit with
 [SomeThing](module), [SomeThing](type) and [SomeThing](class).

 For headings, why is CPP a problem? CPP ignores haddock comments,
 haddock should ignore CPP. There is no reason to put CPP macros into
 comments.
 I have to admit that I did not explore this very carefully but you we
 can't simply guarantee that no one every will run CPP on their files by
 hand. Better safe than sorry.

This is unreasonable. You also can't guarantee that nobody will run the
Handlebars templating language either, or any other tool.

You cannot even tell what the user wants to achieve: Should

-- | You can use `#if SHELL a #else b #endif`

go into the documentation unexpanded or template processed?

The only sane way is to make haddock agnostic of all those tools in the
world, save the Haskell compiler which it addresses by being inside
comments.

If somebody wanted to run their custom tool by hand before running
haddock by hand, sure they would write

#if ...
-- | Some haddock
#else
-- | Some other haddock
# endif

if they wished to conditionally generate different haddock.

 Regarding emphasis, **foo** would simply not be a heading in an export
 list. Using markdown haddock, we will have markdown headings for that.
 But what if I want it to be a heading? Are we picking rules arbitrarily now?

I do not understand what you mean. If you want it to be a heading, you
write:

# My heading

I don't find that worse than

* My heading

 Markdown being claimed to be for editing documents for the Web doesn't
 make our efforts impossible. Pandoc can easily create latex output from
 it, and Github can use it as a documentation language for programming
 perfectly fine. So can we.
 That's because you can use LaTeX to render everything that HTML can (but
 not the other way around!).

Yes, so what is the problem? You write markdown and it can be compiled
to your target languages. Why is it a problem that you cannot go the
other way around?

My point here was saying that markdown can be compiled to the three
targets you mentioned.

 GitHub can use it because they don't have the burden of having to
 accommodate for an existing feature set of a different markup language.
 Note how GitHub Markdown doesn't have all the features of Haddock,
 therefore it is _not_ compatible with it. We can't just use their
 Markdown because 

Re: [Haskell-cafe] On Markdown in Haddock and why it's not going to happen

2013-08-31 Thread Niklas Hambüchen
Hello,

I disagree.

While none of your detail points are wrong, they mainly focus on the
fact that there is no 1-to-1 mapping between the existing haddock markup
and Markdown. I don't think there needs to be. If Markdown can do
something new, that something can be added; if something doesn't make
sense in Haddock (like horizontal rules), we ignore them.

I don't think original and markdown syntax should be mixed in the same
file. That would make everything impossible to parse and difficult to write.

As for which markdown implementation to use: I think it really doesn't
matter that much in practice. Github and pandoc can both render
documentation to my pleasing; I have yet to find a difference between
them that would be a practical problem for my documentation efforts.

Regarding module and type links: They are links, so probably just
representing them as Markdown links would be cleanest. [SomeThing]()
with an empty reference could make haddock automatically figure out what
is wanted or default to a type, and you could be explicit with
[SomeThing](module), [SomeThing](type) and [SomeThing](class).

For headings, why is CPP a problem? CPP ignores haddock comments,
haddock should ignore CPP. There is no reason to put CPP macros into
comments.

Regarding emphasis, **foo** would simply not be a heading in an export
list. Using markdown haddock, we will have markdown headings for that.

Markdown being claimed to be for editing documents for the Web doesn't
make our efforts impossible. Pandoc can easily create latex output from
it, and Github can use it as a documentation language for programming
perfectly fine. So can we.

Did I address all your points?

Niklas


On Fri 30 Aug 2013 10:30:51 JST, Mateusz Kowalczyk wrote:
 Greetings café,

 Perhaps some saddening news for Markdown fans out there. As you might
 remember, there was a fair amount of push for having Markdown as an
 alternate syntax for Haddock.

 Unfortunately, this is probably not going to happen for reasons listed
 on the post I just published at [1].

 This thread is meant to be for discussion about the post as many people,
 myself included, felt that Markdown would be a nice thing to have.

 I feel like I covered the topic fairly well on the post but feel free to
 give suggestions or ask questions.

 I would also like to remind you that if there's something that you'd
 like to see in Haddock or something that you feel is broken, a good way
 express this is to make a ticket on the Haddock Trac[2].

 I will close the relevant Markdown ticket on the Trac[3] in about 3
 days, unless someone can come up with a reasonable solution that meets
 the initial intent of this part of the project: a widely known markup
 format that could be used as an alternate syntax for Haddock so that
 it's possible to write the documentation without learning the vanilla
 syntax itself.

 [1]:
 http://fuuzetsu.co.uk/blog/posts/2013-08-30-why-Markdown-in-Haddock-can't-happen.html

 [2]: http://trac.haskell.org/haddock

 [3]: http://trac.haskell.org/haddock/ticket/244

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] cpphs calls error when it finds an #error declaration

2013-08-28 Thread Niklas Hambüchen
On 29/08/13 00:43, Malcolm Wallace wrote:
 Have you tried simply wrapping the call to runCpphs in a catch?  Something 
 like
 
 safeRunCpphs :: ... - IO (Either String String)
 safeRunCpphs foo = fmap Right (runCpphs foo) `catch` (\(UserError s)- 
 Left s

Yes, that is what I'm doing at the moment. The problem with this is that
it does not allow me to distinguish between a programmer error (error)
on the caller or implementation side, and an #error in the input file.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] sequence causing stack overflow on pretty small lists

2013-08-27 Thread Niklas Hambüchen
Thanks for your examples.

On 27/08/13 13:59, Albert Y. C. Lai wrote:
 The correct fix is to raise the stack cap, not to avoid using the stack.
 
 Indeed, ghci raises the stack cap so high I still haven't fathomed where
 it is. This is why you haven't seen a stack overflow in ghci for a long
 time. See, ghci agrees: the correct thing to do is to raise the stack cap.

If I understand this correctly, you agree that the stack size should be
unlimited by default?

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] cpphs calls error when it finds an #error declaration

2013-08-27 Thread Niklas Hambüchen
Hi,

after some debugging of a higher-level tool I found out that when I use
cpphs as a library and the `runCpphs` function that is to produce the
preprocessed output, when it comes across the #error directive it will
terminate my program.

This is because handling #error is implemented with Haskell's `error`.

I find that slightly unfortunate since it means I cannot distinguish
betwen an #error written in the input file and a programming error
inside cpphs.

@Malcolm, would you mind a change towards throwing an exception that is
different from error so that it can be easily caught, or even better, a
change from

runCpphs :: ... - IO String

to

runCpphs :: ... - IO (Either String String)

or similar?

If an exception based interface is kept, it would be nice to add some
haddock to `runCpphs`; not knowing about the existence of #error, it is
easy to assume that the IO is only used for accessing the FilePath
passed in.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Template Haskell

2013-08-27 Thread Niklas Hambüchen
Hi Jose,

Template Haskell doesn't parse code.

haskell-src-exts and the GHC API can do that.

Have a look at:

* ghc-mod browse (using ghc api)
* hscope (using haskell-src-exts)

On 27/08/13 15:45, Jose A. Lopes wrote:
 Hi,
 
 Is it possible to retrieve all definitions contained in a module using
 Template Haskell ?
 
 Thanks,
 Jose
 

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] sequence causing stack overflow on pretty small lists

2013-08-27 Thread Niklas Hambüchen
On 27/08/13 20:37, Patrick Palka wrote:
 You can use ContT to force the function to use heap instead of stack
 space, e.g. runContT (replicateM 100 (lift randomIO)) return

That is interesting, and works.

Unfortunately its pure existence will not fix sequence, mapM etc. in base.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] sequence causing stack overflow on pretty small lists

2013-08-26 Thread Niklas Hambüchen
On #haskell we recently had a discussion about the following:

   import System.Random

   list - replicateM 100 randomIO :: IO [Int]

I would think that this gives us a list of a million random Ints. In
fact, this is what happens in ghci. But with ghc we get:

   Stack space overflow: current size 8388608 bytes.
   Use `+RTS -Ksize -RTS' to increase it.

This is because sequence is implemented as

 sequence (m:ms) = do x - m
  xs - sequence ms
  return (x:xs)

and uses stack space when used on some [IO a].

From a theoretical side, this is an implementation detail. From the
software engineering side this disastrous because the code is

  * obviously correct by itself
  * the first thing people would come up with
  * not exaggerating: a million elements is not much
  * used a lot of places: mapM, replicateM are *everywhere*

and yet it will kill our programs, crash our airplanes, and give no
helpful information where the problem occurred.

Effectively, sequence is a partial function.

(Note: We are not trying to obtain a lazy list of random numbers, use
any kind of streaming or the likes. We want the list in memory and use it.)

We noticed that this problem did not happen if sequence were implemented
with a difference list.

What do you think about this? Should we fix functions like this,
probably trading off a small performance hit, or accept that idiomatic
Haskell code can crash at any time?

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] sequence causing stack overflow on pretty small lists

2013-08-26 Thread Niklas Hambüchen
As an example that this actually makes problems in production code, I
found this in the wildlife:

https://github.com/ndmitchell/shake/blob/e0e0a43/Development/Shake/Database.hs#L394

-- Do not use a forM here as you use too much stack space
bad - (\f - foldM f [] (Map.toList status)) $ \seen (i,v) - ...

I could bet that there is a lot of code around on which we rely, which
has the same problem but does not go that far in customisation.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ordNub

2013-08-26 Thread Niklas Hambüchen
On 14/07/13 20:20, Niklas Hambüchen wrote:
 As you might not know, almost *all* practical Haskell projects use it,
 and that in places where an Ord instance is given, e.g. happy, Xmonad,
 ghc-mod, Agda, darcs, QuickCheck, yesod, shake, Cabal, haddock, and 600
 more (see https://github.com/nh2/haskell-ordnub).

GHC uses nub.

Also let me stress again that the n² case happens even if there are no
duplicates.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] sequence causing stack overflow on pretty small lists

2013-08-26 Thread Niklas Hambüchen
Maybe an unlimited stack size should be the default?

As far as I understand, the only negative effect would be that some
programming mistakes would not result in a stack overflow. However, I
doubt the usefulness of that:

* It already depends a lot on the optimisation level
* If you do the same thing in a slightly different way, and you allocate
on the heap instead of on the stack you will not get it either

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Renumbered mailing list posts

2013-08-25 Thread Niklas Hambüchen
Austin: Do you have any update on this?

On 11/08/13 04:48, Austin Seipp wrote:
 Henning,
 
 Thanks for the report. I'm currently investigating this, and think it
 should be possible to keep all of the old URLs intact.
 
 On Sat, Aug 10, 2013 at 11:01 AM, Niklas Hambüchen m...@nh2.me wrote:
 On 11/08/13 00:50, Brandon Allbery wrote:
 Those at least are recoverable, just replace hpaste.org
 http://hpaste.org with lpaste.net http://lpaste.net (content is
 still there). But still.

 Unfortunately I cannot amend emails that I have sent.

 Could we not just have kept the domain and set a CNAME entry to the new one?


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell] ANNOUNCE: haskell-src-exts 1.14.0

2013-08-20 Thread Niklas Broberg
Fellow Haskelleers,

I'm pleased to announce the release of haskell-src-exts-1.14.0!

* On hackage: http://hackage.haskell.org/package/haskell-src-exts
* Via cabal: cabal install haskell-src-exts
* git repo: 
https://github.com/haskell-suite/haskell-src-extshttp://code.haskell.org/haskell-src-exts

There are two primary reasons for this release, and a number of smaller
ones.

The first primary reason is technical: haskell-src-exts 1.14 revamps the
Extension datatype, among other things to allow turning extensions on and
off (similar to what Cabal allows). We also introduce the concept of a
Language, separate from a set of extensions. This is the only
backwards-incompatible change in this release.

The second reason is structural: haskell-src-exts is now part of a larger
context -- the Haskell Suite. The package has a new home on github (see
above), alongside its new cool friends: haskell-names and haskell-packages.
There is also a really nice issue tracker there - please help me fill it,
or better yet, empty it!

What this release does *not* cover is support for the extensions added to
GHC in recent time (with the exceptions of CApiFFI and InterruptibleFFI).
Work is in progress on many of these, and there will be another major
release not far off in the future.


This release owes many thanks to Roman Cheplyaka in particular, as well as
Erik Hesselink, Simon Meier and David Fox. Thanks a lot!


Complete changelog:

1.13.6 -- 1.14.0
===

* Modernize the Extension datatype in L.H.E.Extension, following the lead
  of Cabal, to allow negative and positive extension modifiers (turning
  features on and off). You need to worry about backwards-incompatible
  changes if any of the following pertains to you:
  1) If you use the Extension datatype programmatically - it has changed
 significantly (see documentation).
  2) The ParseMode record now has one more field
 (baseLanguage :: Language), which might give you a type error.
  3) The behavior of the (extensions :: [Extension]) field has changed,
 which could bite you if you pass custom extensions in the ParseMode.
 Previously, the ParseMode defaulted to the list of extensions accepted
 by Haskell2010, and if you set the list explicitly you would override
 this. Now, the defaults are { baseLanguage = Haskell2010, extensions =
[] },
 and explicitly setting a list of extensions will be interpreted on top
of
 Haskell2010. See further the documentation for L.H.E.Extension.

* Add support for the 'capi' calling convention. It is enabled with the
CApiFFI
  extension. It's been included since GHC 7.4, and advertised since 7.6.

* Add support for the 'interruptible' FFI safety annotation, enabled with
  the InterruptibleFFI extension.

* Give better error message when lexing newline fails. In particular, fix
the bug
  when the parser would crash if the file didn't end with a newline.

* Support unboxed tuple expressions and patterns.

* Fix bug in lexing of primitive integer literals in hex or octal notation.

* Disallow negative primitive word literals
  (such as W# (-0x8000##)).

* Allow phase control for SPECIALIZE pragma.

* Derive Foldable and Traversable instances for all annotated AST types.

* Fix bug with pretty-printing WARNING and DEPRECATED pragmas.


Cheers, Niklas
___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell


Re: [Haskell] ANNOUNCE: haskell-src-exts 1.14.0

2013-08-20 Thread Niklas Hambüchen
Nice!

I hope that haskell-suite will eventually become awesome and solve most
of our automation-on-Haskell-code needs.

Two questions:

1) My most desired feature would be a syntax tree that does not pluck
pluck comments out and make me treat them separately. It looks much
easier to me to have a fully descriptive tree and (filter . concatMap) /
traverse them out in some way than getting a list of comments and having
to insert them back in the right places myself.
Is that possible?

2) Have you considered downloading the all-of-Hackage tarball and
running haskell-src-exts over it to get a benchmark of how much HSE can
already parse of the Haskell code out there?

Thanks!

___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell


Re: [Haskell] ANNOUNCE: haskell-src-exts 1.14.0

2013-08-20 Thread Niklas Broberg
Hi Niklas,

1) My most desired feature would be a syntax tree that does not pluck
 pluck comments out and make me treat them separately. It looks much
 easier to me to have a fully descriptive tree and (filter . concatMap) /
 traverse them out in some way than getting a list of comments and having
 to insert them back in the right places myself.
 Is that possible?


Sadly not - it's theoretically impossible. The fact that you can put
comments literally wherever, means that it's impossible to treat them as
nodes of the AST. E.g.

  f {- WHERE -} x = -- WOULD
  -- THESE
  do -- COMMENTS
 a {- END -} - g x -- UP
 return {- ? -} a

What would be theoretically possible is to define a restricted language
that allows comments only in certain well-defined places (cf haddock), and
ignores any others. That's a lot of work though, and it's not clear how big
the gain is. :-\

A different solution could be to improve the support, through better helper
functions, for handling a syntax tree and a list of comments together.
That's something I think could be worthwhile.


 2) Have you considered downloading the all-of-Hackage tarball and
 running haskell-src-exts over it to get a benchmark of how much HSE can
 already parse of the Haskell code out there?


Considered, yes. Done, no. Would love to see the results :-). The crew at
OdHac (Roman, Erik, Simon) ensured that the current version handles all of
'base', which is a good start.

Cheers, Niklas
___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell


Re: [Haskell] ANNOUNCE: haskell-src-exts 1.14.0

2013-08-20 Thread Niklas Hambüchen
On 20/08/13 18:19, Niklas Broberg wrote:
 Sadly not - it's theoretically impossible. The fact that you can put
 comments literally wherever, means that it's impossible to treat them as
 nodes of the AST. E.g.
 
   f {- WHERE -} x = -- WOULD
   -- THESE
   do -- COMMENTS
  a {- END -} - g x -- UP
  return {- ? -} a

Oh, I see what you mean.

I guess what I mean instead is:

* A lex list that contains *everything*, including comments and white space

* A full syntax tree of which each node points to (indexes) a position
in the lex list to get the precise original position; comments in
between two nodes can then be determined and more easily played with
because they are between their positions in the lex list

* An abstract syntax tree that has whitespace and comments discarded
(what HSE has now)

___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell


Re: [Haskell] ANNOUNCE: haskell-src-exts 1.14.0

2013-08-20 Thread Niklas Broberg
HSE parses based on pragmas by default. This can be configured through the
ParseMode [1].

But your question regards HSP, Haskell Server Pages, which indeed just
enables most extensions by default. Right now there's no way to configure
that, but it shouldn't be hard for a skilled programmer to fix. Patches
most welcome.  :-)

Cheers, Niklas

[1]
http://hackage.haskell.org/packages/archive/haskell-src-exts/1.13.5/doc/html/Language-Haskell-Exts-Parser.html#t:ParseMode
On 20 Aug 2013 12:57, Dag Odenhall dag.odenh...@gmail.com wrote:

 Good stuff!

 Is there any way, or plans for a way, to parse a file based on its
 LANGUAGE pragmas? Last I checked e.g. HSP simply enabled all extensions
 when parsing, which can cause code to be parsed incorrectly in some cases.


 On Tue, Aug 20, 2013 at 10:15 AM, Niklas Broberg niklas.brob...@gmail.com
  wrote:

 Fellow Haskelleers,

 I'm pleased to announce the release of haskell-src-exts-1.14.0!

 * On hackage: http://hackage.haskell.org/package/haskell-src-exts
 * Via cabal: cabal install haskell-src-exts
 * git repo: 
 https://github.com/haskell-suite/haskell-src-extshttp://code.haskell.org/haskell-src-exts

 There are two primary reasons for this release, and a number of smaller
 ones.

 The first primary reason is technical: haskell-src-exts 1.14 revamps the
 Extension datatype, among other things to allow turning extensions on and
 off (similar to what Cabal allows). We also introduce the concept of a
 Language, separate from a set of extensions. This is the only
 backwards-incompatible change in this release.

 The second reason is structural: haskell-src-exts is now part of a larger
 context -- the Haskell Suite. The package has a new home on github (see
 above), alongside its new cool friends: haskell-names and haskell-packages.
 There is also a really nice issue tracker there - please help me fill it,
 or better yet, empty it!

 What this release does *not* cover is support for the extensions added to
 GHC in recent time (with the exceptions of CApiFFI and InterruptibleFFI).
 Work is in progress on many of these, and there will be another major
 release not far off in the future.


 This release owes many thanks to Roman Cheplyaka in particular, as well
 as Erik Hesselink, Simon Meier and David Fox. Thanks a lot!


 Complete changelog:

 1.13.6 -- 1.14.0
 ===

 * Modernize the Extension datatype in L.H.E.Extension, following the lead
   of Cabal, to allow negative and positive extension modifiers (turning
   features on and off). You need to worry about backwards-incompatible
   changes if any of the following pertains to you:
   1) If you use the Extension datatype programmatically - it has changed
  significantly (see documentation).
   2) The ParseMode record now has one more field
  (baseLanguage :: Language), which might give you a type error.
   3) The behavior of the (extensions :: [Extension]) field has changed,
  which could bite you if you pass custom extensions in the ParseMode.
  Previously, the ParseMode defaulted to the list of extensions
 accepted
  by Haskell2010, and if you set the list explicitly you would
 override
  this. Now, the defaults are { baseLanguage = Haskell2010, extensions
 = [] },
  and explicitly setting a list of extensions will be interpreted on
 top of
  Haskell2010. See further the documentation for L.H.E.Extension.

 * Add support for the 'capi' calling convention. It is enabled with the
 CApiFFI
   extension. It's been included since GHC 7.4, and advertised since 7.6.

 * Add support for the 'interruptible' FFI safety annotation, enabled with
   the InterruptibleFFI extension.

 * Give better error message when lexing newline fails. In particular, fix
 the bug
   when the parser would crash if the file didn't end with a newline.

 * Support unboxed tuple expressions and patterns.

 * Fix bug in lexing of primitive integer literals in hex or octal
 notation.

 * Disallow negative primitive word literals
   (such as W# (-0x8000##)).

 * Allow phase control for SPECIALIZE pragma.

 * Derive Foldable and Traversable instances for all annotated AST types.

 * Fix bug with pretty-printing WARNING and DEPRECATED pragmas.


 Cheers, Niklas

 --
 You received this message because you are subscribed to the Google Groups
 Haskell Server Pages group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to haskell-server-pages+unsubscr...@googlegroups.com.
 To post to this group, send email to
 haskell-server-pa...@googlegroups.com.
 Visit this group at http://groups.google.com/group/haskell-server-pages.
 For more options, visit https://groups.google.com/groups/opt_out.


  --
 You received this message because you are subscribed to the Google Groups
 Haskell Server Pages group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to haskell-server-pages+unsubscr...@googlegroups.com.
 To post to this group, send email

Re: [Haskell] ANNOUNCE: haskell-src-exts 1.14.0

2013-08-20 Thread Niklas Broberg
 The first primary reason is
 technical: haskell-src-exts
 1.14 revamps the Extension
 datatype, among other things
 to allow turning extensions on
 and off (similar to what Cabal
 allows). We also introduce the
 concept of a Language,
 separate from a set of
 extensions. This is the only
 backwards-incompatible
 change in this release.

Heads-up: as was pointed out to me, the above is not true. The constructors
of the Tuple type have also changed, which means greater risks for
breakage. Proceed with this in mind.

Cheers, Niklas
___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell


[Haskell] ANNOUNCE: posix-paths, for faster file system operations

2013-08-20 Thread Niklas Hambüchen
John Lato and I would like to announce our posix-paths package.

https://github.com/JohnLato/posix-paths

It implements a large portion of System.Posix.FilePath using ByteString
based RawFilePaths instead of String based FilePaths, and on top of that
provides a Traversal module with a fast replacement for
`getDirectoryContents` and a recursive `allDirectoryContents`.

`getDirectoryContents` is (unsurprisingly?) really slow.
Our replacement is 11 times faster in the recursive use case [1], and
only 20% slower than `find`.

Benchmarks are at [2], code is at [3].

We hope that these improvements will eventually make it into base some day.

Until then, we propose our package as a base for discussion and further
improvements.

Contributions are welcome:
Some FilePath operations are not in it yet (especially the Windows /
drive related ones), and our traversals might not work on Windows.
We would also appreciate some thorough looks at their low level
implementations.
If you find our benchmarks against getDirectoryContents unfair or would
like to add another one, please send a pull request.

We have been running this on Linux production machines for a few months
now, and are pleased by the speed-up.



[1] For the recursive version of the original `getDirectoryContents`, we
used the implementation given in Real World Haskell:
http://book.realworldhaskell.org/read/io-case-study-a-library-for-searching-the-filesystem.html

[2] Benchmarks:
On a real file system: http://johnlato.github.io/posix-paths/usrLocal.html
On tmpfs: http://johnlato.github.io/posix-paths/tmpfs.html (note that
here find is slow because of process starting overhead)

[3] Code:
Github: https://github.com/JohnLato/posix-paths
RawFilePath operations:
https://github.com/JohnLato/posix-paths/blob/master/src/System/Posix/FilePath.hs
Traversals:
https://github.com/JohnLato/posix-paths/blob/master/src/System/Posix/Directory/Traversals.hs
Benchmarks:
https://github.com/JohnLato/posix-paths/blob/master/benchmarks/Bench.hs

___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell


[Haskell-cafe] ANNOUNCE: haskell-src-exts 1.14.0

2013-08-20 Thread Niklas Broberg
Fellow Haskelleers,

I'm pleased to announce the release of haskell-src-exts-1.14.0!

* On hackage: http://hackage.haskell.org/package/haskell-src-exts
* Via cabal: cabal install haskell-src-exts
* git repo: 
https://github.com/haskell-suite/haskell-src-extshttp://code.haskell.org/haskell-src-exts

There are two primary reasons for this release, and a number of smaller
ones.

The first primary reason is technical: haskell-src-exts 1.14 revamps the
Extension datatype, among other things to allow turning extensions on and
off (similar to what Cabal allows). We also introduce the concept of a
Language, separate from a set of extensions. This is the only
backwards-incompatible change in this release.

The second reason is structural: haskell-src-exts is now part of a larger
context -- the Haskell Suite. The package has a new home on github (see
above), alongside its new cool friends: haskell-names and haskell-packages.
There is also a really nice issue tracker there - please help me fill it,
or better yet, empty it!

What this release does *not* cover is support for the extensions added to
GHC in recent time (with the exceptions of CApiFFI and InterruptibleFFI).
Work is in progress on many of these, and there will be another major
release not far off in the future.


This release owes many thanks to Roman Cheplyaka in particular, as well as
Erik Hesselink, Simon Meier and David Fox. Thanks a lot!


Complete changelog:

1.13.6 -- 1.14.0
===

* Modernize the Extension datatype in L.H.E.Extension, following the lead
  of Cabal, to allow negative and positive extension modifiers (turning
  features on and off). You need to worry about backwards-incompatible
  changes if any of the following pertains to you:
  1) If you use the Extension datatype programmatically - it has changed
 significantly (see documentation).
  2) The ParseMode record now has one more field
 (baseLanguage :: Language), which might give you a type error.
  3) The behavior of the (extensions :: [Extension]) field has changed,
 which could bite you if you pass custom extensions in the ParseMode.
 Previously, the ParseMode defaulted to the list of extensions accepted
 by Haskell2010, and if you set the list explicitly you would override
 this. Now, the defaults are { baseLanguage = Haskell2010, extensions =
[] },
 and explicitly setting a list of extensions will be interpreted on top
of
 Haskell2010. See further the documentation for L.H.E.Extension.

* Add support for the 'capi' calling convention. It is enabled with the
CApiFFI
  extension. It's been included since GHC 7.4, and advertised since 7.6.

* Add support for the 'interruptible' FFI safety annotation, enabled with
  the InterruptibleFFI extension.

* Give better error message when lexing newline fails. In particular, fix
the bug
  when the parser would crash if the file didn't end with a newline.

* Support unboxed tuple expressions and patterns.

* Fix bug in lexing of primitive integer literals in hex or octal notation.

* Disallow negative primitive word literals
  (such as W# (-0x8000##)).

* Allow phase control for SPECIALIZE pragma.

* Derive Foldable and Traversable instances for all annotated AST types.

* Fix bug with pretty-printing WARNING and DEPRECATED pragmas.


Cheers, Niklas
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] [Haskell] ANNOUNCE: haskell-src-exts 1.14.0

2013-08-20 Thread Niklas Hambüchen
Nice!

I hope that haskell-suite will eventually become awesome and solve most
of our automation-on-Haskell-code needs.

Two questions:

1) My most desired feature would be a syntax tree that does not pluck
pluck comments out and make me treat them separately. It looks much
easier to me to have a fully descriptive tree and (filter . concatMap) /
traverse them out in some way than getting a list of comments and having
to insert them back in the right places myself.
Is that possible?

2) Have you considered downloading the all-of-Hackage tarball and
running haskell-src-exts over it to get a benchmark of how much HSE can
already parse of the Haskell code out there?

Thanks!

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] [Haskell] ANNOUNCE: haskell-src-exts 1.14.0

2013-08-20 Thread Niklas Broberg
Hi Niklas,

1) My most desired feature would be a syntax tree that does not pluck
 pluck comments out and make me treat them separately. It looks much
 easier to me to have a fully descriptive tree and (filter . concatMap) /
 traverse them out in some way than getting a list of comments and having
 to insert them back in the right places myself.
 Is that possible?


Sadly not - it's theoretically impossible. The fact that you can put
comments literally wherever, means that it's impossible to treat them as
nodes of the AST. E.g.

  f {- WHERE -} x = -- WOULD
  -- THESE
  do -- COMMENTS
 a {- END -} - g x -- UP
 return {- ? -} a

What would be theoretically possible is to define a restricted language
that allows comments only in certain well-defined places (cf haddock), and
ignores any others. That's a lot of work though, and it's not clear how big
the gain is. :-\

A different solution could be to improve the support, through better helper
functions, for handling a syntax tree and a list of comments together.
That's something I think could be worthwhile.


 2) Have you considered downloading the all-of-Hackage tarball and
 running haskell-src-exts over it to get a benchmark of how much HSE can
 already parse of the Haskell code out there?


Considered, yes. Done, no. Would love to see the results :-). The crew at
OdHac (Roman, Erik, Simon) ensured that the current version handles all of
'base', which is a good start.

Cheers, Niklas
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] [Haskell] ANNOUNCE: haskell-src-exts 1.14.0

2013-08-20 Thread Niklas Hambüchen
On 20/08/13 18:19, Niklas Broberg wrote:
 Sadly not - it's theoretically impossible. The fact that you can put
 comments literally wherever, means that it's impossible to treat them as
 nodes of the AST. E.g.
 
   f {- WHERE -} x = -- WOULD
   -- THESE
   do -- COMMENTS
  a {- END -} - g x -- UP
  return {- ? -} a

Oh, I see what you mean.

I guess what I mean instead is:

* A lex list that contains *everything*, including comments and white space

* A full syntax tree of which each node points to (indexes) a position
in the lex list to get the precise original position; comments in
between two nodes can then be determined and more easily played with
because they are between their positions in the lex list

* An abstract syntax tree that has whitespace and comments discarded
(what HSE has now)

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANNOUNCE: haskell-src-exts 1.14.0

2013-08-20 Thread Niklas Broberg
HSE parses based on pragmas by default. This can be configured through the
ParseMode [1].

But your question regards HSP, Haskell Server Pages, which indeed just
enables most extensions by default. Right now there's no way to configure
that, but it shouldn't be hard for a skilled programmer to fix. Patches
most welcome.  :-)

Cheers, Niklas

[1]
http://hackage.haskell.org/packages/archive/haskell-src-exts/1.13.5/doc/html/Language-Haskell-Exts-Parser.html#t:ParseMode
On 20 Aug 2013 12:57, Dag Odenhall dag.odenh...@gmail.com wrote:

 Good stuff!

 Is there any way, or plans for a way, to parse a file based on its
 LANGUAGE pragmas? Last I checked e.g. HSP simply enabled all extensions
 when parsing, which can cause code to be parsed incorrectly in some cases.


 On Tue, Aug 20, 2013 at 10:15 AM, Niklas Broberg niklas.brob...@gmail.com
  wrote:

 Fellow Haskelleers,

 I'm pleased to announce the release of haskell-src-exts-1.14.0!

 * On hackage: http://hackage.haskell.org/package/haskell-src-exts
 * Via cabal: cabal install haskell-src-exts
 * git repo: 
 https://github.com/haskell-suite/haskell-src-extshttp://code.haskell.org/haskell-src-exts

 There are two primary reasons for this release, and a number of smaller
 ones.

 The first primary reason is technical: haskell-src-exts 1.14 revamps the
 Extension datatype, among other things to allow turning extensions on and
 off (similar to what Cabal allows). We also introduce the concept of a
 Language, separate from a set of extensions. This is the only
 backwards-incompatible change in this release.

 The second reason is structural: haskell-src-exts is now part of a larger
 context -- the Haskell Suite. The package has a new home on github (see
 above), alongside its new cool friends: haskell-names and haskell-packages.
 There is also a really nice issue tracker there - please help me fill it,
 or better yet, empty it!

 What this release does *not* cover is support for the extensions added to
 GHC in recent time (with the exceptions of CApiFFI and InterruptibleFFI).
 Work is in progress on many of these, and there will be another major
 release not far off in the future.


 This release owes many thanks to Roman Cheplyaka in particular, as well
 as Erik Hesselink, Simon Meier and David Fox. Thanks a lot!


 Complete changelog:

 1.13.6 -- 1.14.0
 ===

 * Modernize the Extension datatype in L.H.E.Extension, following the lead
   of Cabal, to allow negative and positive extension modifiers (turning
   features on and off). You need to worry about backwards-incompatible
   changes if any of the following pertains to you:
   1) If you use the Extension datatype programmatically - it has changed
  significantly (see documentation).
   2) The ParseMode record now has one more field
  (baseLanguage :: Language), which might give you a type error.
   3) The behavior of the (extensions :: [Extension]) field has changed,
  which could bite you if you pass custom extensions in the ParseMode.
  Previously, the ParseMode defaulted to the list of extensions
 accepted
  by Haskell2010, and if you set the list explicitly you would
 override
  this. Now, the defaults are { baseLanguage = Haskell2010, extensions
 = [] },
  and explicitly setting a list of extensions will be interpreted on
 top of
  Haskell2010. See further the documentation for L.H.E.Extension.

 * Add support for the 'capi' calling convention. It is enabled with the
 CApiFFI
   extension. It's been included since GHC 7.4, and advertised since 7.6.

 * Add support for the 'interruptible' FFI safety annotation, enabled with
   the InterruptibleFFI extension.

 * Give better error message when lexing newline fails. In particular, fix
 the bug
   when the parser would crash if the file didn't end with a newline.

 * Support unboxed tuple expressions and patterns.

 * Fix bug in lexing of primitive integer literals in hex or octal
 notation.

 * Disallow negative primitive word literals
   (such as W# (-0x8000##)).

 * Allow phase control for SPECIALIZE pragma.

 * Derive Foldable and Traversable instances for all annotated AST types.

 * Fix bug with pretty-printing WARNING and DEPRECATED pragmas.


 Cheers, Niklas

 --
 You received this message because you are subscribed to the Google Groups
 Haskell Server Pages group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to haskell-server-pages+unsubscr...@googlegroups.com.
 To post to this group, send email to
 haskell-server-pa...@googlegroups.com.
 Visit this group at http://groups.google.com/group/haskell-server-pages.
 For more options, visit https://groups.google.com/groups/opt_out.


  --
 You received this message because you are subscribed to the Google Groups
 Haskell Server Pages group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to haskell-server-pages+unsubscr...@googlegroups.com.
 To post to this group, send email

Re: [Haskell-cafe] ANNOUNCE: haskell-src-exts 1.14.0

2013-08-20 Thread Niklas Broberg
 The first primary reason is
 technical: haskell-src-exts
 1.14 revamps the Extension
 datatype, among other things
 to allow turning extensions on
 and off (similar to what Cabal
 allows). We also introduce the
 concept of a Language,
 separate from a set of
 extensions. This is the only
 backwards-incompatible
 change in this release.

Heads-up: as was pointed out to me, the above is not true. The constructors
of the Tuple type have also changed, which means greater risks for
breakage. Proceed with this in mind.

Cheers, Niklas
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] ANNOUNCE: posix-paths, for faster file system operations

2013-08-20 Thread Niklas Hambüchen
John Lato and I would like to announce our posix-paths package.

https://github.com/JohnLato/posix-paths

It implements a large portion of System.Posix.FilePath using ByteString
based RawFilePaths instead of String based FilePaths, and on top of that
provides a Traversal module with a fast replacement for
`getDirectoryContents` and a recursive `allDirectoryContents`.

`getDirectoryContents` is (unsurprisingly?) really slow.
Our replacement is 11 times faster in the recursive use case [1], and
only 20% slower than `find`.

Benchmarks are at [2], code is at [3].

We hope that these improvements will eventually make it into base some day.

Until then, we propose our package as a base for discussion and further
improvements.

Contributions are welcome:
Some FilePath operations are not in it yet (especially the Windows /
drive related ones), and our traversals might not work on Windows.
We would also appreciate some thorough looks at their low level
implementations.
If you find our benchmarks against getDirectoryContents unfair or would
like to add another one, please send a pull request.

We have been running this on Linux production machines for a few months
now, and are pleased by the speed-up.



[1] For the recursive version of the original `getDirectoryContents`, we
used the implementation given in Real World Haskell:
http://book.realworldhaskell.org/read/io-case-study-a-library-for-searching-the-filesystem.html

[2] Benchmarks:
On a real file system: http://johnlato.github.io/posix-paths/usrLocal.html
On tmpfs: http://johnlato.github.io/posix-paths/tmpfs.html (note that
here find is slow because of process starting overhead)

[3] Code:
Github: https://github.com/JohnLato/posix-paths
RawFilePath operations:
https://github.com/JohnLato/posix-paths/blob/master/src/System/Posix/FilePath.hs
Traversals:
https://github.com/JohnLato/posix-paths/blob/master/src/System/Posix/Directory/Traversals.hs
Benchmarks:
https://github.com/JohnLato/posix-paths/blob/master/benchmarks/Bench.hs

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Retrieving Haddock comments with haskell-src-exts

2013-08-16 Thread Niklas Broberg
Hi again,

Hmm. I see the difficulty here, and eventually I would want to have support
for this, but alas, not yet. If you come up with any solution that doesn't
involve GHC (or only marginally so), I'd love to hear it.

Cheers, Niklas


On Wed, Aug 14, 2013 at 8:57 PM, Mateusz Kowalczyk
fuuze...@fuuzetsu.co.ukwrote:

 On 14/08/13 19:02, Niklas Broberg wrote:
  Hi Mateusz,
 
  haskell-src-exts is not haddock-aware I'm afraid, so I don't have any
 real
  solution for you. The one you mention, i.e. going through the whole parse
  result and stiching things together manually seems like the best bet if
 you
  want to use haskell-src-exts throughout.
 The main problem with this approach is that we get comments (and their
 SrcLoc) as a separate list. While it's trivial to check whether the
 comment starts with a ‘|’ or ‘^’ and it's not even hard to find any lines
 immediately following it, Haddock comments can appear in weird
 positions and trail until a line of code is encountered. Right now,
 it's rather hard to tell

   -- | Foo

   -- bar
 and

   -- | Foo
   someCode = undefined
   -- bar

 apart. I think this is the only option at the moment if I'm to use
 haskell-src-exts.
 
  In the longer run, it would be nice to have haddock support in
  haskell-src-exts, so ideas regarding what kind of interface you would
 like
  to see are most welcome. :-)
 For my use, I do not care about anything but Haddock comments. I don't
 care where or why they appear, what they are attached to c. With my
 current method, I just throw all this information away (it's given by
 GHC).

 For general use, I imagine that it'd be useful for the program to
 combine multi-line Haddock comments into a single one and attach it to
 whatever it is documenting. I'm not sure how haskell-src-exts is
 implemented but I don't think it's plausible to do this without going
 out to GHC and asking it for the information. Incidentally, this is
 precisely the problem I'm trying to solve with help of haskell-src-exts.

 
  Cheers, Niklas
 
 Thanks!

 --
 Mateusz K.

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Retrieving Haddock comments with haskell-src-exts

2013-08-14 Thread Niklas Broberg
Hi Mateusz,

haskell-src-exts is not haddock-aware I'm afraid, so I don't have any real
solution for you. The one you mention, i.e. going through the whole parse
result and stiching things together manually seems like the best bet if you
want to use haskell-src-exts throughout.

In the longer run, it would be nice to have haddock support in
haskell-src-exts, so ideas regarding what kind of interface you would like
to see are most welcome. :-)

Cheers, Niklas


On Wed, Aug 14, 2013 at 4:57 PM, Mateusz Kowalczyk
fuuze...@fuuzetsu.co.ukwrote:

 I'm writing a small tool to help to analyse Haddock comments in
 Haskell source files to help me to indicate any potential breakage to
 documentation in existing source files.

 Currently I'm doing the parsing with the GHC's ‘parser’ function with
 Opt_Haddock set and I filter out everything I don't need. There are
 problems with this approach: determining any extensions and options
 used is vital for valid parsing of the files and a large amount of
 source files outright fails to parse without this information.

 Fortunately, haskell-src-exts exists and it can deal with all (or
 most) of this for me. Unfortunately, there doesn't seem to be any way
 to get it to recognise Haddock comments and the only option available
 is all comments or no comments at all. It's not easily possible to
 stitch these together without analysing the whole parse result.

 Currently I'm thinking of parsing out extensions and pragmas used
 using haskell-src-exts and then feeding those to GHC, effectively
 parsing the second time. Is there a way to avoid this?

 There's ‘lexTokenStream’ but I believe it has similar problems to
 ‘parser’, that is, needing to know the extensions beforehand.
 --
 Mateusz K.

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Renumbered mailing list posts

2013-08-10 Thread Niklas Hambüchen
Yes, I also found that links from Google to archives don't work any 
more.

(Also fact that hpaste just went away, invalidating all my links to 
hpastes, is similarly bad.)

On Sat 10 Aug 2013 17:49:35 JST, Henning Thielemann wrote:
 Recently I found that links from Google search results to archive
 Haskell-Cafe messages are invalid. The messages are still there, but
 got a different number. E.g. the search result says:
   http://www.haskell.org/pipermail/haskell-cafe/2011-February/089455.html

 But the message is at
   http://www.haskell.org/pipermail/haskell-cafe/2011-February/088146.html

 Also links from Haskell-Wiki articles to the Haskell-Cafe archive are
 invalid now. This is very very very bad, since I used tons of such
 URLs in Wiki articles and it is very hard to find the message I
 referred to, if the URL does not work anymore.

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Renumbered mailing list posts

2013-08-10 Thread Niklas Hambüchen
On 11/08/13 00:50, Brandon Allbery wrote:
 Those at least are recoverable, just replace hpaste.org
 http://hpaste.org with lpaste.net http://lpaste.net (content is
 still there). But still.

Unfortunately I cannot amend emails that I have sent.

Could we not just have kept the domain and set a CNAME entry to the new one?

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] casting a into Maybe a

2013-07-27 Thread Niklas Hambüchen
Put a Just around it?

transMit s now key (Just newmsgs) q m

On Sat 27 Jul 2013 20:05:43 JST, Joerg Fritsch wrote:
 If I have the following type signature
 transMit :: Serialize a = Socket - POSIXTime - KEY - Maybe a - TPSQ - 
 TMap a - IO ()


 And the function is called with
 transMit s now key newmsgs q m
 where newmsgs is whatever type a I get but _not_ a Maybe a

 then I get the error
 Could not deduce (a ~ Maybe a)
 from the context (Serialize a)

 Can I somehow when I call transmit cast newmsgs into a Maybe newmsgs or so so 
 that the function call fits the type signature?

 --Joerg


 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ghc and jump table generation

2013-07-18 Thread Niklas Larsson
Hi!


2013/7/18 Erik Rantapaa eranta...@yahoo.com



 I've been looking at the assembly code that ghc generates for simple
 pattern matching for situations like:

 foo :: Int - Int
 foo 1 = 3
 foo 2 = 10
 foo 3 = 2
 foo 4 = 42
 -- ... other random assignments

 and I noticed that it doesn't seem to generate a jump table (or even a
 table lookup)  like, for instance, gcc would for this switch statement:

 int foo(int x) {
   switch (c) {
 case 1: return 3;
 case 2: return 10;
 case 3: return 2;
 case 4: return 42;
 // ... etc.
   }
 }

 Under -O3 ghc seems to produce a binary-search of the cases.

 Questions: Would generating a jump/lookup table for pattern matches like
 this (i.e. with a suitable density of cases) be beneficial? And, if so,
 would it be difficult to add to ghc? And would it be a good first project
 for someone who wants to get into the ghc code base (perhaps with some
 mentoring from the community?)


I was just digging around in the native code generator so I have a few
leads for you.

GHC can already generate jump tables, look at genSwitch in
compiler/nativeGen/X86/CodeGen.hs, and it is what a CmmSwitch gets compiled
into. Follow that into the codeGen and you see CmmSwitch is only created in
emitSwitch in StgCmmExpr.hs. You can follow that farther and see when that
is invoked.

I have no clue if it's a worthwhile thing to do. Try it and measure the
impact.

Niklas


 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Monad Transformer Space Leak

2013-07-18 Thread Niklas Hambüchen
Did you file this as a bug?

On Tue 23 Apr 2013 23:16:03 JST, Clark Gaebel wrote:
 I'm on 7.6.2, and it does. Oh no.

   - Clark

 On Tuesday, April 23, 2013, Tom Ellis wrote:

 On Tue, Apr 23, 2013 at 09:36:04AM +0200, Petr Pudlák wrote:
  I tested it on GHC 6.12.1, which wasn't affected by the recent
 ackermann
  bug, but still it leaks memory.

 I tested it on GHC 7.4.1 and I don't see any space leak.

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org javascript:;
 http://www.haskell.org/mailman/listinfo/haskell-cafe



 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Monad Transformer Space Leak

2013-07-18 Thread Niklas Hambüchen
Sounds like a Real Good Thing to do :)

On Fri 19 Jul 2013 11:10:25 JST, Clark Gaebel wrote:
 No I haven't.

   - Clark

 On Thu, Jul 18, 2013 at 10:07 PM, Niklas Hambüchen m...@nh2.me wrote:
 Did you file this as a bug?

 On Tue 23 Apr 2013 23:16:03 JST, Clark Gaebel wrote:
 I'm on 7.6.2, and it does. Oh no.

   - Clark

 On Tuesday, April 23, 2013, Tom Ellis wrote:

 On Tue, Apr 23, 2013 at 09:36:04AM +0200, Petr Pudlák wrote:
  I tested it on GHC 6.12.1, which wasn't affected by the recent
 ackermann
  bug, but still it leaks memory.

 I tested it on GHC 7.4.1 and I don't see any space leak.

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org javascript:;
 http://www.haskell.org/mailman/listinfo/haskell-cafe



 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ordNub

2013-07-15 Thread Niklas Hambüchen
Hey Jason,

would you mind giving a short idea of what the point of Bird's
implementation is / from what properties it is derived?

Also, running the QuickCheck tests you added, it doesn't give the same
output (order) as nub.

On 15/07/13 13:26, Jason Dagit wrote:
 Richard Bird has a book, Pearls of Functional Algorithm Design that
 is meant to teach a form of deriving algorithms from the properties we
 ask of them. In this book, he gives a possible derivation of ordNub,
 simply called nub in the book, following the methodology he is
 teaching. He notes in the text that this derivation feels more
 complicated than it ought.
 
 Here is his version: http://lpaste.net/87625
 
 I just sent you a pull request to add that one and S.toList .
 S.fromList that was suggested in this thread. I don't think those two
 implementations are faster than the others but it's nice to have them
 for completeness.
 
 Jason
 

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Hoogle problems?

2013-07-15 Thread Niklas Hambüchen
OK, but why does it need to go down for migration?

On Mon 15 Jul 2013 23:52:02 SGT, Daniel F wrote:
 The web site is migrating.
 IRC says: Topic for #haskell: haskell.org in the middle of migration;
 expect turbulence; use  www.haskell.org


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] ordNub

2013-07-14 Thread Niklas Hambüchen
tldr: nub is abnormally slow, we shouldn't use it, but we do.


As you might know, Data.List.nub is O(n²). (*)

As you might not know, almost *all* practical Haskell projects use it,
and that in places where an Ord instance is given, e.g. happy, Xmonad,
ghc-mod, Agda, darcs, QuickCheck, yesod, shake, Cabal, haddock, and 600
more (see https://github.com/nh2/haskell-ordnub).

I've taken the Ord-based O(n * log n) implementation from yi using a Set:

  ordNub :: (Ord a) = [a] - [a]
  ordNub l = go empty l
where
  go _ [] = []
  go s (x:xs) = if x `member` s then go s xs
else x : go (insert x s) xs


and put benchmarks on
http://htmlpreview.github.io/?https://github.com/nh2/haskell-ordnub/blob/1f0a2c94a/report.html
(compare `nub` vs `ordNub`).

`ordNub` is not only in a different complexity class, but even seems to
perform better than nub for very small numbers of actually different
list elements (that's the numbers before the benchmark names).

(The benchmark also shows some other potential problem: Using a state
monad to keep the set instead of a function argument can be up to 20
times slower. Should that happen?)

What do you think about ordNub?

I've seen a proposal from 5 years ago about adding a *sort*Nub function
started by Neil, but it just died.


(*) The mentioned complexity is for the (very common) worst case, in
which the number of different elements in the list grows with the list
(alias you don't have an N element list with always only 5 different
things inside).

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ordNub

2013-07-14 Thread Niklas Hambüchen
One of my main points is:

Should we not add such a function (ord-based, same output as nub, 
stable, no sorting) to base?

As the package counting shows, if we don't offer an alternative, people 
obviously use it, and not to our benefit.

(Not to say it this way:
We could make the Haskell world fast with smarter fusion, strictness 
analysis and LLVM backends.
Or we could stop using quadratic algorithms.)

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: custom-hackage

2013-06-16 Thread Niklas Hambüchen
Hello Albert,

thanks for this! Please don't be reluctant with this, it is very
appreciated.

I have updated the script to use the paths as you described, and it
seems to work quite well. The fact that all tars land under package/
even makes is easier to use.

It would be great if you could give it another try.

Niklas

On 17/06/13 02:42, Albert Y. C. Lai wrote:
 On 13-06-13 11:09 AM, Niklas Hambüchen wrote:
 https://github.com/nh2/custom-hackage

 An (almost trivial) script to generate 00-index.tar.gz which is
 necessary to run your own `remote-repo`.
 
 I write the following critique with much reluctance, since I will be
 saying a lot of this cannot possibly work, here is why, but I would
 also like to think that it had worked for you before you published it.
 
 Assume the remote-repo line goes like
 
 remote-repo: custom:http://127.0.0.1:8080/packages/archive
 
 And assume it has just one package, formula-1.1
 
 Then your scheme uses this layout:
 
   http://127.0.0.1:8080/00-index.tar.gz
   http://127.0.0.1:8080/packages/archive/formula/1.1/formula-1.1.tar.gz
 
 However, cabal-install expects this layout:
 
   http://127.0.0.1:8080/packages/archive/00-index.tar.gz
   http://127.0.0.1:8080/packages/archive/package/formula-1.1.tar.gz
 
 I know this by both reading cabal-install source code and empirical
 tests, both 0.14 and 1.16.
 
 I have a working example at
 http://www.vex.net/~trebla/haskell/conrepo
 
 Lastly, I want to emphasize these points:
 
 The layout is different from Hackage's; cabal-install source code
 hardcodes treating Hackage differently. Yes, it goes out of its way to
 detect http://hackage.haskell.org/packages/archive; and do a different
 thing. Mimicking Hackage is futile, unless you go out of your way to
 also mimic the host name hackage.haskell.org.
 
 And the layout is different from local-repo's; local-repo's is in fact
 close to Hackage's.
 
 See my
 http://www.vex.net/~trebla/haskell/cabal-cabal.xhtml#remote-repo
 
 
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell] ANN: custom-hackage

2013-06-13 Thread Niklas Hambüchen
https://github.com/nh2/custom-hackage

An (almost trivial) script to generate 00-index.tar.gz which is
necessary to run your own `remote-repo`.

If you are a company that has to rely on that not everybody with a
Hackage account can run arbitrary code on your computer at your next
cabal install, and you want to make available only select versions of
packages (as opposed to a full hackage mirror), this is for you.

Just drop your tars into the directory structure, run the script and
serve it over HTTP.

___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell


Re: [Haskell-cafe] Testing invasive proposals with Hackager

2013-06-13 Thread Niklas Hambüchen
On 13/06/13 10:06, Conrad Parker wrote:
 How do we add packages to the list; do you have a github repo for it?

I've put it on haskell-pkg-janitors:

https://github.com/haskell-pkg-janitors/hackage-build-deps/blob/master/ubuntu-13.04.txt

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Testing invasive proposals with Hackager

2013-06-13 Thread Niklas Hambüchen
On 13/06/13 18:36, Vo Minh Thu wrote:
 For example, here is a run with GHC, no special options and using 4
 threads (note that this generally takes a long time, i.e. a few days):

My builds finished in  10 hours on an i7.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Automating Hackage accounts

2013-06-13 Thread Niklas Hambüchen
 As for the user account creation and uploading packages you don't own,
 Hackage 2 (any day now) has fixes for both.

Does Hackage 2 have SSL at least for the web interface?

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] ANN: custom-hackage

2013-06-13 Thread Niklas Hambüchen
https://github.com/nh2/custom-hackage

An (almost trivial) script to generate 00-index.tar.gz which is
necessary to run your own `remote-repo`.

If you are a company that has to rely on that not everybody with a
Hackage account can run arbitrary code on your computer at your next
cabal install, and you want to make available only select versions of
packages (as opposed to a full hackage mirror), this is for you.

Just drop your tars into the directory structure, run the script and
serve it over HTTP.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Automating Hackage accounts

2013-06-13 Thread Niklas Hambüchen
 I'm not quite sure what it would achieve, though.

That if I want to upload something without my password going over in 
plain text, I can at least use the file upload form.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Testing invasive proposals with Hackager

2013-06-12 Thread Niklas Hambüchen
In many discussions we make guesses about how much code proposals like
Functor = Monad would break.

You can use https://github.com/dterei/Hackager to build all of Hackage
(preferably in a VM).

Of course many packages have external dependencies, so I'd like to share
the following list of packages to save you some time.


(These are the names of packages suited for a Ubuntu 13.04 VM, and with
these installed, 2800 packages are successfully built and 1700 failing,
so it's quite good coverage. If you find more packages that improve on
this, please add them.)

acl-dev
attr-dev
binutils-dev
cfitsio-dev
expect-dev
freeglut3-dev
libadns1-dev
libalure-dev
libasound-dev
libaspell-dev
libatlas-dev
libaugeas-dev
libavcodec-dev
libavfilter-dev
libavformat-dev
libavutil-dev
libbibutils-dev
libbluetooth-dev
libbz2-dev
libcal3d12-dev
libcmph-dev
libcrack2-dev
libcrypto++-dev
libcsound64-dev
libctemplate-dev
libcurl-dev
libcv-dev
libcwiid-dev
libdb-dev
libdevil-dev
libdpkg-dev
libev-dev
libevent-dev
libexif-dev
libfam-dev
libfcgi-dev
libfftw3-dev
libfltk1.3-dev
libfreenect-dev
libftgl-dev
libfuse-dev
libgd2-xpm-dev
libgeoip-dev
libglfw-dev
libglpk-dev
libgmime-2.6-dev
libgnome-keyring-dev
libgnutls-dev
libgnutls-dev
libgpcl-dev
libhighgui-dev
libimlib2-dev
libinsighttoolkit4-dev
libjasper-dev
libjudy-dev
libkyotocabinet-dev
liblapack-dev
libldap2-dev
libldap2-dev
libleveldb-dev
libmagic-dev
libmarkdown2-dev
libmecab-dev
libmpfr-dev
libmtp-dev
libmx-dev
libmysqlclient-dev
libncurses-dev
libncurses-dev
libnotmuch-dev
libobjc-4.7-dev
libodbc1
libode-dev
libogg-dev
libois-dev
libopenal-dev
libpam0g-dev
libpcap-dev
libpoker-eval-dev
libportaudio-dev
libpulse-dev
libqd-dev
libqrencode-dev
libraw1394-dev
libreadline-dev
libscsynth1
libselinux-dev
libsnappy-dev
libsndfile1-dev
libsqlite3-dev
libssl-dev
libssl-dev
libst-dev
libsvm-dev
libtalloc-dev
libtbb-dev
libtheora-dev
libtiff-dev
libtokyocabinet-dev
libtokyotyrant-dev
libtre-dev
libuuid-dev
libv4l-dev
libvxl1-dev
libxapian-dev
libxen-dev
libxerces-c-dev
libxine-dev
libxmmsclient-dev
libxosd-dev
libxqilla-dev
libxss-dev
libxtst-dev
libyaml-dev
libz-dev
libzephyr-dev
libzmq-dev
linux-libc-dev
tcl-dev
wx2.8-headers
xmms2-dev

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANNOUNCE: standalone-haddock-1.0

2013-06-07 Thread Niklas Hambüchen
Awesome! I've wanted that many times.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GADT and instance deriving

2013-05-24 Thread Niklas Hambüchen
On Sat 25 May 2013 00:37:59 SGT, TP wrote:
 Is this the right way to go? Is there any other solution?

I believe whether it's right or just depends on what you want to express.

 Do you confirm that tilde in s~s1 means s has the same type as s1?

It means: Both your s and s1 are Eqs but not necessarily the same one.

Your first example allows that, so you could have one with an Int and
one with a String inside (both are Eqs).

a = Box 1
b = Box hello

Now if that first code compiled, your code

(Box s1) == (Box s2) = s1 == s2

would effectively perform

... = 1 == hello

which is not possible.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GADT and instance deriving

2013-05-24 Thread Niklas Hambüchen


On 25/05/13 06:06, Alexander Solla wrote:
 On Fri, May 24, 2013 at 10:41 AM, Niklas Hambüchen m...@nh2.me
 mailto:m...@nh2.me wrote:
 
 On Sat 25 May 2013 00:37:59 SGT, TP wrote:
  Is this the right way to go? Is there any other solution?
 
 I believe whether it's right or just depends on what you want to
 express.
 
  Do you confirm that tilde in s~s1 means s has the same type as s1?
 
 It means: Both your s and s1 are Eqs but not necessarily the same one.
 
 
 No, it doesn't.  s1 ~ s2 means the types are the same.  ~ is the
 equality constraint.
 
 http://www.haskell.org/ghc/docs/7.4.1/html/users_guide/equality-constraints.html
  
 To say that s1 and s2 are Eq's, but not necessarily the same one, we
 would write a constraint of the form:

Sorry, I didn't formulate that clearly: I meant to describe what the
problem in the complaint about s1 ~ s2 is, not what s1 ~ s2 means.


 Your first example allows that, so you could have one with an Int and
 one with a String inside (both are Eqs).
 
  ...

 Nope.  It would perform (Just 1) == (cast hello), which is completely
 possible, since (cast hello) has the same type as (Just 1).


That's why I said your first example; there is no cast in it.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Infrastructure for testing the impact of a Functor/Applicative/Monad hierarchy

2013-05-22 Thread Niklas Hambüchen
Ian Lynagh just posted a link to the hackager program:

http://hackage.haskell.org/trac/ghc/wiki/HackageTesting

That seems to be pretty much what I was looking for.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ghc-mod v2.0.1

2013-05-20 Thread Niklas Hambüchen
Awesome, even with Cabal API!

Just one note: The emacs link on the left is not found.

On Tue 21 May 2013 10:31:01 SGT, Kazu Yamamoto (山本和彦) wrote:
 Hi cafe!

 I have released ghc-mod v2.0.1. From this version, ghc-mod provides
 the ghc-mod library in addition to the ghc-mod command:

   http://hackage.haskell.org/package/ghc-mod
   http://mew.org/~kazu/proj/ghc-mod/en/

 Enjoy!

 --Kazu

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Non-deterministic behaviour of aeson's parser

2013-05-18 Thread Niklas Hambüchen
Can't reproduce:

% ./aeson | sort | uniq -c
   2000 Right ()
% ./aeson | sort | uniq -c
   2000 Right ()
% ./aeson | sort | uniq -c
   2000 Right ()
% ./aeson | sort | uniq -c
   2000 Right ()
% ./aeson | sort | uniq -c
   2000 Right ()

Time 100:

% ./aeson | sort | uniq -c
 20 Right ()


My packages:

% ghc-pkg list
/var/lib/ghc/package.conf.d
   Cabal-1.16.0
   array-0.4.0.1
   base-4.6.0.1
   bin-package-db-0.0.0.0
   binary-0.5.1.1
   bytestring-0.10.0.2
   containers-0.5.0.0
   deepseq-1.3.0.1
   directory-1.2.0.1
   filepath-1.3.0.1
   ghc-7.6.2
   ghc-prim-0.3.0.0
   haskell2010-1.1.1.0
   haskell98-2.0.0.2
   hoopl-3.9.0.0
   hpc-0.6.0.0
   integer-gmp-0.5.0.0
   old-locale-1.0.0.5
   old-time-1.1.0.1
   pretty-1.1.1.0
   process-1.1.0.2
   rts-1.0
   template-haskell-2.8.0.0
   time-1.4.0.1
   unix-2.6.0.1
/home/niklas/.ghc/x86_64-linux-7.6.2/package.conf.d
   HTTP-4000.2.8
   HUnit-1.2.5.2
   QuickCheck-2.6
   Xauth-0.1
   aeson-0.6.1.0
   ansi-terminal-0.6
   attoparsec-0.10.4.0
   attoparsec-binary-0.2
   base-unicode-symbols-0.2.2.4
   blaze-builder-0.3.1.1
   byteorder-1.0.4
   cipher-aes-0.1.8
   convertible-1.0.11.1
   cpphs-1.16
   dlist-0.5
   ghc-paths-0.1.0.9
   ghc-syb-utils-0.2.1.1
   hashable-1.2.0.6
   haskell-lexer-1.0
   haskell-src-exts-1.13.5
   hidapi-1.0
   hlint-1.8.44
   hscolour-1.20.3
   hspec-1.5.4
   hspec-expectations-0.3.2
   io-choice-0.0.3
   lifted-base-0.2.0.4
   monad-control-0.3.2.1
   mtl-2.1.2
   network-2.4.1.2
   parsec-3.1.3
   pretty-show-1.5
   primitive-0.5.0.1
   quickcheck-io-0.1.0
   random-1.0.1.1
   robot-1.0.1.1
   robot-1.1
   setenv-0.1.0
   stm-2.4.2
   storable-record-0.0.2.5
   syb-0.4.0
   text-0.11.3.0
   transformers-0.3.0.0
   transformers-base-0.4.1
   uniplate-1.6.10
   unordered-containers-0.2.3.1
   utility-ht-0.0.9
   vector-0.10.0.1
   vector-th-unbox-0.2.0.1
   xhb-0.5.2012.11.23
   zlib-0.5.4.1


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Infrastructure for testing the impact of a Functor/Applicative/Monad hierarchy

2013-05-16 Thread Niklas Hambüchen
Reading the other thread (Adding Applicative/Functor instances to all
Monads in GHC) I was wondering if there was infrastructure for testing
what effect making the often-discussed Functor/Monad change would have:
How many packages on hackage would break etc.

I have read a few times that people have compiled all of hackage to
see the impact of whatever.

How do you do that?

Do you just run a loop around cabal install or have you built some more
advanced tools to visualize the results better or compile the packages
from ground up, in order of their dependencies?

I'm interested in anything in this direction.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Summary (Re: Interfacing Java/Haskell)

2013-05-15 Thread Niklas Hambüchen
For a simple interchange format, you might also look at MSGPACK; the 
bindings are nice and the format is simple.

I used it for call-haskell-from-anything 
(https://github.com/nh2/call-haskell-from-anything), a concept with 
which you can call Haskell code from any language that supports loading 
shared object files.

On Thu 16 May 2013 02:07:41 SGT, Hans Georg Schaathun wrote:
 The most common approach appears to be a network interface between
 separate java and haskell processes.  Both JSON and thrift appear to
 tools to help doing that.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Parallel ghc --make

2013-05-15 Thread Niklas Hambüchen
Hello Thomas,

thanks for your detailed answer.

 Could be worthwhile re-evaluating the patch.

Does your patch still apply somewhat cleanly?
And does it address all the caches in your list already or only some
subset of them?

 To have a multi-process ghc --make you don't need thread-safety.
 However, without sharing the caches -- in particular the interface
 file caches -- the time to read data from the disk may outweigh any
 advantages from parallel execution.

That might be a big step already - I've never seen a project where I'd
care about parallel compilation that is not totally CPU-bound.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: Robot - Simulate keyboard and mouse events under X11

2013-05-14 Thread Niklas Hambüchen
Ah OK.

Thank you again for the fast fixes!

On Tue 14 May 2013 11:44:43 SGT, Chris Wong wrote:
 I removed the functionality because I didn't really see a use for it
 anymore. The `hold` and `tap` functions are already exception safe
 (thanks to `bracket`), and anyone who uses the unguarded `press`
 function probably wants to keep it held down anyway.

 Chris


 On Tue, May 14, 2013 at 12:46 PM, Niklas Hambüchen m...@nh2.me wrote:
 Awesome, that works very well, and it even made my program run faster /
 with less CPU.

 The reset functionality is useful, but I think optional is better. Did
 you remove it entirely or is it still available?

 On Tue 14 May 2013 08:25:04 SGT, Chris Wong wrote:
 Oh, I see now. I originally made the runRobot functions reset the
 input state when the Robot finished running. That worked well for my
 use case (testing GUIs), but as you have noticed, it causes
 unintuitive behavior when runRobot is called at a high frequency.

 In hindsight, that was a design flaw on my part: that resetting
 behavior should be specified explicitly, not attached unconditionally
 to every call to runRobot.

 I've removed the offending code, and released it as version 1.1.
 Hopefully I've ironed out the issues now :)


 On Mon, May 13, 2013 at 12:49 PM, Niklas Hambüchen m...@nh2.me wrote:
 Can you show me the code that triggers that behavior?

 It is basically

 Just connection - connect
 forever $ do
   (x,y) - getGyroMovement
   runRobotWithConnection (moveBy x y) connection



 --
 Chris Wong, fixpoint conjurer
   e: lambda.fa...@gmail.com
   w: http://lfairy.github.io/



 --
 Chris Wong, fixpoint conjurer
   e: lambda.fa...@gmail.com
   w: http://lfairy.github.io/

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Parallel ghc --make

2013-05-13 Thread Niklas Hambüchen
I know this has been talked about before and also a bit in the recent
GSoC discussion.

I would like to know what prevents ghc --make from working in parallel,
who worked at that in the past, what their findings were and a general
estimation of the difficulty of the problem.

Afterwards, I would update
http://hackage.haskell.org/trac/ghc/ticket/910 with a short summary of
what the current situation is.

Thanks to those who know more!

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: Robot - Simulate keyboard and mouse events under X11

2013-05-13 Thread Niklas Hambüchen
Awesome, that works very well, and it even made my program run faster / 
with less CPU.

The reset functionality is useful, but I think optional is better. Did 
you remove it entirely or is it still available?

On Tue 14 May 2013 08:25:04 SGT, Chris Wong wrote:
 Oh, I see now. I originally made the runRobot functions reset the
 input state when the Robot finished running. That worked well for my
 use case (testing GUIs), but as you have noticed, it causes
 unintuitive behavior when runRobot is called at a high frequency.

 In hindsight, that was a design flaw on my part: that resetting
 behavior should be specified explicitly, not attached unconditionally
 to every call to runRobot.

 I've removed the offending code, and released it as version 1.1.
 Hopefully I've ironed out the issues now :)


 On Mon, May 13, 2013 at 12:49 PM, Niklas Hambüchen m...@nh2.me wrote:
 Can you show me the code that triggers that behavior?

 It is basically

 Just connection - connect
 forever $ do
   (x,y) - getGyroMovement
   runRobotWithConnection (moveBy x y) connection



 --
 Chris Wong, fixpoint conjurer
   e: lambda.fa...@gmail.com
   w: http://lfairy.github.io/

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: Robot - Simulate keyboard and mouse events under X11

2013-05-12 Thread Niklas Hambüchen
Yes, that works now.

I have another problem though: I move the cursor at high resolution 
(128 Hz) and it seems that when robot issues a command to X, it 
disables (keyboard) state so far. This means that it's impossible for 
me to Ctrl-C my program: Only c is sent all the time, me pressing 
Ctrl seems to be reset with the next robot event.

On Sun 12 May 2013 16:02:06 SGT, Chris Wong wrote:
 On Thu, May 9, 2013 at 1:36 PM, Chris Wong
 chrisyco+haskell-c...@gmail.com wrote:
 On Thu, May 9, 2013 at 4:47 AM, Niklas Hambüchen m...@nh2.me wrote:
 Hi,

 I just started using your library to move my cursor.

 Is it possible that it ignores negative values in moveBy?

 In other words, I can only move the cursor into one direction.

 I did some research, and traced this to a bug in an old (1.6) version
 of xcb-proto [1]. The coordinates were declared incorrectly as Word16,
 instead of Int16 as they should have been. It's been fixed in
 xcb-proto since 1.7.

 Okay, I've released a new version of Robot (1.0.1.1), that should fix
 this bug. Niklas: can you try it out please?

 Also, it turns out taking a screenshot is much easier than I thought.
 A single call to getImage returns a list of bytes, which happens to
 match exactly the internal structure used by JuicyPixels. I'll look
 deeper into this when I get the time.

 Chris

 --
 Chris Wong, fixpoint conjurer
   e: lambda.fa...@gmail.com
   w: http://lfairy.github.io/

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: Robot - Simulate keyboard and mouse events under X11

2013-05-12 Thread Niklas Hambüchen
 Can you show me the code that triggers that behavior?

It is basically

Just connection - connect
forever $ do
  (x,y) - getGyroMovement
  runRobotWithConnection (moveBy x y) connection

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ghci: Difference in garbage collection etc. between REPL and function

2013-05-09 Thread Niklas Hambüchen
On 09/05/13 20:50, Brandon Allbery wrote:
 ghci is in many ways like an endless (or at least until :l/:r)
 do-block. In particular, the handle remains in scope after you run your
 commands at the prompt, so it is not garbage collected.  If you enclose
 it into its own do block, this introduces local scope and the handle
 goes out of scope and is garbage collected at the end.

I am not sure how the handle is relevant - I do not expect it to garbage
collected before the close or rely on that, and my problem happens
earlier already.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: Robot - Simulate keyboard and mouse events under X11

2013-05-08 Thread Niklas Hambüchen
Hi,

I just started using your library to move my cursor.

Is it possible that it ignores negative values in moveBy?

In other words, I can only move the cursor into one direction.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] ghci: Difference in garbage collection etc. between REPL and function

2013-05-08 Thread Niklas Hambüchen
I have an annoying bug in a C binding that can be triggered like this:


handle - open ...

prep - makePreparedStatement handle INSERT ...

performGC

runStatement prep

close handle

If I run these steps one by one in ghci, garbage ends up in my handle as
expected.

However, if I let main = do ... this whole block in order to pack it
in a test case, it does not happen, neither in ghci nor ghc.

What might be the special magic in ghci's REPL that allows me to trigger
my bug so easily there?

Thanks
Niklas


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Hackage checking maintainership of packages

2013-05-06 Thread Niklas Hambüchen
On 06/05/13 17:46, Tillmann Rendel wrote:
 So what about this: Hackage could try to automatically collect and
 display information about the development status of packages that allow
 potential users to *guess*

In my opinion, that's what we have now.

Obtaining the info in the four points you mention from their respective
sources usually takes less than a minute in sum - hackage saving me that
minute would give me little added value.

Having the metrics you mention is nice, but still they are just metrics
and say little the only thing that's important:

   Is there a human who commits themselves to this package?

 I like the idea of displaying additional info about the status of
 package development, but I don't like the idea of annoying hard-working
 package maintainers with emails about their perfect packages

I really think this is not too big of a deal, getting one email every 3
months and clicking a few checkboxes.

Probably fits into one cabal update.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


  1   2   3   4   5   6   >