[Haskell-cafe] Either Monad and Laziness

2012-09-12 Thread oleg

 I am currently trying to rewrite the Graphics.Pgm library from hackage
 to parse the PGM to a lazy array. 

Laziness and IO really do not mix. 

 The problem is that even using a lazy array structure, because the
 parser returns an Either structure it is only possible to know if the
 parser was successful or not after the whole file is read, 

That is one of the problems. Unexpected memory blowups could be
another problem. The drawbacks of lazy IO are well documented by now.

 The behaviour I want to achieve is like this: I want the program when
 compiled to read from a file, parsing the PGM and at the same time
 apply transformations to the entries as they are read and write them
 back to another PGM file.

Such problems are the main motivation for iteratees, conduits, pipes,
etc. Every such library contains procedures for doing exactly what you
want. Please check Hackage. John Lato's iteratee library, for example,
has procedure for handling sound (AIFF) files -- which may be very
big. IterateeM has the TIFF decoder -- which is incremental and
strict. TIFF is much harder to parse than PGM.



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


[Haskell-cafe] IO vs MonadIO

2012-09-12 Thread Sergey Mironov
Hi. Just a brief question. System.IO functions are defined in IO monad
and have signatures like Foo - IO Bar.
Would it be better to have all of them defined as (MonadIO m) = Foo
- m Bar? What are the problems that would arise?

Sergey

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


Re: [Haskell-cafe] IO vs MonadIO

2012-09-12 Thread Ivan Lazar Miljenovic
On 12 September 2012 18:24, Sergey Mironov ier...@gmail.com wrote:
 Hi. Just a brief question. System.IO functions are defined in IO monad
 and have signatures like Foo - IO Bar.
 Would it be better to have all of them defined as (MonadIO m) = Foo
 - m Bar? What are the problems that would arise?

That would require MonadIO being defined in base, and might make some
existing code fail due to lack of type signatures (though I suppose
you could specify a default).

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
http://IvanMiljenovic.wordpress.com

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


Re: [Haskell-cafe] IO vs MonadIO

2012-09-12 Thread Ivan Lazar Miljenovic
On 12 September 2012 19:55, Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com wrote:
 On 12 September 2012 18:24, Sergey Mironov ier...@gmail.com wrote:
 Hi. Just a brief question. System.IO functions are defined in IO monad
 and have signatures like Foo - IO Bar.
 Would it be better to have all of them defined as (MonadIO m) = Foo
 - m Bar? What are the problems that would arise?

 That would require MonadIO being defined in base, and might make some
 existing code fail due to lack of type signatures (though I suppose
 you could specify a default).

Oh, and you'd still need to define them all somewhere to work _for_ IO
so you can then have the liftIO variants anyway.


 --
 Ivan Lazar Miljenovic
 ivan.miljeno...@gmail.com
 http://IvanMiljenovic.wordpress.com



-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
http://IvanMiljenovic.wordpress.com

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


Re: [Haskell-cafe] type variable in class instance

2012-09-12 Thread Corentin Dupont
If I understand, the SomeEvent event acts as a proxy to hide the diversity
of the events? That's interesting.
This way I don't have to use an heterogeneous list and a lot of casting...

