Re: [Haskell-cafe] plugins fails on a simple example

2013-09-17 Thread Petr Pudlák
the ground up On Mon, Sep 16, 2013 at 2:49 AM, Petr Pudlák petr@gmail.com mailto:petr@gmail.com wrote: Hi, I'm playing with “plugins”, trying to evaluate a simple expression: |import Control.Monad import System.Eval.Haskell main =do let fExpr =1 + 2 :: Int

[Haskell-cafe] plugins fails on a simple example

2013-09-16 Thread Petr Pudlák
Hi, I'm playing with plugins, trying to evaluate a simple expression: |import Control.Monad import System.Eval.Haskell main =do let fExpr =1 + 2 :: Int r - eval_ fExpr [Prelude] [] [] [] ::IO (Either [String] (Maybe Int)) case rof Right (Just f) -do

Re: [Haskell-cafe] a little parsec enhancement

2013-09-09 Thread Petr Pudlák
alias for the new 'ParsecT' constructor from 3.1.x. On Fri, Sep 6, 2013 at 2:21 PM, Petr Pudlák petr@gmail.com mailto:petr@gmail.com wrote: Dne 09/05/2013 01:38 PM, Roman Cheplyaka napsal(a): * Petr Pudlák petr@gmail.com mailto:petr@gmail.com [2013-09-05 11

Re: [Haskell-cafe] a little parsec enhancement

2013-09-06 Thread Petr Pudlák
Dne 09/05/2013 01:38 PM, Roman Cheplyaka napsal(a): * Petr Pudlák petr@gmail.com [2013-09-05 11:18:25+0200] Unfortunately |ParsecT| constructor isn't exported so I'm not able to implement it outside /parsec/. No, but there's an 'mkPT' function which is equivalent to the ParsecT constructor

[Haskell-cafe] a little parsec enhancement

2013-09-05 Thread Petr Pudlák
Hi, when thinking about this SO question http://stackoverflow.com/q/18583416/1333025, I couldn't find a combinator that allows a parser to /optionally/ fail without consuming input, or consume input and return its value. So I'm suggesting such a function: |-- | @emptyIf p@ parses @p@ and

Re: [Haskell-cafe] Performance of delete-and-return-last-element

2013-09-05 Thread Petr Pudlák
Dne 09/01/2013 09:13 PM, Harald Bögeholz napsal(a): Am 31.08.13 14:35, schrieb Petr Pudlák: One solution would be to fold over a specific semigroup instead of a recursive function: |import Data.Semigroup import Data.Foldable(foldMap) import Data.Maybe(maybeToList) data Darle a =Darle

Re: [Haskell-cafe] Performance of delete-and-return-last-element

2013-08-31 Thread Petr Pudlák
One solution would be to fold over a specific semigroup instead of a recursive function: |import Data.Semigroup import Data.Foldable(foldMap) import Data.Maybe(maybeToList) data Darle a =Darle {getInit :: [a],getLast ::a } deriving Show instance Semigroup (Darle a)where

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

2013-08-22 Thread Petr Pudlák
Or, if there are no such definitions, where would be a good place to add them? Petr Dne 08/20/2013 06:55 PM, Petr Pudlák napsal(a): Dear Haskellers, are these monoids defined somewhere? |import Control.Applicative import Data.Monoid newtype AppMonoid m a =AppMonoid (m a) instance

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

2013-08-20 Thread Petr Pudlák
Dear Haskellers, are these monoids defined somewhere? import Control.Applicativeimport Data.Monoid newtype AppMonoid m a = AppMonoid (m a)instance (Monoid a, Applicative m) = Monoid (AppMonoid m a) where mempty = AppMonoid $ pure mempty mappend (AppMonoid x) (AppMonoid y) = AppMonoid $

[Haskell-cafe] using network+conduit+tls for a client application?

2013-07-29 Thread Petr Pudlák
Dear Haskellers, I wanted to write a small TLS application (connecting to IMAP over TLS) and it seemed natural to use conduit for that. I found the network-conduit-tls package, but then I realized it's meant only for server applications. Is there something similar for client applications?

[Haskell-cafe] Why isn't ArrowChoice a parent of of ArrowApply?

2013-06-20 Thread Petr Pudlák
In Control.Arrow we have: |leftApp ::ArrowApply a = a b c - a (Either b d) (Either c d)| Any instance of |ArrowApply| can be made into an instance of |ArrowChoice| by defining |left = leftApp|. So why isn't |ArrowChoice| a parent of |ArrowApply|? Best regards, Petr

Re: [Haskell-cafe] mapFst and mapSnd

2013-05-28 Thread Petr Pudlák
Dne 28.5.2013 10:54, Dominique Devriese napsal(a): Hi all, I often find myself needing the following definitions: mapPair :: (a - b) - (c - d) - (a,c) - (b,d) mapPair f g (x,y) = (f x, g y) mapFst :: (a - b) - (a,c) - (b,c) mapFst f = mapPair f id mapSnd :: (b - c) - (a,b) -

Re: [Haskell-cafe] Generalizing unionWithKey, unionWith, ...

2013-05-28 Thread Petr Pudlák
Dne 28.5.2013 12:32, Johannes Waldmann napsal(a): Jose A. Lopes jose.lopes at ist.utl.pt writes: unionWith :: Ord k = (a - b - c) - Map k a - Map k b - Map k c what should be the result of unionWith undefined (M.singleton False 42) (M.singleton True bar) ? Perhaps the generalized

Re: [Haskell-cafe] Set monad

2013-05-13 Thread Petr Pudlák
On 04/12/2013 12:49 PM, o...@okmij.org wrote: One problem with such monad implementations is efficiency. Let's define step :: (MonadPlus m) = Int - m Int step i = choose [i, i + 1] -- repeated application of step on 0: stepN :: (Monad m) = Int - m (S.Set Int) stepN

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

2013-05-07 Thread Petr Pudlák
Some further ideas: - Make the periodic maintainership reminders optional. Every developer would be able to choose if (s)he wishes to receive them or not. I believe many would choose to receive them. - Maintain the last date the maintainership has been verified - either by an upload of a new

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

2013-05-06 Thread Petr Pudlák
2013/5/6 Tillmann Rendel ren...@informatik.uni-marburg.de Petr Pudlák wrote: -- Forwarded message -- From: *Niklas Hambüchen* m...@nh2.me mailto:m...@nh2.me Date: 2013/5/4 ... I would even be happy with newhackage sending every package maintainer

[Haskell-cafe] Hackage checking maintainership of packages

2013-05-05 Thread Petr Pudlák
Hi, on another thread there was a suggestion which perhaps went unnoticed by most: -- Forwarded message -- From: Niklas Hambüchen m...@nh2.me Date: 2013/5/4 ... I would even be happy with newhackage sending every package maintainer a quarterly question Would you still call

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

2013-05-05 Thread Petr Pudlák
Doug Burke dburke...@gmail.com On May 5, 2013 7:25 AM, Petr Pudlák petr@gmail.com wrote: Hi, on another thread there was a suggestion which perhaps went unnoticed by most: -- Forwarded message -- From: Niklas Hambüchen m...@nh2.me Date: 2013/5/4 ... I

Re: [Haskell-cafe] Markdown extension for Haddock as a GSoC project

2013-05-02 Thread Petr Pudlák
Hi, It seems that during the recent suggestions about what markup to choose (Markdown, Creole, Asciidoc, etc.), we've forgotten about one of the goals that seem very important to me for Haskell: the ability to write *math formulas*. I have experienced on StackExchange that just adding MathJAX to

Re: [Haskell-cafe] Diving into the records swamp (possible GSoC project)

2013-04-26 Thread Petr Pudlák
Hi Adam, very nice idea. As the others, I'm curious why you chose to implement SORF in favor of the other ideas? I just read the SORF proposal, and I'm a bit concerned about what error messages would GHC issue when someone would type incorrect code involving such records. Currently Haskell's

Re: [Haskell-cafe] Monad Transformer Space Leak

2013-04-23 Thread Petr Pudlák
I tested it on GHC 6.12.1, which wasn't affected by the recent ackermann bug, but still it leaks memory. Petr Pudlak 2013/4/22 Clark Gaebel cgae...@uwaterloo.ca I don't have a copy of GHC HEAD handy, and don't have the time to set up the ecosystem myself to test this one bug. Would someone

[Haskell-cafe] a library for abstract algebra?

2013-04-18 Thread Petr Pudlák
Hi, is there a Haskell library for defining and working with algebraic structures such as groups, rings, fields, finite fields, vector spaces or modules? I found only several vector-related libraries, but they were all only over the field of real numbers (Double) and defined only vector spaces,

Re: [Haskell-cafe] ANN: rematch, an library for composable assertions with human readable failure messages

2013-04-16 Thread Petr Pudlák
Hi tom, I had problems installing version 0.1.2.1 on GHC 7.4.1: Resolving dependencies... Downloading rematch-0.1.2.1... Configuring rematch-0.1.2.1... Building rematch-0.1.2.1... Preprocessing library rematch-0.1.2.1... [1 of 4] Compiling Control.Rematch.Formatting (

Re: [Haskell-cafe] ANN: rematch, an library for composable assertions with human readable failure messages

2013-04-16 Thread Petr Pudlák
2013/4/16 Ross Paterson r.pater...@city.ac.uk On Tue, Apr 16, 2013 at 10:17:48AM +0100, Tom Crayford wrote: The core API is very simple: data Matcher a = Matcher { match :: a - Bool -- ^ A function that returns True if the matcher should pass, False if it should fail ,

Re: [Haskell-cafe] Set monad

2013-04-11 Thread Petr Pudlák
One problem with such monad implementations is efficiency. Let's define step :: (MonadPlus m) = Int - m Int step i = choose [i, i + 1] -- repeated application of step on 0: stepN :: (Monad m) = Int - m (S.Set Int) stepN = runSet . f where f 0 = return 0

Re: [Haskell-cafe] GSoC Project Proposal: Markdown support for Haddock

2013-04-05 Thread Petr Pudlák
Hi, I also support the idea of having Markdown for Haddock. Using some well established markup language would make Haddock much easier to adopt and use. While I like the idea of allowing any markup language (let's say supported by Pandoc) and freedom it gives to developers, it also has also

Re: [Haskell-cafe] Need some advice around lazy IO

2013-03-17 Thread Petr Pudlák
Hi Kashyap, you could also use iteratees or conduits for a task like that. The beauty of such libraries is that they can ensure that a resource is always properly disposed of. See this simple example: https://gist.github.com/anonymous/5183107 It prints the first line of each file given as an

[Haskell-cafe] Are there any reasons against using ~ when matching one-constructor data types?

2013-03-13 Thread Petr Pudlák
Dear Haskellers, b) A related suggestion would be the addition of an irrefutable swap, (swap'?), defined as swap ~(a,b) = (b,a), and its addition to Prelude for the same reasons. If I define a function that matches on a single-constructor data type, such as (,), is

Re: [Haskell-cafe] RFC: rewrite-with-location proposal

2013-02-25 Thread Petr Pudlák
2013/2/25 Michael Snoyman mich...@snoyman.com At that point, we've now made two changes to REWRITE rules: 1. They can takes a new ALWAYS parameters. 2. There's a new, special identifier currentLocation available. What would be the advantage is of that approach versus introducing a single

[Haskell-cafe] generalized, tail-recursive left fold that can finish tne computation prematurely

2013-02-18 Thread Petr Pudlák
Dear Haskellers, while playing with folds and trying to implement `!!` by folding, I came to the conclusion that: - `foldr` is unsuitable because it counts the elements from the end, while `!!` needs counting from the start (and it's not tail recursive). - `foldl` is also unsuitable, because it

[Haskell-cafe] generalized, tail-recursive left fold that can finish tne computation prematurely

2013-02-18 Thread Petr Pudlák
Dear Haskellers, while playing with folds and trying to implement `!!` by folding, I came to the conclusion that: - `foldr` is unsuitable because it counts the elements from the end, while `!!` needs counting from the start (and it's not tail recursive). - `foldl` is also unsuitable, because it

Re: [Haskell-cafe] generalized, tail-recursive left fold that can finish tne computation prematurely

2013-02-18 Thread Petr Pudlák
Thanks Roman and Andres for the tip. I knew the trick with accumulating a function, but I had never imagined it could work so efficiently. I thought the problem with using foldr would be that the function would be neither tail recursive nor efficient and so I hadn't even tried. Apparently that was

Re: [Haskell-cafe] arrow notation

2013-02-12 Thread Petr Pudlák
2013/2/11 Ertugrul Söylemez e...@ertes.de Petr Pudlák petr@gmail.com wrote: class Arrow a = ArrowDelay a where delay :: a b c - a () (b - c) force :: Arrow a = a () (b - c) - a b c Perhaps it would be convenient to have ArrowDelay and the corresponding

Re: [Haskell-cafe] arrow notation

2013-02-11 Thread Petr Pudlák
2013/2/11 Ertugrul Söylemez e...@ertes.de ... ## Applicative One of the main bottlenecks of arrows is the heavy tuple handling, but most (if not all) arrows form a family of applicative functors. I noticed a huge speedup by moving from arrow style to applicative style where possible:

Re: [Haskell-cafe] arrow notation

2013-02-10 Thread Petr Pudlák
2013/2/9 Conal Elliott co...@conal.net On Thu, Feb 7, 2013 at 5:41 PM, Ross Paterson r...@soi.city.ac.uk wrote: It's hard to imagine arrow notation without arr (or at least contravariance in the first argument of the arrow) because forming expressions using the local environment is so

[Haskell-cafe] Control.Monad provisional?

2013-02-10 Thread Petr Pudlák
Dear Haskellers, Looking at Control.Monad: http://hackage.haskell.org/packages/archive/base/4.6.0.0/doc/html/Control-Monad.html I see: Stability provisional. I checked some older versions and it's the same. This feel somewhat unsettling - if Control.Monad is provisional, do we have any stable

[Haskell-cafe] A list of Haskell-related quotes?

2013-02-06 Thread Petr Pudlák
Dear haskellers, over the time I've read many funny or inspiring quotes related to Haskell, but I forgot them later. For example I vaguely remember: - What I really like about Haskell: It's completely unlike PHP. - To learn Haskell your brain will have to get seriously rewired. Does anybody