Re: [Haskell-cafe] Proposal: Partitionable goes somewhere + containers instances

2013-09-29 Thread Mario Blažević
On 09/29/13 08:20, Edward Kmett wrote: I don't know that it belongs in the standard libraries, but there could definitely be a package for something similar. ConstraintKinds are a pretty hefty extension to throw at it, and the signature written there prevents it from being used on ByteString,

Re: [Haskell-cafe] Monomorphic containers, Functor/Foldable/Traversable WAS: mapM_ for bytestring

2013-09-13 Thread Mario Blažević
On 09/13/13 01:51, Michael Snoyman wrote: On Fri, Sep 13, 2013 at 5:38 AM, Mario Blažević blama...@acanac.net mailto:blama...@acanac.net wrote: On 09/11/13 19:37, John Lato wrote: 3. I'm not entirely sure that the length* functions belong here. I understand why

Re: [Haskell-cafe] Monomorphic containers, Functor/Foldable/Traversable WAS: mapM_ for bytestring

2013-09-13 Thread Mario Blažević
On 09/13/13 02:28, Michael Snoyman wrote: On Fri, Sep 13, 2013 at 9:18 AM, Mario Blažević blama...@acanac.net mailto:blama...@acanac.net wrote: On 09/13/13 01:51, Michael Snoyman wrote: On Fri, Sep 13, 2013 at 5:38 AM, Mario Blažević blama...@acanac.net

Re: [Haskell-cafe] Monomorphic containers, Functor/Foldable/Traversable WAS: mapM_ for bytestring