On Wed, Sep 12, 2012 at 7:44 AM, o...@okmij.org wrote:


 Let me see if I understand. You have events of different sorts: events
 about players, events about timeouts, events about various
 messages. Associated with each sort of event is a (potentially open)
 set of data types: messages can carry payload of various types. A
 handler specifies behavior of a system upon the reception of an
 event. A game entity (player, monster, etc) is a collection of
 behaviors. The typing problem is building the heterogeneous collection
 of behaviors and routing an event to the appropriate handler. Is this
 right?

 There seem to be two main implementations, with explicit types and latent
 (dynamic) types. The explicit-type representation is essentially HList
 (a Type-indexed Record, TIR, to be precise). Let's start with the
 latent-type representation. Now I understand your problem better, I
 think your original approach was the right one. GADT was a
 distraction, sorry. Hopefully you find the code below better reflects
 your intentions.

 {-# LANGUAGE ExistentialQuantification, DeriveDataTypeable #-}
 {-# LANGUAGE StandaloneDeriving #-}

 import Data.Typeable

 -- Events sorts

 data Player = Player PlayerN PlayerStatus
 deriving (Eq, Show, Typeable)

 type PlayerN = Int
 data PlayerStatus = Enetering | Leaving
 deriving (Eq, Show)

 newtype Message m = Message m
 deriving (Eq, Show)

 deriving instance Typeable1 Message

 newtype Time = Time Int
 deriving (Eq, Show, Typeable)

 data SomeEvent = forall e. Typeable e = SomeEvent e
 deriving (Typeable)

 -- They are all events

 class Typeable e = Event e where   -- the Event
 predicate
   what_event :: SomeEvent - Maybe e
   what_event (SomeEvent e) = cast e


 instance Event Player
 instance Event Time
 instance Typeable m = Event (Message m)

 instance Event SomeEvent where
   what_event = Just

 -- A handler is a reaction on an event
 -- Given an event, a handler may decline to handle it
 type Handler e = e - Maybe (IO ())

 inj_handler :: Event e = Handler e - Handler SomeEvent
 inj_handler h se | Just e - what_event se = h e
 inj_handler _ _ = Nothing


 type Handlers = [Handler SomeEvent]

 trigger :: Event e = e - Handlers - IO ()
 trigger e [] = fail Not handled
 trigger e (h:rest)
   | Just rh - h (SomeEvent e) = rh
   | otherwise  = trigger e rest

 -- Sample behaviors

 -- viewing behavior (although viewing is better with Show since all
 -- particular events implement it anyway)

 view_player :: Handler Player
 view_player (Player x s) = Just . putStrLn . unwords $
   [Player, show x, show s]

 -- View a particular message
 view_msg_str :: Handler (Message String)
 view_msg_str (Message s) = Just . putStrLn . unwords $
  [Message, s]

 -- View any message
 view_msg_any :: Handler SomeEvent
 view_msg_any (SomeEvent e)
   | (tc1,[tr]) - splitTyConApp (typeOf e),
 (tc2,_)- splitTyConApp (typeOf (undefined::Message ())),
 tc1 == tc2 =
 Just . putStrLn . unwords $ [Some message of the type, show tr]
 view_msg_any _ = Nothing

 viewers = [inj_handler view_player, inj_handler view_msg_str, view_msg_any]


 test1 = trigger (Player 1 Leaving) viewers
 -- Player 1 Leaving

 test2 = trigger (Message str1) viewers
 -- Message str1

 test3 = trigger (Message (2::Int)) viewers
 -- Some message of the type Int



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


[Haskell-cafe] [ANN] Cumino 0.2 - Now supports pretty indentation through stylish-haskell

2012-09-12 Thread Alfredo Di Napoli
Hi everyone,

in case you have missed it, I've released a Vim plugin called Cumino:

http://adinapoli.github.com/cumino/

It does one simple thing: It allows communication between Vim and tmux, in
particular to a ghci session. With Cumino you can fire-up Vim,
load a ghci session and interact with it with only few keystrokes. The
plugin also supports visual selection: you can select for example a
function (even with all its signature!)
and you can send it to ghci. The visual selection supports imports, custom
types and typeclasses.

It's a simple idea but so damn useful, imho.

This release also adds the possibility to prettify the code using the
excellent stylish-haskell: select a snippet, simply indent in the usual way
( = ) and voilà, now
your code is indented!

Feedback are highly appreciated, as well as contributions.
There are still some issues with some terminals (for example urxvt does not
work right now) but the plugin has been tested against gnome-terminal,
xterm and mlterm.

I'll post in reddit too for completeness!

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


Re: [Haskell-cafe] [ANN] Cumino 0.2 - Now supports pretty indentation through stylish-haskell

2012-09-12 Thread Matvey Aksenov

Are urxvt-related issues documented somewhere?

On 09/12/2012 05:03 PM, Alfredo Di Napoli wrote:
There are still some issues with some terminals (for example urxvt 
does not work right now) 


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


[Haskell-cafe] guards in applicative style

2012-09-12 Thread felipe zapata
Hi Haskellers,

Suppose I have two list and I want to calculate
the cartesian product between the two of them,
constrained to a predicate.
In List comprehension notation is just

result = [ (x, y) | x - list1, y -list2, somePredicate x y ]

or in monadic notation

result = do
 x - list1
 y - list2
 guard (somePredicate x y)
return $ (x,y)

Then I was wondering if we can do something similar using an applicative
style

result = (,) $ list1 * list2 (somePredicate ???)

The question is then,
there is a way for defining a guard in applicative Style?

Thanks in advance,

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


Re: [Haskell-cafe] Either Monad and Laziness

2012-09-12 Thread Eric Velten de Melo
Thanks for all the tips! The iteratees seem worth checking out. I'll
see what I can do and will report back if I come up with something.

Eric

On 12 September 2012 03:03,  o...@okmij.org wrote:

 I am currently trying to rewrite the Graphics.Pgm library from hackage
 to parse the PGM to a lazy array.

 Laziness and IO really do not mix.

 The problem is that even using a lazy array structure, because the
 parser returns an Either structure it is only possible to know if the
 parser was successful or not after the whole file is read,

 That is one of the problems. Unexpected memory blowups could be
 another problem. The drawbacks of lazy IO are well documented by now.

 The behaviour I want to achieve is like this: I want the program when
 compiled to read from a file, parsing the PGM and at the same time
 apply transformations to the entries as they are read and write them
 back to another PGM file.

 Such problems are the main motivation for iteratees, conduits, pipes,
 etc. Every such library contains procedures for doing exactly what you
 want. Please check Hackage. John Lato's iteratee library, for example,
 has procedure for handling sound (AIFF) files -- which may be very
 big. IterateeM has the TIFF decoder -- which is incremental and
 strict. TIFF is much harder to parse than PGM.



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


Re: [Haskell-cafe] guards in applicative style

2012-09-12 Thread Lorenzo Bolla
I'm no expert at all, but I would say no.
guard type is:
guard :: MonadPlus m = Bool - m ()

and MonadPlus is a monad plus (ehm...) mzero and mplus
(http://en.wikibooks.org/wiki/Haskell/MonadPlus).
On the other hand Applicative is less than a monad
(http://www.haskell.org/haskellwiki/Applicative_functor), therefore
guard as is cannot be defined.

But, in your specific example, with lists, you can always use filter:
filter (uncurry somePredicate) ((,) $ list1 * list2 (somePredicate ???))

hth,
L.


On Wed, Sep 12, 2012 at 3:40 PM, felipe zapata tifonza...@gmail.com wrote:

 Hi Haskellers,

 Suppose I have two list and I want to calculate
 the cartesian product between the two of them,
 constrained to a predicate.
 In List comprehension notation is just

 result = [ (x, y) | x - list1, y -list2, somePredicate x y ]

 or in monadic notation

 result = do
  x - list1
  y - list2
  guard (somePredicate x y)
 return $ (x,y)

 Then I was wondering if we can do something similar using an applicative style

 result = (,) $ list1 * list2 (somePredicate ???)

 The question is then,
 there is a way for defining a guard in applicative Style?

 Thanks in advance,

 Felipe Zapata.



 ___
 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] Either Monad and Laziness

2012-09-12 Thread Eric Velten de Melo
On 12 September 2012 11:46, Eric Velten de Melo ericvm...@gmail.com wrote:
 Thanks for all the tips! The iteratees seem worth checking out. I'll
 see what I can do and will report back if I come up with something.

 Eric

 On 12 September 2012 03:03,  o...@okmij.org wrote:

 I am currently trying to rewrite the Graphics.Pgm library from hackage
 to parse the PGM to a lazy array.

 Laziness and IO really do not mix.

 The problem is that even using a lazy array structure, because the
 parser returns an Either structure it is only possible to know if the
 parser was successful or not after the whole file is read,

 That is one of the problems. Unexpected memory blowups could be
 another problem. The drawbacks of lazy IO are well documented by now.

 The behaviour I want to achieve is like this: I want the program when
 compiled to read from a file, parsing the PGM and at the same time
 apply transformations to the entries as they are read and write them
 back to another PGM file.

 Such problems are the main motivation for iteratees, conduits, pipes,
 etc. Every such library contains procedures for doing exactly what you
 want. Please check Hackage. John Lato's iteratee library, for example,
 has procedure for handling sound (AIFF) files -- which may be very
 big. IterateeM has the TIFF decoder -- which is incremental and
 strict. TIFF is much harder to parse than PGM.


It would be really awesome, though, if it were possible to use a
parser written in Parsec with this, in the spirit of avoiding code
rewriting and enhancing expressivity and abstraction.

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


Re: [Haskell-cafe] [ANN] Cumino 0.2 - Now supports pretty indentation through stylish-haskell

2012-09-12 Thread Roman Cheplyaka
So, suppose that I'm in a terminal vim session, and I want to start ghci
(in the current terminal). What do I do?

localleadercc starts a new terminal, which is not what I want.

On Wed, Sep 12, 2012 at 3:03 PM, Alfredo Di Napoli 
alfredo.dinap...@gmail.com wrote:

 Hi everyone,

 in case you have missed it, I've released a Vim plugin called Cumino:

 http://adinapoli.github.com/cumino/

 It does one simple thing: It allows communication between Vim and tmux, in
 particular to a ghci session. With Cumino you can fire-up Vim,
 load a ghci session and interact with it with only few keystrokes. The
 plugin also supports visual selection: you can select for example a
 function (even with all its signature!)
 and you can send it to ghci. The visual selection supports imports, custom
 types and typeclasses.

 It's a simple idea but so damn useful, imho.

 This release also adds the possibility to prettify the code using the
 excellent stylish-haskell: select a snippet, simply indent in the usual way
 ( = ) and voilà, now
 your code is indented!

 Feedback are highly appreciated, as well as contributions.
 There are still some issues with some terminals (for example urxvt does
 not work right now) but the plugin has been tested against gnome-terminal,
 xterm and mlterm.

 I'll post in reddit too for completeness!

 Bye!
 Alfredo

 ___
 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] Cumino 0.2 - Now supports pretty indentation through stylish-haskell

2012-09-12 Thread Alfredo Di Napoli
Hi, 

I'm not in front of the pc now, but afair the problem was related to opening a 
new urxvt window FROM a running urxvt. 
More details soon :)

Sent from my iPad

On 12/set/2012, at 15:18, Matvey Aksenov matvey.akse...@gmail.com wrote:

 Are urxvt-related issues documented somewhere?
 
 On 09/12/2012 05:03 PM, Alfredo Di Napoli wrote:
 There are still some issues with some terminals (for example urxvt does not 
 work right now) 

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


Re: [Haskell-cafe] [ANN] Cumino 0.2 - Now supports pretty indentation through stylish-haskell

2012-09-12 Thread Alfredo Di Napoli
Could you please tell me what your desired behaviour would be?
In praticular, do you want a ghci session in another tab or in a tmux pane 
perhaps?
Otherwise I can't see any viable way to let vim and ghci cooperate inside the 
SAME window.

Bye,
Alfredo

Sent from my iPad

On 12/set/2012, at 17:05, Roman Cheplyaka r...@ro-che.info wrote:

 So, suppose that I'm in a terminal vim session, and I want to start ghci (in 
 the current terminal). What do I do?
 
 localleadercc starts a new terminal, which is not what I want.
 
 On Wed, Sep 12, 2012 at 3:03 PM, Alfredo Di Napoli 
 alfredo.dinap...@gmail.com wrote:
 Hi everyone,
 
 in case you have missed it, I've released a Vim plugin called Cumino:
 
 http://adinapoli.github.com/cumino/
 
 It does one simple thing: It allows communication between Vim and tmux, in 
 particular to a ghci session. With Cumino you can fire-up Vim,
 load a ghci session and interact with it with only few keystrokes. The plugin 
 also supports visual selection: you can select for example a function (even 
 with all its signature!)
 and you can send it to ghci. The visual selection supports imports, custom 
 types and typeclasses.
 
 It's a simple idea but so damn useful, imho. 
 
 This release also adds the possibility to prettify the code using the 
 excellent stylish-haskell: select a snippet, simply indent in the usual way ( 
 = ) and voilà, now
 your code is indented!
 
 Feedback are highly appreciated, as well as contributions.
 There are still some issues with some terminals (for example urxvt does not 
 work right now) but the plugin has been tested against gnome-terminal, xterm 
 and mlterm.
 
 I'll post in reddit too for completeness!
 
 Bye!
 Alfredo
 
 ___
 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] Either Monad and Laziness

