Re: [Haskell-cafe] Newclasses

2013-10-03 Thread Wvv
Your first two cases will be fixed in 7.10, as Applicative finally becomes a superclass of Monad. Sure, newclassses not about Applicative and Monads only. This question is more wider. Must Apply be a superclass of Bind? Must Bind be a superclass of Monad? So, must Monad has 2 superclasses at

[Haskell-cafe] [ANN] yi-0.7

2013-10-03 Thread Dmitry Ivanov
I'm pleased to announce a new release of Yi, text editor written and extensible in Haskell. This release introduces new vim keybindings emulation. If all goes well, the old one will be deprecated in future. The advantages of the new emulation include support for visual block operations, more

[Haskell-cafe] Using lenses

2013-10-03 Thread Simon Peyton-Jones
(I sent this to 'libraries' but Kim-Ee suggested adding Café, where so many smart people hang out.) Friends Some of you will know that I've promised to give a talk about Edward's lens libraryhttp://hackage.haskell.org/package/lens at the Haskell

Re: [Haskell-cafe] Using lenses

2013-10-03 Thread Nicolas Trangez
Simon, On Thu, 2013-10-03 at 08:07 +, Simon Peyton-Jones wrote: If you are using the lens library yourself, could you spare a few minutes to tell me how you are using it? I'm not a heavy 'lens'-user (yet), and this might not be the most pretty use-case from a theoretic point of view, but

Re: [Haskell-cafe] Using lenses

2013-10-03 Thread Roman Cheplyaka
Hi Simon, An interesting use case is my time-lens library. http://hackage.haskell.org/package/time-lens-0.3/docs/Data-Time-Lens.html You can do things like modL minutes (+5) (TimeOfDay 16 57 13) 17:02:13 But one has to be somewhat lenient about the lens laws here. Roman * Simon

Re: [Haskell-cafe] Using lenses

2013-10-03 Thread Mike Ledger
Hi, In a game I made recently, I had to load OBJ formatted models into an OpenGL-friendly format. To do that, I'd parse the .obj, into a simple ADT, and build the model into a vector. Here's where lens comes in: we want to build separate vectors for the vertices, normals, UVs and faces indices.

Re: [Haskell-cafe] Newclasses

2013-10-03 Thread Stijn van Drongelen
On Thu, Oct 3, 2013 at 8:16 AM, Wvv vite...@rambler.ru wrote: Your first two cases will be fixed in 7.10, as Applicative finally becomes a superclass of Monad. Sure, newclassses not about Applicative and Monads only. This question is more wider. Must Apply be a superclass of Bind? Must

Re: [Haskell-cafe] Using lenses

2013-10-03 Thread Sebastiaan Visser
Simon, I've used lenses to manipulate URIs represented as strings in a structured way, like: modify (port . iso parsePrintUri) (+10) http://localhost:8070/index.html; Of course using fclabels and not lens ;-) Sebastiaan On Oct 3, 2013, at 10:07 AM, Simon Peyton-Jones simo...@microsoft.com

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!

Re: [Haskell-cafe] Using lenses

2013-10-03 Thread Gergely Risko
Hi Simon, http://hackage.haskell.org/package/lens-datetime-0.2/docs/Data-Time-Lens.html Read the top of the page. aDay = fromGregorian 2013 08 22 aLocal = LocalTime aDay (TimeOfDay 13 45 28) aUTC = UTCTime aDay 7458.9 aLocal ^. years 2013 aUTC ^. months 8 aDay ^. days 22 aLocal time .~

Re: [Haskell-cafe] Using lenses

2013-10-03 Thread Tony Morris
Lenses for nested sum types e.g. Either. On 03/10/2013 6:08 PM, Simon Peyton-Jones simo...@microsoft.com wrote: (I sent this to ‘libraries’ but Kim-Ee suggested adding Café, where so many smart people hang out.) ** ** Friends ** ** Some of you will know that I’ve promised to

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

Re: [Haskell-cafe] [ANN] lvish 1.0 -- successor to monad-par

2013-10-03 Thread Ryan Newton
Hi Ben, We made a small update releasehttp://hackage.haskell.org/package/lvish-1.0.0.2that links the github, and also links a mirror for the haddocks, since something weird seems to be going on with Hackage 2: http://www.cs.indiana.edu/~rrnewton/haddock/lvish/

Re: [Haskell-cafe] [ANN] lvish 1.0 -- successor to monad-par

2013-10-03 Thread Roman Cheplyaka
Ryan, You can use standalone-haddock[1] so that the links to other packages are not broken. [1]: http://documentup.com/feuerbach/standalone-haddock Roman * Ryan Newton rrnew...@gmail.com [2013-10-03 10:50:47-0400] Hi Ben, We made a small update

Re: [Haskell-cafe] Using lenses