2013-09-12 Thread Mario Blažević
On 09/11/13 19:37, John Lato wrote: I didn't see this message and replied privately to Michael earlier, so I'm replicating my comments here. 1. Sooner or later I expect you'll want something like this: class LooseMap c el el' where lMap :: (el - el') - c el - c el' It covers the case of

Re: [Haskell-cafe] Traversals of monomorphic containers

2013-09-03 Thread Mario Blažević
On 09/02/13 06:53, Nicolas Trangez wrote: # Redirected to haskell-cafe On Sun, 2013-09-01 at 14:58 +0400, Artyom Kazak wrote: Would this be an appropriate place to propose adding mapM_ (and then possibly mapM) to bytestring library? Was it suggested before? If yes, why was it rejected? This

Re: [Haskell-cafe] monoids induced by Applicative/Alternative/Monad/MonadPlus?

2013-08-23 Thread Mario Blažević
On 13-08-22 04:04 PM, Petr Pudlák wrote: Or, if there are no such definitions, where would be a good place to add them? If they are to be added to the base libraries, the Data.Monoid module would be my choice. I did wish I had the AppMonoid instance on several occasions, when using

Re: [Haskell-cafe] monoids induced by Applicative/Alternative/Monad/MonadPlus?

2013-08-23 Thread Mario Blažević
See also this thread from two years ago: http://www.haskell.org/pipermail/haskell-cafe/2011-June/091294.html ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] ANNOUNCE: monoid-subclasses-0.1.1, incremental-parser-0.2.2, and SCC-0.8

2013-03-21 Thread Mario Blažević
The new package monoid-subclasses [1] exports a number of classes that sit between monoids and groups: ReductiveMonoid, CancellativeMonoid, GCDMonoid, MonoidNull, and FactorialMonoid among others. The package also comes with class instances for all applicable data types from base, vector,

Re: [Haskell-cafe] Open-source projects for beginning Haskell students?

2013-03-15 Thread Mario Blažević
On 13-03-11 10:52 PM, Michael Orlitzky wrote: On 03/11/2013 11:48 AM, Brent Yorgey wrote: So I'd like to do it again this time around, and am looking for particular projects I can suggest to them. Do you have an open-source project with a few well-specified tasks that a relative beginner (see

Re: [Haskell-cafe] Suggestiong for inter-thread communication

2013-01-28 Thread Mario Blažević
On 13-01-26 05:28 AM, Erik de Castro Lopo wrote: Thiago Negri wrote: Do you need advice on what? I didn't understand your last phrase. Well I have data from two sources, stdin and the calculation thread. If I was doing this in C, I'd probably use a pipe for the calculation data and then do

Re: [Haskell-cafe] Call for discussion: OverloadedLists extension

2012-09-28 Thread Mario Blažević
On 12-09-26 08:07 PM, wren ng thornton wrote: On 9/25/12 1:57 PM, Sjoerd Visscher wrote: Maybe we could make a literal [a,b,c] turn into unpack [a,b,c]# where [a,b,c]# is a statically-allocated vector? I'm kinda surprised this isn't already being done. Just doing this seems like it'd

Re: [Haskell-cafe] [ANNOUNCE] Fmark markup language

2012-09-19 Thread Mario Blažević
On 12-09-18 07:37 PM, Richard O'Keefe wrote: On 19/09/2012, at 1:43 AM, Stefan Monnier wrote: The problem with that is that some people DO end some headings with a full stop; for them your special syntax is not natural. Markdown/ReST is already using the no syntax idea (e.g. compared to

Re: [Haskell-cafe] [Pipes] Can pipes solve this problem? How?

2012-08-16 Thread Mario Blažević
On 12-08-15 02:54 PM, Daniel Hlynskyi wrote: Hello Cafe. Consider code, that takes input from handle until special substring matched: matchInf a res s | a `isPrefixOf` s = reverse res matchInf a res (c:cs) = matchInf a (c:res) cs hTakeWhileNotFound str hdl = hGetContents

Re: [Haskell-cafe] Parallel cooperative multithreading?

2012-05-23 Thread Mario Blažević
On 12-05-22 09:55 AM, Benjamin Ylvisaker wrote: Has anyone ever worked on implementing something like this in Haskell? http://www.cs.hmc.edu/~stone/papers/ocm-unpublished.pdf The outline of the idea: - Concurrent programming is really hard with the popular frameworks today. - For most

Re: [Haskell-cafe] Mixing Unboxed Mutable Vectors and Parsers

2012-04-10 Thread Mario Blažević
On 12-04-07 05:35 PM, Myles C. Maxfield wrote: So here are my questions: ... 3. Are there any parsers that support streaming semantics and being used as a monad transformer? This would require rewriting my whole program to use this new parser, but if that's what I have to do, then so be it.

Re: [Haskell-cafe] ANNOUNCE: pipes-core 0.0.1

2012-03-11 Thread Mario Blažević
On 12-03-11 09:09 AM, Paolo Capriotti wrote: The Category law would be broken, though: unawait x id == yield x !== unawait x How did you get this equation? It's not even well-typed: unawait :: a - Pipe a b m () yield :: b - Pipe a b m () You're right, it's completely wrong. I was

Re: [Haskell-cafe] ANNOUNCE: pipes-core 0.0.1

2012-03-11 Thread Mario Blažević
On 12-03-11 12:39 PM, Chris Smith wrote: On Sun, Mar 11, 2012 at 10:30 AM, Mario Blaževićblama...@acanac.net wrote: (p1 unawait x) p2 = (p1 p2)* unawait x -- this one tripped me up I don't think this could reasonably hold. For example, you'd expect that for any p, idP p == idP

Re: [Haskell-cafe] ANNOUNCE: pipes-core 0.0.1

2012-03-11 Thread Mario Blažević
On 12-03-11 01:36 PM, Chris Smith wrote: On Sun, Mar 11, 2012 at 11:22 AM, Mario Blaževićblama...@acanac.net wrote: No, idP does terminate once it consumes its input. Your idP p first reproduces the complete input, and then runs p with empty input. This is just not true. idP consumes

Re: [Haskell-cafe] ANNOUNCE: pipes-core 0.0.1

2012-03-10 Thread Mario Blažević
On 12-03-10 05:16 AM, Paolo Capriotti wrote: On Sat, Mar 10, 2012 at 4:21 AM, Mario Blaževićblama...@acanac.net wrote: I like your design, it seems to strike a good balance between elegance and practicality. The only thing missing for the latter is a deeper support for chunking. Of course,

Re: [Haskell-cafe] ANNOUNCE: pipes-core 0.0.1

2012-03-10 Thread Mario Blažević
On 12-03-10 05:19 PM, Twan van Laarhoven wrote: On 2012-03-10 11:16, Paolo Capriotti wrote: Another issue is how to deal with unconsumed input. For that, there is a ChunkPipe type (in pipes-extra) with a specialized monad instance that threads unconsumed input along. You can see an example of

Re: [Haskell-cafe] ANNOUNCE: pipes-core 0.0.1

2012-03-10 Thread Mario Blažević
On 12-03-10 09:05 PM, Twan van Laarhoven wrote: On 2012-03-11 00:09, Mario Blažević wrote: On 12-03-10 05:19 PM, Twan van Laarhoven wrote: -- | Pass some unconsumed input back upstream. -- The next @await@ will return this input without blocking. unawait :: Monad m = a - Pipe a b m

Re: [Haskell-cafe] ANNOUNCE: pipes-core 0.0.1

2012-03-09 Thread Mario Blažević
On 12-03-09 07:36 PM, Paolo Capriotti wrote: I'm pleased to announce the release of version 0.0.1 of pipes-core, a library for efficient, safe and compositional IO, similar in scope to iteratees and conduits. I like your design, it seems to strike a good balance between elegance and

Re: [Haskell-cafe] How to increase performance using concurrency for sequential producer-consumer problem

2012-02-13 Thread Mario Blažević
On 12-02-13 10:12 AM, Roel van Dijk wrote: Hello, I have a program which I believe can benefit from concurrency. But I am wondering if the mechanisms I need already exist somewhere on Hackage. You can try monad-coroutine. Here is an incomplete transcription of your code: import

Re: [Haskell-cafe] TCP Server

2012-01-30 Thread Mario Blažević
On 12-01-28 06:56 AM, Felipe Almeida Lessa wrote: On Sat, Jan 28, 2012 at 9:40 AM, Yves Parèsyves.pa...@gmail.com wrote: I think there is still no consensus on which iteratee library is the one to use. There are at least iteratee, enumerator, iterIO, conduit, and pipes. The reusability of your

Re: [Haskell-cafe] The maximum/minimum asymmetry

2011-09-05 Thread Mario Blažević
On 11-09-05 10:42 AM, Sjoerd Visscher wrote: This way these laws hold for non-empty lists: maximumBy f xs = last (sortBy f xs) minimumBy f xs = head (sortBy f xs) That's not a bad justification for the way implementation works, even if it's not the original reason behind it. I think

[Haskell-cafe] The maximum/minimum asymmetry

2011-09-04 Thread Mario Blažević
I was recently surprised to discover that the maximum and maximumBy functions always return the *last* maximum, while minimum and minimumBy return the *first* minimum in the list. The following GHCi session demonstrates this: $ ghci GHCi, version 7.2.1: http://www.haskell.org/ghc/ :? for

[Haskell-cafe] Fwd: job position

2011-09-02 Thread Mario Blažević
For anybody interested in programming languages or markup languages, there is an open job position for a junior developer at Stilo (http://www.stilo.com/). Haskell is currently used only for prototyping, but there are plans to begin some major development in Haskell within a year. The job

Re: [Haskell-cafe] Data Flow Programming in FP

2011-06-21 Thread Mario Blažević
On 11-06-20 10:45 AM, Richard Senington wrote: Hi all, I have recently become interested in Dataflow programming and how it related to functional languages. I am wondering if the community has any advice on reading matter or other directions to look at. So far I have been looking through

Re: [Haskell-cafe] question about interruptable state runner

2011-06-13 Thread Mario Blažević
On 11-06-09 04:14 PM, Alexander V Vershilov wrote: Hello. I'm writing a small tcp server with that can handle connections and answer by rules writen in a small script that can be interpreted by server. For this purpose I've written an interpreter that has type ErrorT MyError (StateT

Re: [Haskell-cafe] Attoparsec concatenating combinator

2011-06-03 Thread Mario Blažević
On 11-06-03 06:00 AM, Yitzchak Gale wrote: Mario Blažević wrote: I don't know if this helps, but the incremental-parser library has exactly the combinator you're looking for. Wow, that is a beautiful implementation of a general parser library. So much simpler than Parsec. Thanks

Re: [Haskell-cafe] Attoparsec concatenating combinator

2011-06-02 Thread Mario Blažević
On Thu, Jun 2, 2011 at 10:02 AM, Yitzchak Gale g...@sefer.org wrote: I often find while using attoparsec and attoparsec-text that I need to match a number of text parsers consecutively and concatenate the result. By text parser I mean Parser ByteString for attoparsec and Parser Text for

Re: [Haskell-cafe] ANN: quickcheck-properties

2011-05-31 Thread Mario Blažević
On 11-05-30 05:05 AM, Alexey Khudyakov wrote: On 30.05.2011 12:26, Bas van Dijk wrote: On 30 May 2011 00:14, Alexey Khudyakovalexey.sklad...@gmail.com wrote: It always puzzled me why there are no packages for for testing general type classes laws. (Monoid laws, monad laws etc). It looks like

Re: [Haskell-cafe] Policy for taking over a package on Hackage

2011-05-27 Thread Mario Blažević
On 11-05-25 08:52 AM, Johan Tibell wrote: On Wed, May 25, 2011 at 2:01 PM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: With my wl-pprint-text package, Jason Dagit suggested to me on #haskell that it would make sense to make such a pretty-printer be class-based so that the same API

Re: [Haskell-cafe] ANNOUNCE: iterIO-0.1 - iteratee-based IO with pipe operators

2011-05-06 Thread Mario Blažević
On 11-05-06 11:15 AM, Alex Mason wrote: Hi All, I really love the look of this package, but if this is going be *the* iteratee package, I would absolutely love to see it fix some of the biggest mistakes in the other iteratee packages, soecifically naming. A change in naming for the terms

Re: [Haskell-cafe] ANNOUNCE: iterIO-0.1 - iteratee-based IO with pipe operators

2011-05-06 Thread Mario Blažević
On 11-05-06 09:58 PM, dm-list-haskell-c...@scs.stanford.edu wrote: At Fri, 06 May 2011 21:27:21 -0400, Mario Blažević wrote: I'd been thinking about using the terms Source and Sink, but Source is very overloaded, and SinkSource doesn't exactly roll off the tongue or evoke a particularly helpful

Re: [Haskell-cafe] ArrowLoop and streamprocessors

2011-03-31 Thread Mario Blažević
On 11-03-30 05:29 PM, Mathijs Kwik wrote: Hi all, I'm playing around a bit with arrows (more specifically, something like a CPS style streamprocessor as described in Generalising Monads to Arrows by John Hughes). I had struggled with the same problem a year ago, and I concluded it was

Re: [Haskell-cafe] ANNOUNCE: version 0.7 of monad-parallel, monad-coroutine and SCC

2011-03-26 Thread Mario Blažević
On 11-03-26 12:27 AM, Steven Shaw wrote: Hi Mario, I wondered if you had an application in mind for your incremental parser library in Haskell? A little while ago I was following the development of an open source text editor for Mac OS X called Kod[.app]. They were wanting an incremental

Re: [Haskell-cafe] ANNOUNCE: enumerator 0.4.8

2011-03-26 Thread Mario Blažević
On 11-03-26 04:33 PM, John A. De Goes wrote: I noticed this problem some time ago. Beyond just breaking monadic associativity, there are many other issues with standard definitions of iteratees: 1. It does not make sense in general to bind with an iteratee that has already consumed

[Haskell-cafe] ANNOUNCE: version 0.7 of monad-parallel, monad-coroutine and SCC

2011-03-25 Thread Mario Blažević
Packages monad-parallel [1], monad-coroutine [2] and SCC [3] have been upgraded on Hackage to version 0.7. The monad-parallel library defines two Monad subclasses, MonadParallel and MonadFork, that enable some monadic computations to be executed in parallel and their results combined. The

Re: [Haskell-cafe] Mime / Mail library

2011-03-22 Thread Mario Blažević
On Sun, Mar 20, 2011 at 10:50 AM, Christopher Done chrisd...@googlemail.com wrote: On 20 March 2011 15:05, Pieter Laeremans pie...@laeremans.org wrote: Hi all, The MIME package that can be found on hackage, uses String as input. Would i be considered better if there would be a version

[Haskell-cafe] ANNOUNCE: incremental-parser library package

2011-03-22 Thread Mario Blažević
The first version of incremental-parser has been released on Hackage [1]. It's yet another parser combinator library, providing the usual set of Applicative and Monad combinators. Apart from this, it has three twists that make it unique. First, the parser is incremental. That means it can

Re: [Haskell-cafe] ANNOUNCE: incremental-parser library package

2011-03-22 Thread Mario Blažević
This seems very interesting. One question: The MonadPlus and the Alternative instance differ: the former's mplus combinator equals the asymmetric | choice. Why? Good question. Basically, I see MonadPlus as a union of Monad and Alternative. The class should not exist at all. But as

Re: [Haskell-cafe] [Haskell] ANNOUNCE: incremental-parser library package

2011-03-22 Thread Mario Blažević
exist in two forms, the lazy one and the greedy one, and the only difference is the underlying choice combinator, (|) vs. (|). I'm not aware of any other parsing library taking this road, though, and there must be a good reason. I'll try and see. 2011/3/22 Mario Blažević mblaze...@stilo.com

Re: [Haskell-cafe] trac.haskell.org problem

2011-03-18 Thread Mario Blažević
I've tried to send the verification e-mail from trac.haskell.org to three different e-mail accounts in the last 24 hours. None arrived. Note that I'm not trying to create a new account, I'm trying to verify my e-mail address in order to edit the Wiki pages of my projects. Can anybody else

[Haskell-cafe] Missing e-mail @haskell-cafe

2011-03-18 Thread Mario Blažević
I've sent an e-mail to Haskell Café this morning about my troubles with Trac confirmation e-mails. The e-mail must have reached the server, because it showed up in the mailing list archive: http://www.haskell.org/pipermail/haskell-cafe/2011-March/090311.html This other archive,

Re: [Haskell-cafe] (Co/Contra)Functor and Comonad

2010-12-24 Thread Mario Blažević
of the module, class and its single method, and what instances to declare inside the module. -Edward On Fri, Dec 24, 2010 at 4:51 AM, Stephen Tetley stephen.tet...@gmail.comwrote: On 24 December 2010 02:16, Mario Blažević mblaze...@stilo.com wrote: To turn the proof obligation around, what could

Re: [Haskell-cafe] (Co/Contra)Functor and Comonad

2010-12-24 Thread Mario Blažević
(Foldable f, Pointed f) = Sequence f or whatever. On Fri, Dec 24, 2010 at 4:51 AM, Stephen Tetley stephen.tet...@gmail.comwrote: On 24 December 2010 02:16, Mario Blažević mblaze...@stilo.com wrote: To turn the proof obligation around, what could possibly be the downside of adding a puny

[Haskell-cafe] (Co/Contra)Functor and Comonad

2010-12-23 Thread Mario Blažević
Why are Cofunctor and Comonad classes not a part of the base library? I recently defined a data type (Control.Cofunctor.Ticker in monad-coroutine on Hackage) that happens to be a co-functor, or contra-functor if you prefer. In other words, it can implement the following function: cofmap ::

Re: [Haskell-cafe] (Co/Contra)Functor and Comonad

2010-12-23 Thread Mario Blažević
On Thu, Dec 23, 2010 at 5:25 PM, Stephen Tetley stephen.tet...@gmail.comwrote: On 23 December 2010 21:43, Mario Blažević mblaze...@stilo.com wrote: Why are Cofunctor and Comonad classes not a part of the base library? [SNIP] Later on I found that this question has been raised before

Re: [Haskell-cafe] (Co/Contra)Functor and Comonad

2010-12-23 Thread Mario Blažević
On Thu, Dec 23, 2010 at 11:25 PM, Tony Morris tonymor...@gmail.com wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 ...regardless of the utility of a contravariant functor type-class, I strongly advocate for calling it Contrafunctor and not Cofunctor. I have seen numerous examples of

Re: [Haskell-cafe] Concurrent with monads

2010-11-15 Thread Mario Blažević
On 10-11-14 07:36 PM, Jiansen He wrote: Hi cafe, I wounder if it is possible to tell a haskell system that two computations with side effects could be executed concurrently. Here is an affected example: Suppose two people want to compare their age, but do not want to leak their personal

[Haskell-cafe] ANNOUNCE: version 0.6 of monad-coroutine and SCC

2010-11-04 Thread Mario Blažević
Packages monad-coroutine and SCC have been upgraded to version 0.6 on Hackage. The monad-coroutine package exports a generic monad transformer Coroutine: Functor s = MonadTrans (Coroutine s). A Coroutine-transformed monad can suspend at any point, returning its resumption wrapped in the

[Haskell-cafe] ANNOUNCE: coroutine-enumerator

2010-11-04 Thread Mario Blažević
The newly released coroutine-enumerator package can be used as a bridge between the enumerator and monad-coroutine packages. It provides two-way conversion functions between an Iteratee and an Await-suspending coroutine, and also between an Enumerator and a Yield-suspending coroutine. As a little

[Haskell-cafe] Re: Forall and type synonyms in GHC 7.0

2010-11-01 Thread Mario Blažević
I had the exact same problem in my regional-pointers package in the withArray function: withArray ∷ (Storable α, MonadCatchIO pr) ⇒ [α] → (∀ s. RegionalPtr α (RegionT s pr) → RegionT s pr β) → pr β I had to replace the original: withArray vals =

[Haskell-cafe] Forall and type synonyms in GHC 7.0

2010-10-31 Thread Mario Blažević
Before uploading a new version of my project on Hackage, I decided to future-proof it against GHC 7.0. I ran into several compile errors caused by the changes in let generalization, but these were easy to fix by adding extra type annotations. But then I ran into another problem that I can't

Re: [Haskell-cafe] Continuations and coroutines

2010-06-24 Thread Mario Blažević
Yves Parès wrote: It helps me understand better, but would you have some simple code that would do that ? You can look at the definition of the coroutine monad transformer in the monad-coroutine package as well: http://hackage.haskell.org/package/monad-coroutine The heart of

Re: [Haskell-cafe] [OT?] Haskell-inspired functions for BASH

2010-04-06 Thread Mario Blažević
Patrick LeBoutillier wrote: ... Basically I'm looking for a bit of feedback/info: - Does anyone know if there are already similar projets out there? You've already got some references, you can also look at http://hackage.haskell.org/package/scc which includes a shell language. - Does

[Haskell-cafe] ANN: Three package announcements

2010-03-22 Thread Mario Blažević
There are three new packages on Hackage: - monad-parallel 0.5 (http://hackage.haskell.org/package/monad-parallel) - monad-coroutine 0.5 (http://hackage.haskell.org/package/monad-coroutine) - Streaming Component Combinators 0.5 (http://hackage.haskell.org/package/scc) The

Re: [Haskell-cafe] GUI programming

2010-02-05 Thread Mario Blažević
Victor Nazarov wrote: Hello, I've been writing some GUI application with Gtk2hs. It's an interpreter for lambda-calculus and combinatory logic, it's GPL and if you interested I can share it with cafe. The problem is that the GUI code has become very ugly and I'm tempted to rewrite it totally.

[Haskell-cafe] Re: Arrow instance of Transducer (Was: [Haskell] ANN: Streaming Component Combinators 0.4)

2010-01-17 Thread Mario Blažević
Stupid question: Is it related to Arrows? Not really. You might say it's more general than arrows, because the streaming components are not restricted to a single input and single output type. On the other hand, they are all specific to stream processing, much like Fudgets and Yampa

Re: [Haskell-cafe] Re: Arrow instance of Transducer (Was: [Haskell] ANN: Streaming Component Combinators 0.4)

2010-01-17 Thread Mario Blažević
On Sun 17/01/10 4:47 PM , Twan van Laarhoven twa...@gmail.com sent: The Arrow class is too big, it includes too many things and it should be split up. This is yet another example. You can get some of the benefits of standard classes by making Transducer an instance of

[Haskell-cafe] Re: [Haskell] ANN: Streaming Component Combinators 0.4

2010-01-15 Thread Mario Blažević
Henning Thielemann wrote: Mario Blažević schrieb: Version 0.4 of Streaming Component Combinators, or SCC for short, has been released on Hackage. Get it at http://hackage.haskell.org/package/scc There isn't much new high-level functionality compared to the previous version

Re: [Haskell-cafe] forkSequence, runPar, parallelize

2009-12-09 Thread Mario Blažević
       I can't test it right now, but wouldn't the following do the job in the Identity monad? forkExec :: Identity a - Identity (Identity a) forkExec k = let result = runIdentity k             in result `par` return (Identity result) Since Identity is a newtype, would that be

Re: Re: Re: Re: [Haskell-cafe] Re: A problem with par and modules boundaries...

2009-05-24 Thread Mario Blažević
I recommend using -ddump-simpl, as it produces more readable output. Actually, I can't see any effect of that pragma in the core files whatsoever, but it certainly has effect on run time. How about diffing the whole core output (and using -ddump-simpl). If there's a performance

Re: [Haskell-cafe] Re: A problem with par and modules boundaries...

2009-05-23 Thread Mario Blažević
On Fri 22/05/09 10:51 AM , John Lato jwl...@gmail.com sent: Hi Mario, It looks like the parallelize function is getting inlined when it's in the same file, but not when it's in a separate file. Adding a {-# INLINE parallelize #-} pragma to the module with parallelize recovers all the

Re: Re: [Haskell-cafe] Re: A problem with par and modules boundaries...

2009-05-23 Thread Mario Blažević
You could probably see exactly what's happening in more detail by going through the Core output. Thank you, this advice helped. The Core output indicates that function `test' evaluates the arguments to `parallelize' before it calls it. In other words, the call to `parallelize' is optimized

Re: [Haskell-cafe] Re: A problem with par and modules boundaries...

2009-05-23 Thread Mario Blažević
On Sat 23/05/09 4:15 PM , Alexander Dunlap alexander.dun...@gmail.com sent: Does anybody know of a pragma or another way to make a function *non-strict* even if it does always evaluate its argument? In other words, is there a way to selectively disable the strictness optimization?

Re: Re: Re: [Haskell-cafe] Re: A problem with par and modules boundaries...

2009-05-23 Thread Mario Blažević
On Sat 23/05/09 2:51 PM , Duncan Coutts duncan.cou...@worc.ox.ac.uk sent: On Sat, 2009-05-23 at 13:31 -0400, Mario Blažević wrote: ... So the function is not strict, and I don't understand why GHC should evaluate the arguments before the call. Right, it's lazy in the first and strict

[Haskell-cafe] A problem with par and modules boundaries...

2009-05-21 Thread Mario Blažević
I'll cut to the chase. The short program below works perfectly: when I compile it with -O2 -threaded and run with +RTS -N2 command-line options, I get a nearly 50% real-time improvement: $ time ./primes-test +RTS -N2 5001 real0m9.307s user0m16.581s sys 0m0.200s However, if I move

Re: [Haskell-cafe] Multi-parameter type class woes

2008-12-15 Thread Mario Blažević
I think that http://www.haskell.org/pipermail/haskell-cafe/2008-April/041461.html may be relevant. It's a design decision. Thanks for the link. I've read through the thread, but rather than try to figure out if it's the same issue and whether it's a design decision or a historical

[Haskell-cafe] Multi-parameter type class woes

2008-12-14 Thread Mario Blažević
I have, for a change, a relatively simple problem with type classes. Can somebody explain to me, or point me to an explanation of the behaviour I see? Here is a short and useless example: {-# LANGUAGE MultiParamTypeClasses, FlexibleInstances #-} import Data.Maybe class Container x y

Re: Re: [Haskell-cafe] Multi-parameter type class woes

2008-12-14 Thread Mario Blažević
I'll take a swing at this one: instance Container (Maybe x) [x] where wrapper = isNothing . . . That isn't a sensible definition of 'wrapper', but I believe without trying to compile it is completely legal. Which wrapper do you use? You /don't/ have a different matching Container

[Haskell-cafe] (no subject)

2008-09-06 Thread Mario Blažević
Hello. I'm trying to apply the nested regions (as in Lightweight Monadic Regions by Oleg Kiselyov and Chung-chieh Shan) design pattern, if that's the proper term. I was hoping to gain a bit more type safety in this little library I'm working on -- Streaming Component Combinators, available on

[Haskell-cafe] A problem with nested regions and higher-order functions

2008-09-06 Thread Mario Blažević
I forgot the subject, sorry for reposting... I'm trying to apply the nested regions (as in Lightweight Monadic Regions by Oleg Kiselyov and Chung-chieh Shan) design pattern, if that's the proper term, in hope to gain a bit more type safety in this little library I'm working on (Streaming

[Haskell-cafe] Control.Concurrent.forkIO versus Control.Parallel.par

2008-07-27 Thread Mario Blažević
Hello. I have a question about parallel computation in Haskell. After browsing the GHC library documentation, I was left with impression that there are two separate mechanisms for expressing concurrency: Control.Parallel.par for pure computations and Control.Concurrent.forkIO for