2012-09-12 Thread Francesco Mazzoli
At Wed, 12 Sep 2012 12:04:31 -0300,
Eric Velten de Melo wrote:
 It would be really awesome, though, if it were possible to use a
 parser written in Parsec with this, in the spirit of avoiding code
 rewriting and enhancing expressivity and abstraction.

There is http://hackage.haskell.org/package/attoparsec-conduit and
http://hackage.haskell.org/package/attoparsec-enumerator, which turn
attoparsec parsers into enumerators/conduits, and
http://hackage.haskell.org/package/attoparsec-parsec, which is a compatibility
layer between attoaparsec and parsec.  Good luck :).

--
Francesco * Often in error, never in doubt

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


Re: [Haskell-cafe] [ANN] Cumino 0.2 - Now supports pretty indentation through stylish-haskell

2012-09-12 Thread Brandon Allbery
On Wed, Sep 12, 2012 at 11:25 AM, Alfredo Di Napoli 
alfredo.dinap...@gmail.com wrote:

 I'm not in front of the pc now, but afair the problem was related to
 opening a new urxvt window FROM a running urxvt.
 More details soon :)


urxvt defaults to using a client-server model for all terminals, IIRC (we
have a warning about it in the xmonad documentation as well since it messes
up ManageHooks).  There's possibly some option to disable this and force an
independent terminal.