2013-10-03 Thread Christopher Done
On 3 October 2013 10:57, Roman Cheplyaka r...@ro-che.info wrote: An interesting use case is my time-lens library. http://hackage.haskell.org/package/time-lens-0.3/docs/Data-Time-Lens.html You can do things like modL minutes (+5) (TimeOfDay 16 57 13) 17:02:13 But one has to be

[Haskell-cafe] indentation with let and do

2013-10-03 Thread Corentin Dupont
Hi the list, why do this function doesn't compile (parse error): test :: Bool - IO () test foo = do let bar = case foo of True - Foo; False - Bar return () while this one does (just adding one space in front of True and False): test :: Bool - IO () test foo = do let bar

Re: [Haskell-cafe] indentation with let and do

2013-10-03 Thread AlanKim Zimmerman
The first version has bar True and False all at the same indentation level. As such they are seen as standalone expressions, rather than being nested under the one introduced by bar. See http://en.wikibooks.org/wiki/Haskell/Indentation On Thu, Oct 3, 2013 at 8:31 PM, Corentin Dupont

Re: [Haskell-cafe] indentation with let and do

2013-10-03 Thread Brandon Allbery
On Thu, Oct 3, 2013 at 2:31 PM, Corentin Dupont corentin.dup...@gmail.comwrote: test :: Bool - IO () test foo = do let bar = case foo of True - Foo; False - Bar return () while this one does (just adding one space in front of True and False): test :: Bool - IO ()

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

2013-10-03 Thread Jeremy Shaw
this should be fixed in plugins 1.5.4.0 which is now on hackage. Thanks! - jeremy On Mon, Sep 16, 2013 at 2:49 AM, Petr Pudlák 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

Re: [Haskell-cafe] Newclasses

2013-10-03 Thread Wvv
Yes, multi-class instances allow us write type Monad a = (Applicative a, Bind a) But at least 1 issue remains: Applicative : pure; Monad: return Bind : (-); Monad: (=) With MultiClassInstances we could write only instance Monad MyMonad where { pure= ...; (-)= ...} But we

Re: [Haskell-cafe] indentation with let and do

2013-10-03 Thread Roman Cheplyaka
On Thu, Oct 3, 2013 at 9:44 PM, Brandon Allbery allber...@gmail.com wrote: On Thu, Oct 3, 2013 at 2:31 PM, Corentin Dupont corentin.dup...@gmail.com wrote: test :: Bool - IO () test foo = do let bar = case foo of True - Foo; False - Bar return () while this one

Re: [Haskell-cafe] indentation with let and do

2013-10-03 Thread Corentin Dupont
Thanks to all for your replies! I asked the question because I often make this kind of transformations (please don't mind the non-sensical example): test :: Bool - IO () test foo = do bar - case foo of True - return Foo False - return Bar return () into test :: Bool - IO ()

Re: [Haskell-cafe] indentation with let and do

2013-10-03 Thread David McBride
Imagine if bar was a toplevel function bar = case foo of True - Foo; False - Bar; Keep in mind that indentation level starts at the function name, not at the let keyword. On Thu, Oct 3, 2013 at 2:31 PM, Corentin Dupont corentin.dup...@gmail.comwrote: Hi the list, why do this function

Re: [Haskell-cafe] ANN: Nomyx 0.3 beta, the game where you can change the rules

2013-10-03 Thread Corentin Dupont
There is not so much people in the game right now (only 3) and a little more watching (20). Don't be shy and join! On Thu, Oct 3, 2013 at 1:14 AM, Corentin Dupont corentin.dup...@gmail.comwrote: Hello everybody! I released the third beta of Nomyx http://www.nomyx.net, the only game where You

Re: [Haskell-cafe] Using lenses

2013-10-03 Thread AntC
Lenses for nested ... types ... Hi Simon/Edward/all, The most compelling uses I've seen for lenses is back to Benjamin Pierce's [et al] papers on Updatable Views. I think this is where the 'theory' started(?), although similar ideas had kicked around the relational database world for some

Re: [Haskell-cafe] Newclasses

2013-10-03 Thread John Lato
I don't really understand what a newclass is supposed to be. On Thu, Oct 3, 2013 at 2:15 PM, Wvv vite...@rambler.ru wrote: newclass Bind a = Monad a = BMonad a where { (=) = (-) } I think this means that `BMonad` is supposed to be a new class that has both Bind and Monad in scope, the

Re: [Haskell-cafe] Newclasses

2013-10-03 Thread John Lato
Apologies, that wasn't finished. I meant to say, does it mean that by writing a BMonad instance a Monad instance would be automatically generated? If so, that seems like it would cause conflicts in many cases. Regardless, I think newclass needs to be better specified if you want other people to

[Haskell-cafe] Store type-class polymorphic values generically

2013-10-03 Thread Christopher Done
It's very easy to state this problem without enough details and mislead people into providing a solution for a different problem, so I'll try to include all the information and use-case. I need a function that can store a value in a concrete opaque type. I know the type of the value when I store