-- 
brandon s allbery  allber...@gmail.com
wandering unix systems administrator (available) (412) 475-9364 vm/sms
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] [ANN] Cumino 0.2 - Now supports pretty indentation through stylish-haskell

2012-09-12 Thread Alfredo Di Napoli
If such a possibility exists,
I would be happy to fix the urxvt support :)
Bear in mind, though, that the Cumino terminal is only needed for the Ghci
session, so you can use your favourite terminal to run Vim :)

A.


 urxvt defaults to using a client-server model for all terminals, IIRC (we
 have a warning about it in the xmonad documentation as well since it messes
 up ManageHooks).  There's possibly some option to disable this and force an
 independent terminal.
 
 -- 
 brandon s allbery  allber...@gmail.com
 wandering unix systems administrator (available) (412) 475-9364 vm/sms

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


Re: [Haskell-cafe] Invitation to connect on LinkedIn

2012-09-12 Thread damodar kulkarni
Hi,
Correct me if I am wrong, but by looking at the way the message is created,
I think, LinkedIn is acting a kind of spammer these days. Shall we lodge
protest against it as a community?
As an aside, can we not automatically delete all messages to haskell
mailing-lists whose from field contains LinkedIn (and the likes of it)
in it?

-Damodar

On Wed, Sep 12, 2012 at 9:12 PM, Sakari Joinen via LinkedIn 
mem...@linkedin.com wrote:


[image: LinkedIn Logo] http://www.linkedin.com/



   Steve,

Sakari Joinen wants to connect with you on LinkedIn.

  Sakari Joinen
  Senior QA Engineer at Rocketpack  View Profile 
 »http://www.linkedin.com/e/uc6lxc-h70llpqy-2x/rso/203924390/GIO8/name/2590796_I425561150_15/eml-comm_invm-b-pro_txt-inv28/?hs=falsetok=0etVV1LByeHlo1

   
 Accepthttp://www.linkedin.com/e/uc6lxc-h70llpqy-2x/XvIdBwmueHfd6vFMPXXdLaqreCbl5oOSpPTFPU/blk/I425561150_15/0UcDpKqiRzolZKqiRybmRSrCBvrmRLoORIrmkZt5YCpnlOt3RApnhMpmdzgmhxrSNBszYRclYMdj4NdzkRczh9bThqd3kOp5tMbP0TdjgMd3wNdzwLrCBxbOYWrSlI/eml-comm_invm-b-in_ac-inv28/?hs=falsetok=0SXF1g5wqeHlo1



  You are receiving Invitation emails. 
 Unsubscribehttps://www.linkedin.com/e/uc6lxc-h70llpqy-2x/XvIdBwmueHfd6vFMPXXdLaqreCbl5oOSpPTFPU/prv/?hs=falsetok=1cq1jVz5SeHlo1.


 This email was intended for Steve Severance (Principal at Alpha Heavy
 Industries). Learn why we included 
 thishttp://www.linkedin.com/e/uc6lxc-h70llpqy-2x/plh/http%3A%2F%2Fhelp%2Elinkedin%2Ecom%2Fapp%2Fanswers%2Fdetail%2Fa_id%2F4788/-GXI/?hs=falsetok=38T1PPvOmeHlo1.
 © 2012, LinkedIn Corporation. 2029 Stierlin Ct. Mountain View, CA 94043,
 USA


 ___
 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] Invitation to connect on LinkedIn

2012-09-12 Thread Kristopher Micinski
I believe these are the effect of linkedin harvesting your email contacts,
and then a blanket invite all link that you can click.  Whether it's
linkedin who's spamming, or the person who forgot to uncheck certain
mailing lists, that's more of a moral debate..

kris

On Wed, Sep 12, 2012 at 2:21 PM, damodar kulkarni kdamodar2...@gmail.comwrote:

 Hi,
 Correct me if I am wrong, but by looking at the way the message is
 created, I think, LinkedIn is acting a kind of spammer these days. Shall we
 lodge protest against it as a community?
 As an aside, can we not automatically delete all messages to haskell
 mailing-lists whose from field contains LinkedIn (and the likes of it)
 in it?

 -Damodar

 On Wed, Sep 12, 2012 at 9:12 PM, Sakari Joinen via LinkedIn 
 mem...@linkedin.com wrote:


[image: LinkedIn Logo] http://www.linkedin.com/



   Steve,

Sakari Joinen wants to connect with you on LinkedIn.

  Sakari Joinen
  Senior QA Engineer at Rocketpack  View Profile 
 »http://www.linkedin.com/e/uc6lxc-h70llpqy-2x/rso/203924390/GIO8/name/2590796_I425561150_15/eml-comm_invm-b-pro_txt-inv28/?hs=falsetok=0etVV1LByeHlo1

   
 Accepthttp://www.linkedin.com/e/uc6lxc-h70llpqy-2x/XvIdBwmueHfd6vFMPXXdLaqreCbl5oOSpPTFPU/blk/I425561150_15/0UcDpKqiRzolZKqiRybmRSrCBvrmRLoORIrmkZt5YCpnlOt3RApnhMpmdzgmhxrSNBszYRclYMdj4NdzkRczh9bThqd3kOp5tMbP0TdjgMd3wNdzwLrCBxbOYWrSlI/eml-comm_invm-b-in_ac-inv28/?hs=falsetok=0SXF1g5wqeHlo1



  You are receiving Invitation emails. 
 Unsubscribehttps://www.linkedin.com/e/uc6lxc-h70llpqy-2x/XvIdBwmueHfd6vFMPXXdLaqreCbl5oOSpPTFPU/prv/?hs=falsetok=1cq1jVz5SeHlo1.


 This email was intended for Steve Severance (Principal at Alpha Heavy
 Industries). Learn why we included 
 thishttp://www.linkedin.com/e/uc6lxc-h70llpqy-2x/plh/http%3A%2F%2Fhelp%2Elinkedin%2Ecom%2Fapp%2Fanswers%2Fdetail%2Fa_id%2F4788/-GXI/?hs=falsetok=38T1PPvOmeHlo1.
 © 2012, LinkedIn Corporation. 2029 Stierlin Ct. Mountain View, CA 94043,
 USA


 ___
 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 mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Help a young graduate haskeller to land its dream job

2012-09-12 Thread Alfredo Di Napoli
Hi everyone,

If this mail sound strange to you, you are free to ignore it.

My name is Alfredo Di Napoli and I'm a 24-year-old programmer from
Rome, Italy. I've graduated in May and I'm currently working as an intern
for a company involved in the defence field.

In my spare time, though, I study functional programming, especially 
Haskell. FP is my true passion and I'm another dreamer trying to land the
job he loves.

In a nutshell I'm looking for every possibility to do Haskell/functional
programming in Europe/North Europe. I'm throwing this stone into this pond
because life has endless possibilities, who knows? :)

A disclaimer, though: I'm not an expert Haskeller, but I'm very passionate
about technology and I love learning (I've obviously already read LYAH and
RWH). You can find more information about me (including my CV if interested)
here:

www.alfredodinapoli.com

Oh! One last thing! I would be very grateful to everyone willing to spent
two minutes of his time giving me any kind of suggestion about the FP job
world or how to prepare/improve myself for the foreseeable future.

Thanks again,
and sorry for the OT/spammish plug.

Humbly,
Alfredo Di Napoli

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


Re: [Haskell-cafe] Invitation to connect on LinkedIn

2012-09-12 Thread Brandon Allbery
On Wed, Sep 12, 2012 at 2:21 PM, damodar kulkarni kdamodar2...@gmail.comwrote:

 Correct me if I am wrong, but by looking at the way the message is
 created, I think, LinkedIn is acting a kind of spammer these days. Shall we
 lodge protest against it as a community?


What happens is that anyone who joins is pushed to run their contact list
through them to look for connections, then LinkedIn sends an invitation
to any address not already noted as a member.  So it's spammy but in an
especially slimy user-initiated way.

-- 
brandon s allbery  allber...@gmail.com
wandering unix systems administrator (available) (412) 475-9364 vm/sms
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] [Hackage] Bug report and proposal

2012-09-12 Thread Stayvoid
Hello,

I found a bug: source points to the wrong page. [1]

I know that bugs should be reported via Github. But I don't have an
account and don't want to create one. There might be others who don't
want to use Github. Why rely on external bug tracker? I assume that it
has been chosen because of its features, but it doesn't have the most
important one (i.e. anonymous posting). What's better: to have more
features or to have less bugs?

Is it possible to move away from Github?
What about a separate mailing list for bugs?

I'm sorry if this sounds to harsh; I'm not good at writing. I don't
want to attack or blame anyone. I'm also sorry if this message is not
appropriate, but I haven't found a better place.

[1] 
http://hackage.haskell.org/packages/archive/base/latest/doc/html/Prelude.html#v:seq

Cheers

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


Re: [Haskell-cafe] [ANN] Cumino 0.2 - Now supports pretty indentation through stylish-haskell

2012-09-12 Thread Brandon Allbery
On Wed, Sep 12, 2012 at 1:36 PM, Alfredo Di Napoli 
alfredo.dinap...@gmail.com wrote:

 If such a possibility exists,
 I would be happy to fix the urxvt support :)


Actually I went back through it and it should only be an issue if urxvtc is
used; urxvt should always be standalone.  Unless they went and made it
too smart for its own good, in which case there might be some option to
make it behave the old way.  See
http://www.haskell.org/haskellwiki/Xmonad/General_xmonad.hs_config_tips#Terminal_emulator_factoriesfor
details.  (I am assuming the problem is urxvt recognizes itself and
uses the terminal factory to rub off a new window in the same process,
which can't be given separate configuration information and can't be
communicated with via xterm-style raw pty mode etc.)

-- 
brandon s allbery  allber...@gmail.com
wandering unix systems administrator (available) (412) 475-9364 vm/sms
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Help a young graduate haskeller to land its dream job

2012-09-12 Thread Eugene Kirpichov
Hi Alfredo,

You might look at the various bigdata companies. I was surprised by
how many of them are using Scala or Clojure - it's definitely over
50%. Looks like FP is really gaining traction in this area.

On Wed, Sep 12, 2012 at 11:48 AM, Alfredo Di Napoli
alfredo.dinap...@gmail.com wrote:
 Hi everyone,

 If this mail sound strange to you, you are free to ignore it.

 My name is Alfredo Di Napoli and I'm a 24-year-old programmer from
 Rome, Italy. I've graduated in May and I'm currently working as an intern
 for a company involved in the defence field.

 In my spare time, though, I study functional programming, especially
 Haskell. FP is my true passion and I'm another dreamer trying to land the
 job he loves.

 In a nutshell I'm looking for every possibility to do Haskell/functional
 programming in Europe/North Europe. I'm throwing this stone into this pond
 because life has endless possibilities, who knows? :)

 A disclaimer, though: I'm not an expert Haskeller, but I'm very passionate
 about technology and I love learning (I've obviously already read LYAH and
 RWH). You can find more information about me (including my CV if interested)
 here:

 www.alfredodinapoli.com

 Oh! One last thing! I would be very grateful to everyone willing to spent
 two minutes of his time giving me any kind of suggestion about the FP job
 world or how to prepare/improve myself for the foreseeable future.

 Thanks again,
 and sorry for the OT/spammish plug.

 Humbly,
 Alfredo Di Napoli

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



-- 
Eugene Kirpichov
http://www.linkedin.com/in/eugenekirpichov
We're hiring! http://tinyurl.com/mirantis-openstack-engineer

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


Re: [Haskell-cafe] guards in applicative style

2012-09-12 Thread Brent Yorgey
Lorenzo is correct, but actually for the wrong reason. =) The *type*
of guard is a historical accident, and the fact that it requires
MonadPlus doesn't really tell us anything.  Let's take a look at its
implementation:

  guard   :: (MonadPlus m) = Bool - m ()
  guard True  =  return ()
  guard False =  mzero

'return' is not specific to Monad; we could just as well use 'pure'.
'mzero' is a method of 'MonadPlus' but there is no reason we can't use
'empty' from the 'Alternative' class.  So we could define

  guardA :: Alternative f = Bool - f ()
  guardA True  = pure ()
  guardA False = empty

(As another example, consider the function 'sequence :: Monad m = [m
a] - m [a]'.  Actually this function does not need Monad at all, it
only needs Applicative.)

However, guardA is not as useful as guard, and it is not possible to
do the equivalent of the example shown using a list comprehension with
a guard.  The reason is that whereas monadic computations can make use
of intermediate computed values to decide what to do next, Applicative
computations cannot.  So there is no way to generate values for x and
y and then pass them to 'guardA' to do the filtering.  guardA can only
be used to conditionally abort an Applicative computation using
information *external* to the Applicative computation; it cannot
express a condition on the intermediate values computed by the
Applicative computation itself.

-Brent

On Wed, Sep 12, 2012 at 03:52:03PM +0100, Lorenzo Bolla wrote:
 I'm no expert at all, but I would say no.
 guard type is:
 guard :: MonadPlus m = Bool - m ()
 
 and MonadPlus is a monad plus (ehm...) mzero and mplus
 (http://en.wikibooks.org/wiki/Haskell/MonadPlus).
 On the other hand Applicative is less than a monad
 (http://www.haskell.org/haskellwiki/Applicative_functor), therefore
 guard as is cannot be defined.
 
 But, in your specific example, with lists, you can always use filter:
 filter (uncurry somePredicate) ((,) $ list1 * list2 (somePredicate ???))
 
 hth,
 L.
 
 
 On Wed, Sep 12, 2012 at 3:40 PM, felipe zapata tifonza...@gmail.com wrote:
 
  Hi Haskellers,
 
  Suppose I have two list and I want to calculate
  the cartesian product between the two of them,
  constrained to a predicate.
  In List comprehension notation is just
 
  result = [ (x, y) | x - list1, y -list2, somePredicate x y ]
 
  or in monadic notation
 
  result = do
   x - list1
   y - list2
   guard (somePredicate x y)
  return $ (x,y)
 
  Then I was wondering if we can do something similar using an applicative 
  style
 
  result = (,) $ list1 * list2 (somePredicate ???)
 
  The question is then,
  there is a way for defining a guard in applicative Style?
 
  Thanks in advance,
 
  Felipe Zapata.
 
 
 
  ___
  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 mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Invitation to connect on LinkedIn

2012-09-12 Thread Steve Severance
My heart skipped a beat when I saw myself on here. Then I saw I was the
target. For the record I am morally opposed to inbox harvesting, although
LinkedIn keeps recommending that I do just that.

Steve

On Wed, Sep 12, 2012 at 11:49 AM, Brandon Allbery allber...@gmail.comwrote:

 On Wed, Sep 12, 2012 at 2:21 PM, damodar kulkarni 
 kdamodar2...@gmail.comwrote:

 Correct me if I am wrong, but by looking at the way the message is
 created, I think, LinkedIn is acting a kind of spammer these days. Shall we
 lodge protest against it as a community?


 What happens is that anyone who joins is pushed to run their contact list
 through them to look for connections, then LinkedIn sends an invitation
 to any address not already noted as a member.  So it's spammy but in an
 especially slimy user-initiated way.

 --
 brandon s allbery  allber...@gmail.com
 wandering unix systems administrator (available) (412) 475-9364 vm/sms


 ___
 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] Cumino 0.2 - Now supports pretty indentation through stylish-haskell

2012-09-12 Thread Roman Cheplyaka
Ah, okay. I was just confused by the fact that it uses tmux, and thought
that I was misusing it.

Yes, I also usually keep ghci in a separate window (and I am an xmonad
user, too). I just thought that this offers a different experience and
wanted to try it out.

Anyway, thanks for clarifying.

On Wed, Sep 12, 2012 at 5:24 PM, Alfredo Di Napoli 
alfredo.dinap...@gmail.com wrote:

 Hi Roman,

 Cumino was thought to operate in another terminal. Personally, but this is
 only a personal taste, having to switch between terminal tabs or tmux panes
 is not the fastest workflow. Being an Xmonad user, i can easily swap
 between terminals (read ghci and vim) simply with mod + j or mod + k.
 So the answer to your answer is: You can't, Cumino will always start in
 another terminal window. Is the same behaviour of Slime, though.

 Sent from my iPad

 On 12/set/2012, at 17:06, Roman Cheplyaka r...@ro-che.info wrote:

 So, suppose that I'm in a terminal vim session, and I want to start ghci
 (in the current terminal). What do I do?

 localleadercc starts a new terminal, which is not what I want.

 On Wed, Sep 12, 2012 at 3:03 PM, Alfredo Di Napoli 
 alfredo.dinap...@gmail.com wrote:

 Hi everyone,

 in case you have missed it, I've released a Vim plugin called Cumino:

 http://adinapoli.github.com/cumino/

 It does one simple thing: It allows communication between Vim and tmux,
 in particular to a ghci session. With Cumino you can fire-up Vim,
 load a ghci session and interact with it with only few keystrokes. The
 plugin also supports visual selection: you can select for example a
 function (even with all its signature!)
 and you can send it to ghci. The visual selection supports imports,
 custom types and typeclasses.

 It's a simple idea but so damn useful, imho.

 This release also adds the possibility to prettify the code using the
 excellent stylish-haskell: select a snippet, simply indent in the usual way
 ( = ) and voilà, now
 your code is indented!

 Feedback are highly appreciated, as well as contributions.
 There are still some issues with some terminals (for example urxvt does
 not work right now) but the plugin has been tested against gnome-terminal,
 xterm and mlterm.

 I'll post in reddit too for completeness!

 Bye!
 Alfredo

 ___
 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] [Hackage] Bug report and proposal

2012-09-12 Thread Ivan Lazar Miljenovic
On 13 September 2012 04:53, Stayvoid stayv...@gmail.com wrote:
 Hello,

 I found a bug: source points to the wrong page. [1]

 I know that bugs should be reported via Github. But I don't have an
 account and don't want to create one. There might be others who don't
 want to use Github. Why rely on external bug tracker? I assume that it
 has been chosen because of its features, but it doesn't have the most
 important one (i.e. anonymous posting). What's better: to have more
 features or to have less bugs?

 Is it possible to move away from Github?
 What about a separate mailing list for bugs?

Whilst in general I agree with you, people have complained previously
about needing to subscribe to librar...@haskell.org for bug reports
for boot libraries, or for needing to get a Trac login, etc.

If, however, _no_ login is required, then the system is open to spamming :s


 I'm sorry if this sounds to harsh; I'm not good at writing. I don't
 want to attack or blame anyone. I'm also sorry if this message is not
 appropriate, but I haven't found a better place.

 [1] 
 http://hackage.haskell.org/packages/archive/base/latest/doc/html/Prelude.html#v:seq

 Cheers

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



-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
http://IvanMiljenovic.wordpress.com

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


Re: [Haskell-cafe] guards in applicative style

2012-09-12 Thread Ertugrul Söylemez
Brent Yorgey byor...@seas.upenn.edu wrote:

 However, guardA is not as useful as guard, and it is not possible to
 do the equivalent of the example shown using a list comprehension with
 a guard.  The reason is that whereas monadic computations can make use
 of intermediate computed values to decide what to do next, Applicative
 computations cannot.  So there is no way to generate values for x and
 y and then pass them to 'guardA' to do the filtering.  guardA can only
 be used to conditionally abort an Applicative computation using
 information *external* to the Applicative computation; it cannot
 express a condition on the intermediate values computed by the
 Applicative computation itself.

To continue this story, from most applicative functors you can construct
a category, which is interesting for non-monads.  Let's examine the
SparseStream functor, which is not a monad:

data SparseStream a =
SparseStream {
  headS :: Maybe a,
  tailS :: SparseStream a
}

This is an applicative functor,

instance Applicative SparseStream where
pure x = let str = SparseStream (Just x) str in str

SparseStream f fs * SparseStream x xs =
SparseStream (f * x) (fs * xs)

but with a little extension it becomes a category, the wire category:

newtype Wire a b = Wire (a - (Maybe b, Wire a b))

This is like SparseStream, but for each head/tail pair it wants an
argument.  Given a Category instance you can now actually make use of
guardA without resorting to monadic combinators:

guardA p . myStream

This is conceptually how Netwire's applicative FRP works and how events
are implemented.


Greets,
Ertugrul

-- 
Not to be or to be and (not to be or to be and (not to be or to be and
(not to be or to be and ... that is the list monad.


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


Re: [Haskell-cafe] [ANN] Cumino 0.2 - Now supports pretty indentation through stylish-haskell

2012-09-12 Thread Ray
On Wed, Sep 12, 2012 at 01:03:49PM +, Alfredo Di Napoli wrote:
 Hi everyone,

 in case you have missed it, I've released a Vim plugin called Cumino:

 http://adinapoli.github.com/cumino/

 It does one simple thing: It allows communication between Vim and tmux, in
 particular to a ghci session. With Cumino you can fire-up Vim,
 load a ghci session and interact with it with only few keystrokes. The plugin
 also supports visual selection: you can select for example a function (even
 with all its signature!)
 and you can send it to ghci. The visual selection supports imports, custom
 types and typeclasses.

 It's a simple idea but so damn useful, imho.

 This release also adds the possibility to prettify the code using the 
 excellent
 stylish-haskell: select a snippet, simply indent in the usual way ( = ) and
 voilà, now
 your code is indented!

 Feedback are highly appreciated, as well as contributions.
 There are still some issues with some terminals (for example urxvt does not
 work right now) but the plugin has been tested against gnome-terminal, xterm
 and mlterm.

 I'll post in reddit too for completeness!

Nice bridge between vim and tmux! Would you mind add supporting for `urxvtc'?
urxvtc's -e option is followed by a list of options instead of a string.

urxvtc -e sh -c 'echo a'
xterm -e echo a

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