[Haskell-cafe] Haskell Madrid meetup: Web development with Haskell. October 9th
Hi Spanish haskellers. Maybe it is too late for the announcement, but we will have a meetup the 9th (next Tuesday). Since the meetup group is devoted to functional programming in general, not specifically Haskell, I will give an introduction to web programming in Haskell: major platforms, libraries technologies coding examples etc. Overall, it will be an opportunity to know people interested in FP, Haskell and Web programming near you. This group meet up every second tuesday of each month. So if you can not attend, perhaps the next month you could. Nos vemos! http://www.meetup.com/FP-Madrid/events/138571062/?_af_eid=138571062a=uc1_vm_af=event -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Lifting IO actions into Applicatives
In MFow there is a Monad instance for formlets that make a lot of sense. Apart from using liftIO inside an applicative formlets it can do it that way also: myBlogForm = do t - liftIO getTime Blog $ titleForm * return t * contentsForm Which may look contrived, but instead of using return t, we can display for the user something interesting in that place. There are other dynamic things, like asking different questions depending on previous responses thanks to the monad instance : http://haskell-web.blogspot.com.es/2013/06/the-promising-land-of-monadic-formlets.html 2013/10/1 Michael Snoyman mich...@snoyman.com On Tue, Oct 1, 2013 at 10:24 AM, Alexey Uimanov s9gf4...@gmail.comwrote: Maybe this is needed new typeclass ApplicativeTrans? There's actually no problem with defining a MonadTrans instance for non-monads. Obviously this can't follow the laws directly (since they're defined in terms of monadic bind and return), but I think we could probably state Applicative versions of those laws (assuming I haven't made a stupid mistake): lift . pure = pure lift (x * y) = lift x * lift y Michael 2013/10/1 Michael Snoyman mich...@snoyman.com I'm wondering if anyone's run into this problem before, and if there's a common solution. In Yesod, we have applicative forms (based originally on formlets). These forms are instances of Applicative, but not of Monad. Let's consider a situation where we want to get some user input to fill out a blog post datatype, which includes the current time: data Blog = Blog Title UTCTime Contents myBlogForm :: Form Blog myBlogForm = Blog $ titleForm * something * contentsForm The question is: what goes in something? Its type has to be: something :: Form UTCTime Ideally, I'd call getCurrentTime. The question is: how do I lift that into a Form? Since Form is only an Applicative, not a Monad, I can't create a MonadIO instance. However, Form is in fact built on top of IO[1]. And it's possible to create a MonadTrans instance for Form, since it's entirely possible to lift actions from the underlying functor/monad into Form. So something can be written as: something = lift $ liftIO getCurrentTime This works, but is unintuitive. One solution would be to have an ApplicativeIO typeclass and then use liftIOA. My questions here are: 1. Has anyone else run into this issue? 2. Is there an existing solution out there? Michael [1] Full crazy definition is at: http://haddocks.fpcomplete.com/fp/7.4.2/20130922-179/yesod-form/Yesod-Form-Types.html#t:AForm ___ 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 -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Proposal: New syntax for Haskell
That was done around 100 years ago with COBOL. 2013/9/10 Vo Minh Thu not...@gmail.com The syntax is actually used by non-technical people to write tests. Using it to write Haskell code is a joke. (Using it for business specification is not, even if for technical people this seems overkill.) Thu 2013/9/10 Ian Ross i...@skybluetrades.net: Me too, but I wasn't brave enough to say so after people seemed to be taking it seriously... On 10 September 2013 13:33, Roman Cheplyaka r...@ro-che.info wrote: * John Wiegley jo...@fpcomplete.com [2013-09-10 04:48:36-0500] Niklas Hambüchen m...@nh2.me writes: Code written in cucumber syntax is concise and easy to read concise |kənˈsīs|, adj. giving a lot of information clearly and in a few words; brief but comprehensive. Compare: Scenario: Defining the function foldl Given I want do define foldl Which has the type (in brackets) a to b to a (end of brackets), to a, to list of b, to a And my arguments are called f, acc, and l When l is empty Then the result better be acc Otherwise l is x cons xs Then the result should be foldl f (in brackets) f acc x (end of brackets) xs To: foldl :: (a - b - a) - a - [b] - a foldl f z [] = z foldl f z (x:xs) = foldl f (f z x) xs How is that more concise or preferable? I thought it was a joke. Roman ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Ian Ross Tel: +43(0)6804451378 i...@skybluetrades.net www.skybluetrades.net ___ 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 -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Any Haskell events in Madrid next week?
There is also a meetup of the FP group in Madrid the 11th http://www.meetup.com/FP-Madrid/events/137941442/?_af_eid=137941442_af=eventa=uc1_te 2013/9/6 Salvador Lucas slu...@dsic.upv.es Hi, There is a workshop on Functional Programming and also a conference on programming languages http://babel.ls.fi.upm.es/tpf2013/cfp_english.txt If interested, you can contact the organizers... Regards, Salvador. El 06/09/13 22:59, Joachim Breitner escribió: Hi, I’ll be visiting Madrid next week (research visit) and I’m wondering if there are any Haskell or FP Group meeting or other events that might be interesting? I could possibly contribute a talk. (Both preferably in English.) Wednesday or Thursday evening might would most convenient. Greetings, Joachim ___ Haskell-Cafe mailing listHaskell-Cafe@haskell.orghttp://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell / Functional Programmers Group in Madrid (Spain)?
There is one Functional Programming meetup in Madrid. The first meeting was in August. The next meeting is the 11th September (this month) . I couldn't assist in September. I hope to see you in October!. http://www.meetup.com/FP-Madrid/ 2013/9/4 Eduardo Basterrechea eba...@molinodeideas.es Alejandro Serrano Mena trupill at gmail.com writes: Hi,Is there any Haskell or functional programmers user group in the region of Madrid? If not, I think it could be a great idea to get to know each other, and share experiences. Furthermore, we could try to organize some meetings with presentations, hackatons and so on (my personal ambition is to be able to organize another ekmett Workshop as the Japanese one - http://comonad.com/reader/2013/japanese-workshop-1/). I know there is some locations along Madrid dedicated to open source promotion, like http://madridonrails.com/, and which we could use for these meetings. I'm really looking forward to hearing from you! PS: Maybe a bare Haskell group is not big enough (at least according to Haskellers.com), but a functional programmers one may well be. ___ Haskell-Cafe mailing list Haskell-Cafe at haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe Let's do it! I think that two it's enough to begin! ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Yet Another Forkable Class
The paper is very interesting: http://www.cs.indiana.edu/~sabry/papers/exteff.pdf It seems that the approach is mature enough and it is better in every way than monad transformers, while at the same time the syntax may become almost identical to MTL for many uses. I only expect to see the library in Hackage with all the blessings, and with all the instances of the MTL classes in order to make the transition form monad transformers to ExtEff as transparent as possible 2013/8/22 o...@okmij.org Perhaps effect libraries (there are several to choose from) could be a better answer to Fork effects than monad transformers. One lesson from the recent research in effects is that we should start thinking what effect we want to achieve rather than which monad transformer to use. Using ReaderT or StateT or something else is an implementation detail. Once we know what effect to achieve we can write a handler, or interpreter, to implement the desired operation on the World, obeying the desired equations. And we are done. For example, with ExtEff library with which I'm more familiar, the Fork effect would take as an argument a computation that cannot throw any requests. That means that the parent has to provide interpreters for all child effects. It becomes trivially to implement: Another example would be a child that should not be able to throw errors as opposed to the parent thread. It is possible to specify which errors will be allowed for the child thread (the ones that the parent will be willing to reflect and interpret). The rest of errors will be statically prohibited then. instance (Protocol p) = Forkable (WebSockets p) (ReaderT (Sink p) IO) where fork (ReaderT f) = liftIO . forkIO . f = getSink This is a good illustration of too much implementation detail. Why do we need to know of (Sink p) as a Reader layer? Would it be clearer to define an Effect of sending to the socket? Computation's type will make it patent the computation is sending to the socket. The parent thread, before forking, has to provide a handler for that effect (and the handler will probably need a socket). Defining a new class for each effect is possible but not needed at all. With monad transformers, a class per effect is meant to hide the ordering of transformer layers in a monad transformer stack. Effect libraries abstract over the implementation details out of the box. Crutches -- extra classes -- are unnecessary. We can start by writing handlers on a case-by-case basis. Generalization, if any, we'll be easier to see. From my experience, generalizing from concrete cases is easier than trying to write a (too) general code at the outset. Way too often, as I read and saw, code that is meant to be reusable ends up hardly usable. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell Platform and Leksah on Windows
For those who want to be productive rather than talkative masoquists (thus said with all my love ;)), there are windows installers for Leksah and they work perfectly well. 2013/8/9 David Virebayre dav.vire+hask...@gmail.com Hi, If you go the EclipseFP approach, you may have installations troubles too. In my case, it was due to having a version of GHC and libraries that EclipseFP doesn't like. Once I got it to work, I loved it. David. 2013/8/8 Dorin Lazar dorin.la...@gmail.com: Hi, I understood what's wrong about my approach - and since I want to use an IDE to assist me, I will try both EclipseFP and Sublime Text, to see how that works. My feeling was that since the leksah website suggested that cabal is the way to do it and since when I search for a Haskell IDE that is it, then it was obvious that the recommended way doesn't work as it should. In my mind the platform was broken, I understand now that it's not the platform, just this special way of using it. I was also in awe of the fact that nobody really says anything about these difficulties, and felt like an estranged child that messed things up badly; however, it seems that the real issue is that nobody really does it that way, and I was wrong to actually try it like that. As I said (or haven't, but will) once I will get the hang of it I will recount my experience for others to follow, hopefully in better terms than this frustrating first experience. Many thanks for everyone's advice on the list, Dorin On Thu, Aug 8, 2013 at 9:48 PM, Carter Schonwald carter.schonw...@gmail.com wrote: Hey Dorin, I don't understand your claims. 1) haskell has worked perfectly well on windows for quite some time. I used HUGs nearly a decade ago, and in more recent time (2-3 years ago) I helped teach an introductory first computer science class using GHC where many students were doing great work using notepad++ and ghci. I don't understand your focus on emacs and make files. 2) if you want an IDE experience, Sublime Text with the right plugins, or perhaps EclipseFP are worth checking out. 3) likewise, if you're finding tooling on windows unsatisfactory, help fix it! Bug reports, patches, or new tools and libraries are always welcome. Haskell is a relatively small community, and thusly limited manpower (we're all volunteers), so way to fix any problem is help out! cheers On Thu, Aug 8, 2013 at 3:30 AM, Dorin Lazar dorin.la...@gmail.com wrote: Hello, I am the original author of the post, and I finally received the emails from the mailman (probably there was an issue with the automated requests). My answers are inlined. 1) Leksah should not be considered an official haskell ide, but merely one of many community supported editing tools. And frankly one of the less widely used ones at that! Leksah is not used much at all by anyone, though theres probably a handful of folks who do use it. Many folks use editors like Sublime Tex (2/3), Emacs, Vi(m), textmate, and many more. Its worth noting that the sublime-haskell plugin for sublime text, and analogous packages for many other editors, provide haskell IDE-like powers, or at least a nice subset thereof. Unfortunately, I think the problem with this is that we have a different vision on how development should be done. I have extensive experience of working from console, with a simple text editor and hand-made Makefiles or anything similar. However, an IDE should be a productivity tool, that can help you improve your understanding of the language, and can assist you in following the proper syntax for a new language. While learning by doing 'write, save, compile, examine error message' is ok with me, it is slow, and it limits the time I can dedicate to learning the language itself. A better cycle is the current 'write, examine error message' of most IDEs, since it's faster and requires no context switch. Sure, editors can help there. IDEs do this by default. So it's normal of me to search for an IDE to better learn the language, I'll leave the emacs + console version for when I am productive in the language. 2) There are people working on building better easily portable native gui toolkits, but in many respects, a nice haskelly gui toolkit is still something people are experimetning with how to do well. theres lots of great tools out as of the past year or two, many more in progress on various time scales, and gtk2hs is great for linux (and thats fine). Unfortunately, this is not what's advertised. In fact, on the leksah site, the recommended method is to have the IDE installed via cabal. In another mail Mihai calls me unreasonable, but I think it's reasonable to think that the recommended method should be the one that works. But the easy to tell truth is that the Haskell Platform for
Re: [Haskell-cafe] Alternative name for return
One of the surprising things of Haskell is how little effort is done in order to confer meaning to the names. That happens also in the case of the mathematical language. Often they have a single letter. The reason is that their meaning is completely defined by their signature and their properties. And this is possible because Haskell has a strong and polymorphic type system. In other languages, either this is not possible or the libraries have little polymorphism, so the names can be more concrete. return :: (Monad m) = a - m a The meaning is in the signature. We can opt between keeping the name as a short mnemonic of the signature or else we can adhere to the C tradition: return === monad_m___a__m_a or the Java Tradition return =MonadFactory.liftSomethingSometimesPureButInSomeCasesTheResultIsAlsoPure 2013/8/7 Richard A. O'Keefe o...@cs.otago.ac.nz On 7/08/2013, at 2:10 PM, damodar kulkarni wrote: I bet you can find an abundance of C programmers who think that strcmp is an intuitive name for string comparison (rather than compression, say). But at least, 'strcmp' is not a common English language term, to have acquired some unintentional 'intuition' by being familiar with it even in our daily life. The Haskell terms, say, 'return' and 'lift', on the other hand, do have usage in common English, so even a person with _no_ programming background would have acquired some unintentional 'intuition' by being familiar with them. Lift is - a brand of soft drink, the thing Americans call an elevator, a thing put in your shoes seem taller, and a free ride, amongst other things. As a verb, it can mean to kick something. To find lift intuitive, you have to be familiar with the *mathematical* idiom of lifting a value from one space to another via some sort of injection. Fair enough, but this *still* counts as an example of intuitive = familiar, because this is *not* a sense of lift that is familiar to undergraduate and masters computing students unless they have taken rather more mathematics papers than most of them have. If you're familiar with *English* rather than, say, the C family of programming languages, return isn't _that_ bad, there is certainly nothing about the word that suggests providing a value. I once tried to propose a C-style 'return' statement to some people who were designing a programming language, before I or they had ever heard of C, and they flatly rejected it. Months later I found out that this was because they were looking for something that did not just resume the caller but also provided a value, and when I protested that that's exactly what 'return' did in the languages I proposed stealing from, they -- being familiar with Fortran -- said that it had never occurred to them that 'return' could have anything to with providing a value. It is intuitive has no other discernable meaning than *I* am familiar with it, or something very much like it. _That's_ the point I want to make. *Whatever* anyone uses for Haskell's return, many people are bound to find it unintuitive. Choose a name on any grounds but that. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Alternative name for return
Fine reasoning. Pure means incorruptible. It means that a pure result can be reused again and again -like the gold or silver- while an impure result must be re-created whenever it must be used. The metaphor is natural and I guess that the use of pure (rather than referential transparent) is informal, but as unavoidable as useful. By the way, there are deeper considerations here: To deal with pure values, like incorruptible stuff, like gold implies lower information costs and that´s one of the reasons why they are valuable. In this sense, we can give a positive meaning to unsafePerformIO and change its name to purify or even pasteurize or lyophilize ;) 2013/8/7 Jerzy Karczmarczuk jerzy.karczmarc...@unicaen.fr Richard A. O'Keefe : Haskell has **trained** my intuition to see 'putStrLn Hi' as a pure value; it's not the thing itself that has effects, but its interpretation by an outer engine, just as my magnetic card key has by itself no power to open doors, but the magnetic reader that looks at the card_does_. I am the last here who would quarrel with Richard O'K., but I firmly believe that such reasoning is a Pandora box. The King, the government, the Pope, etc. have no power, only the interpretation of their decrees by outer agents _does_ things. Saying that the Justice of the country X is lousy is a harmful abuse. Our Justice is good, only its interpretation by some incompetent traitors gave rise to all these calamitous events. You see what I mean?... Are we going to switch now to the Mind-Body dilemma? == BTW. Saying that 5 is a pure value means only that the whole of the underlying system treats it as such. The object 5 couldn't care less. It even doesn't know that in some programming language it is equivalent to an action which puts it on the evaluation stack. That's why for me the purity (while teaching I try to avoid this word) means simply that whatever you do with the object, it won't fire a magic process. As Richard, I do not claim that this is right, but it surely facilitated my teaching of Haskell. My students have already more than enough of my /philosophie de pacotille/... Jerzy Karczmarczuk ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Dynamic and equality
You can define: data EqDyn= forall a.(Typeable a, Eq a)= EqDyn a instance Eq EqDyn where (EqDyn x) == (EqDyn y)= typeOf x== typeOf y x== unsafeCoerce y unsafeCoerce is safe synce the expression assures that types are equal 2013/7/20 adam vogt vogt.a...@gmail.com On Sat, Jul 20, 2013 at 12:31 AM, Carter Schonwald carter.schonw...@gmail.com wrote: the tricky part then is to add support for other types. another approach to existentially package type classes with the data type! eg data HasEq = forall a . HasEq ( Eq a = a) or its siblinng data HasEq a = Haseq (Eq a = a ) note this requires more planning in how you structure your program, but is a much more pleasant approach than using dynamic when you can get it to suite your application needs. note its also late, so I've not type checked these examples ;) Hi Carter, It doesn't seem like the existential one will work as-is, since ghc rejects this: {-# LANGUAGE ExistentialQuantification #-} data HEQ = forall a. Eq a = HEQ a usingHEQ :: HEQ - HEQ - Bool usingHEQ (HEQ a) (HEQ b) = a == b I think you were hinting at this option which is better than my first suggestion: {-# LANGUAGE ExistentialQuantification #-} import Data.Typeable data DYN = forall a. Typeable a = DYN (a, DYN - Bool) mkDyn :: (Eq a, Typeable a) = a - DYN mkDyn x = DYN (x, \(DYN (y, eq2)) - case cast y of Just y' - x == y' _ - False) mkDyn' :: Typeable a = a - DYN mkDyn' x = DYN (x, \_ - False) eqDyn :: DYN - DYN - Bool eqDyn x@(DYN (_, fx)) y@(DYN (_,fy)) = fx y || fy x Maybe there's some way to get mkDyn' and mkDyn as the same function, without having to re-write all of the Eq instances as a 2-parameter class like http://www.haskell.org/haskellwiki/GHC/AdvancedOverlap. -- Adam ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] List Monads and non-determinism
Matt It is not return, but the bind the one that does the miracle of multiplication. By its definition for the list monad, it applies the second term once for each element are in the first term. So return is called many times. At the end, bind concat all the small lists generated 2013/7/20 Matt Ford m...@dancingfrog.co.uk Hi All, I thought I'd have a go at destructing [1,2] = \n - [3,4] = \m - return (n,m) which results in [(1,3)(1,4),(2,3),(2,4)] I started by putting brackets in ([1,2] = \n - [3,4]) = \m - return (n,m) This immediately fails when evaluated: I expect it's something to do with the n value now not being seen by the final return. It seems to me that the return function is doing something more than it's definition (return x = [x]). If ignore the error introduced by the brackets I have and continue to simplify I get. [3,4,3,4] = \m - return (n,m) Now this obviously won't work as there is no 'n' value. So what's happening here? Return seems to be doing way more work than lifting the result to a list, how does Haskell know to do this? Why's it not in the function definition? Are lists somehow a special case? Any pointers appreciated. Cheers, -- Matt ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [web-devel] Automatic error traces
Hi Greeg, All I created a repository in gitHub with the necessary code for generating execution traces in case of error: https://github.com/agocorona/control-monad-supervisor/blob/master/Demos/TraceExample.hs the code is {-# OPTIONS -F -pgmF MonadLoc #-} module Demos.TraceExample ( ) where import Control.Monad.Loc import Control.Monad.Supervisor.Trace import Control.Monad.Trans main= runTrace $ do liftIO $ print hello example example= if True then do liftIO $ print world liftIO $ undefined else liftIO $ print not there run It with runghc Demos/TraceExample.hs hello world TraceExample.hs: TRACE (error in the last line): main, Demos.TraceExample(Demos\TraceExample.hs): (23, 18) main, Demos.TraceExample(Demos\TraceExample.hs): (26, 4) example, Demos.TraceExample(Demos\TraceExample.hs): (30, 13) example, Demos.TraceExample(Demos\TraceExample.hs): (32, 15) exception: Prelude.undefined to show the generated trace. It is necessary to install the monadloc-pp and the monadloc packages. It uses Control.Monad.Supervisor which is the monad that execute the backtracking that generate the error trace after the error. ( I will upload it to Hackage soon). It uses also Control.Monad.Supervisor.Trace, that has a MonadLoc instance for the Supervisor monad. You can create a MonadLogger instance taking as example the MonadLoc one. 2013/7/17 Alberto G. Corona agocor...@gmail.com Hi Greeg. Nice I will publish the mechanism in a separate package once I clean it up At first sight, It is possible to use file-location and monad-logger with the traces instead of monadloc. In the meantime, I will advance to you a copy of the details in a separate mail. 2013/7/16 Greg Weber g...@gregweber.info That's great. We should collaborate on this. I wrote the file-location package and Michael Snoyman wrote monad-logger: both of these give file location information. I also added command tracing to Shelly (which could also benefit from this kind of thing) and recently released rollbar for error notification and would like to have as much line info as possible for that. On Tue, Jul 16, 2013 at 5:45 AM, Alberto G. Corona agocor...@gmail.comwrote: It is important to have execution traces in case of error. specially in server applications that run 24/7 such are web applications Thanks to the wonderful package monadloc by Pepe Iborra, now MFlow can generate a complete execution trace in case of error. The control-monad-exception uses monadLoc to generate stack traces, but MFlow makes use of his backtracking mechanism to generate a complete execution trace. Here I explain what and how: http://haskell-web.blogspot.com.es/2013/07/automatic-error-trace-generation-in.html The MFlow version that implements this is in gitHub. Not in hackage yet. https://github.com/agocorona/MFlow I´m quite proud of it since it is one of the things closest to magic that I have done. Feedback? I do not want to keep MFlow as a single person development. I think that it has many unique and nice features not available in other languages and frameworks, and it can be raised to a serious exploitation level by the Haskell community. This will attract people working in Industrial Web development to Haskell thanks to the edge in expressiveness and safety necessary for creating industrial solutions that Haskell has over other languages. It uses most other Haskell web developments blaze, wai, hamlet etc and there are many other things to come. monadLoc : http://hackage.haskell.org/package/monadloc -- Alberto. ___ web-devel mailing list web-de...@haskell.org http://www.haskell.org/mailman/listinfo/web-devel -- Alberto. -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] catching IO errors in a monad transformer stack
Hi Eric: The pattern may be the MonadCatchIO class: http://hackage.haskell.org/package/MonadCatchIO-transformers 2013/7/18 Eric Rasmussen ericrasmus...@gmail.com Hello, I am writing a small application that uses a monad transformer stack, and I'm looking for advice on the best way to handle IO errors. Ideally I'd like to be able to perform an action (such as readFile file_that_does_not_exist), catch the IOError, and then convert it to a string error in MonadError. Here's an example of what I'm doing now: {-# LANGUAGE FlexibleContexts #-} import Control.Monad.Error import Control.Monad.State import System.IO.Error (tryIOError) catcher :: (MonadIO m, MonadError String m) = IO a - m a catcher action = do result - liftIO $ tryIOError action case result of Left e - throwError (show e) Right r - return r This does work as expected, but I get the nagging feeling that I'm missing an underlying pattern here. I have tried catch, catchError, and several others, but (unless I misused them) they don't actually help here. The tryIOError function from System.IO.Error is the most helpful, but I still have to manually inspect the result to throwError or return to my underlying monad. Since this has come up for me a few times now, I welcome any advice or suggestions on alternative approaches or whether this functionality already exists somewhere. Thanks! Eric ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [web-devel] Automatic error traces
Hi Greeg. Nice I will publish the mechanism in a separate package once I clean it up At first sight, It is possible to use file-location and monad-logger with the traces instead of monadloc. In the meantime, I will advance to you a copy of the details in a separate mail. 2013/7/16 Greg Weber g...@gregweber.info That's great. We should collaborate on this. I wrote the file-location package and Michael Snoyman wrote monad-logger: both of these give file location information. I also added command tracing to Shelly (which could also benefit from this kind of thing) and recently released rollbar for error notification and would like to have as much line info as possible for that. On Tue, Jul 16, 2013 at 5:45 AM, Alberto G. Corona agocor...@gmail.comwrote: It is important to have execution traces in case of error. specially in server applications that run 24/7 such are web applications Thanks to the wonderful package monadloc by Pepe Iborra, now MFlow can generate a complete execution trace in case of error. The control-monad-exception uses monadLoc to generate stack traces, but MFlow makes use of his backtracking mechanism to generate a complete execution trace. Here I explain what and how: http://haskell-web.blogspot.com.es/2013/07/automatic-error-trace-generation-in.html The MFlow version that implements this is in gitHub. Not in hackage yet. https://github.com/agocorona/MFlow I´m quite proud of it since it is one of the things closest to magic that I have done. Feedback? I do not want to keep MFlow as a single person development. I think that it has many unique and nice features not available in other languages and frameworks, and it can be raised to a serious exploitation level by the Haskell community. This will attract people working in Industrial Web development to Haskell thanks to the edge in expressiveness and safety necessary for creating industrial solutions that Haskell has over other languages. It uses most other Haskell web developments blaze, wai, hamlet etc and there are many other things to come. monadLoc : http://hackage.haskell.org/package/monadloc -- Alberto. ___ web-devel mailing list web-de...@haskell.org http://www.haskell.org/mailman/listinfo/web-devel -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Automatic error traces
It is important to have execution traces in case of error. specially in server applications that run 24/7 such are web applications Thanks to the wonderful package monadloc by Pepe Iborra, now MFlow can generate a complete execution trace in case of error. The control-monad-exception uses monadLoc to generate stack traces, but MFlow makes use of his backtracking mechanism to generate a complete execution trace. Here I explain what and how: http://haskell-web.blogspot.com.es/2013/07/automatic-error-trace-generation-in.html The MFlow version that implements this is in gitHub. Not in hackage yet. https://github.com/agocorona/MFlow I´m quite proud of it since it is one of the things closest to magic that I have done. Feedback? I do not want to keep MFlow as a single person development. I think that it has many unique and nice features not available in other languages and frameworks, and it can be raised to a serious exploitation level by the Haskell community. This will attract people working in Industrial Web development to Haskell thanks to the edge in expressiveness and safety necessary for creating industrial solutions that Haskell has over other languages. It uses most other Haskell web developments blaze, wai, hamlet etc and there are many other things to come. monadLoc : http://hackage.haskell.org/package/monadloc -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE: MFlow 3.0
I factored out the submit buttons. Now the three text boxes appear in succession above a unique button below. http://mflowdemo.herokuapp.com/noscript/fviewmonad This is the new code: sumWidget= pageFlow sum $ do n ← (do n1 ← p Enter first number ++ getInt Nothing ++ br n2 ← p Enter second number ++ getInt Nothing ++ br n3 ← p Enter third number ++ getInt Nothing ++ br return (n1+ n2 + n3)) ** pageFlow button (submitButton submit) p (The result is: ++show n) ++ wlink () b menu ++ p you can change the numbers in the boxes to see how the result changes 2013/7/10 Adrian May adrian.alexander@gmail.com Oh how nice! I have been looking at MFlow a lot lately and I think it's got something quite special that Yesod, Happstack, etc don't seem to have, at least, not as far as I know. I mean, look at this: sumWidget= pageFlow sum $ do n1 - p Enter first number ++ getInt Nothing ** submitButton enter ++ br n2 - p Enter second number ++ getInt Nothing ** submitButton enter ++ br n3 - p Enter third number ++ getInt Nothing ** submitButton enter ++ br p (The result is: ++show (n1 + n2 + n3)) ++ wlink () b menu ++ p you can change the numbers in the boxes to see how the result changes Is that pretty or what? That's the code for this: http://mflowdemo.herokuapp.com/noscript/fviewmonad To me that's a real technological step over and above the usual servlets paradigm and I'd love to see more people getting involved. It seems like Yesod and Happstack have a lot more manpower behind them, but unless I've missed something, MFlow is going somewhere new and should be helped along. Adrian. PS. Besides Seaside, Racket is playing with the same ideas. They (Jay McCarthy) have something to say about performance but I didn't quite understand it. On 10 July 2013 06:41, Alberto G. Corona agocor...@gmail.com wrote: The third version of MFlow is out. http://hackage.haskell.org/package/MFlow MFlow is an all-heterodox web application framework, but very haskellish. Now MFlow support restful URLs. It is the first stateful web framework to my knowledge that supports it. The type safe routes are implicitly expressed as normal monadic code within a navigation monad. The application look as a normal imperative console application, but the navigation monad goes back and forth to match the path of the URL. The user has control of the state, that can roll-back or not when the navigation goes back depending on the application needs. The state is in the form of normal Haskell variables In a monadic computation, with the weird addition of backtracking. The menu of the application below is implemented as an imperative-like syntax, but the application navigate forward and backward to synchronize with the requests of the web browser: http://mflowdemo.herokuapp.com/ This version support in-page flows. What is that? look at this example: http://mflowdemo.herokuapp.com/noscript/fviewmonad These flows are implemented as formlets with a monad instance, and callbacks which change the look. I call them widgets: http://haskell-web.blogspot.com.es/2013/06/the-promising-land-of-monadic-formlets.html Each page may have many of these active widgets, each one running their own flow. These widgets refresh themselves trough Ajax if they are enclosed in the primitive autoRefresh. If there is no Ajax or JavaScript available, they gracefully degrade by refreshing the entire page: http://mflowdemo.herokuapp.com/noscript/combination http://haskell-web.blogspot.com.es/2013/06/and-finally-widget-auto-refreshing.html The page flows and the multiflow idea was inspired in Seasidehttp://www.seaside.st/, a great Smalltalk web framework and adapted to the pure recursive nature of Haskell and the formlets. It also support some JQuery widgets integrated: modal and not modal dialogs, datePicker and other active widgets that handle other widgets. It also support the older features: persistent state, WAI, blaze-html and others integration, server process timeouts, Ajax, requirements, content management, caching of widget rendering and all the other previous stuff. I wish to thank some people for their feedback. Specially Adrian May for his feedback and interest -- Alberto. ___ 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 -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE: MFlow 3.0
However, besides state synchronization is under development, state persistence in MFlow is optional, by using the workflow monad instead of the IO monad. See for example this: http://mflowdemo.herokuapp.com/shop 2013/7/10 Alberto G. Corona agocor...@gmail.com My plan is to synchronize MFlow servers using cloud Haskell since the state serialization is small. I´m working on it. However continuation based frameworks can not synchronize state. There is swarm in scala that generate portable continuations but this is not used in the context of web application since the state in a continuation is big and can not be synchronized fast enough. In other languages these states are not even portable between machines. 2013/7/10 Alexander Kjeldaas alexander.kjeld...@gmail.com Here are some common-lisp web frameworks using continuations: http://common-lisp.net/project/cl-weblocks/ http://common-lisp.net/project/ucw/features.html What always worried me with these frameworks is how they could be made robust in case of failures. Storing all state in a database backend often makes it possible to isolate failures. However, it seems to me that it is be possible to solve this in Haskell where state can be serialized and synchronized between multiple machines using Cloud Haskell, something that is error-prone or impossible in other languages. But that step has never been taken. Alexander On Wed, Jul 10, 2013 at 4:48 PM, Alberto G. Corona agocor...@gmail.comwrote: Thanks Adrian. The racket people where pioneers in this idea I think. There is another web framework in Ocaml, Osigen that it is also continuation based. MFlow is not continuation-based but it also define the navigation as a sequence. But only Seaside (and now MFlow) supports many flows in the same page. See for example this: [PDF] *Seaside* – A *Multiple* Control *Flow* Web Application Frameworkhttp://www.google.es/url?sa=trct=jq=esrc=sfrm=1source=webcd=3cad=rjaved=0CEwQFjACurl=http%3A%2F%2Fscg.unibe.ch%2Farchive%2Fpapers%2FDuca04eSeaside.pdfei=WnPdUYHPI-Ly7Aaa0oHQDAusg=AFQjCNFxwsFQc9QsQCNPRFfD4t6ReQtP5gsig2=_klwtzxIKW5UzAOUDOvFCw There is also other: Apache Coccoon that run in a special kind of JavaScript. The continuation-based frameworks have the reputation of storing a lot of application state and to be non scalable. MFlow uses backtracking and It does not have these problems. 2013/7/10 Adrian May adrian.alexander@gmail.com Oh how nice! I have been looking at MFlow a lot lately and I think it's got something quite special that Yesod, Happstack, etc don't seem to have, at least, not as far as I know. I mean, look at this: sumWidget= pageFlow sum $ do n1 - p Enter first number ++ getInt Nothing ** submitButton enter ++ br n2 - p Enter second number ++ getInt Nothing ** submitButton enter ++ br n3 - p Enter third number ++ getInt Nothing ** submitButton enter ++ br p (The result is: ++show (n1 + n2 + n3)) ++ wlink () b menu ++ p you can change the numbers in the boxes to see how the result changes Is that pretty or what? That's the code for this: http://mflowdemo.herokuapp.com/noscript/fviewmonad To me that's a real technological step over and above the usual servlets paradigm and I'd love to see more people getting involved. It seems like Yesod and Happstack have a lot more manpower behind them, but unless I've missed something, MFlow is going somewhere new and should be helped along. Adrian. PS. Besides Seaside, Racket is playing with the same ideas. They (Jay McCarthy) have something to say about performance but I didn't quite understand it. On 10 July 2013 06:41, Alberto G. Corona agocor...@gmail.com wrote: The third version of MFlow is out. http://hackage.haskell.org/package/MFlow MFlow is an all-heterodox web application framework, but very haskellish. Now MFlow support restful URLs. It is the first stateful web framework to my knowledge that supports it. The type safe routes are implicitly expressed as normal monadic code within a navigation monad. The application look as a normal imperative console application, but the navigation monad goes back and forth to match the path of the URL. The user has control of the state, that can roll-back or not when the navigation goes back depending on the application needs. The state is in the form of normal Haskell variables In a monadic computation, with the weird addition of backtracking. The menu of the application below is implemented as an imperative-like syntax, but the application navigate forward and backward to synchronize with the requests of the web browser: http://mflowdemo.herokuapp.com/ This version support in-page flows. What is that? look at this example: http://mflowdemo.herokuapp.com/noscript/fviewmonad These flows are implemented as formlets with a monad instance, and callbacks which change
Re: [Haskell-cafe] Non-recursive let [Was: GHC bug? Let with guards loops]
I think that a non-non recursive let could be not compatible with the pure nature of Haskell. Let is recursive because, unlike in the case of other languages, variables are not locations for storing values, but the expressions on the right side of the equality themselves. And obviously it is not possible for a variable-expression to be two expressions at the same time. The recursiveness is buildt-in. It comes from its pure nature. For a non recursive version of let, it would be necessary to create a new closure on each line, to create a new variable-expression with the same name, but within the new closure. A different variable after all. That is what the example with the Identity (and the state monad) does. So I think that the ugly return example or the more elegant state monad alternative is the right thing to do. 2013/7/10 Ertugrul Söylemez e...@ertes.de o...@okmij.org wrote: Hear, hear! In OCaml, I can (and often do) write let (x,s) = foo 1 [] in let (y,s) = bar x s in let (z,s) = baz x y s in ... In Haskell I'll have to uniquely number the s's: let (x,s1) = foo 1 [] in let (y,s2) = bar x s1 in let (z,s3) = baz x y s2 in ... This isn't a case for non-recursive let. It is one of the rare cases where you might actually consider using a state monad. 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. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Correct way to catch all exceptions
Don´t tried it and probably it does not even compile, but a possibility could be along these lines: catchExcept excepts handle e= do if not . null $ filter ( \(SomeException e') - typeOf e= typeOf e') excepts then throw e else handle e use: u= undefined excluded= [SomeException (u :: AsyncException), SomeException (u ::ArithException)] sample= expr `catchExcept` excluded $ do 2013/7/10 Erik Hesselink hessel...@gmail.com Hi Michael, We do this as well. In addition to AsyncException, we ignore BlockedIndefinitelyOnSTM, BlockedIndefinitelyOnMVar and Deadlock. I'm not sure you can ignore Timeout, since the type is not exported from System.Timeout. I'm not sure how to classify these, though. They are in some sense non-recoverable: restarting whatever the thread was doing is not the right thing to do. Erik On Wed, Jul 10, 2013 at 8:28 AM, Michael Snoyman mich...@snoyman.com wrote: There's a pattern that arises fairly often: catching every exception thrown by code. The naive approach is to do something like: result - try someCode case result of Left (e :: SomeException) - putStrLn $ It failed: ++ show e Right realValue - useRealValue This seems perfectly valid, except that it catches a number of exceptions which seemingly should not be caught. In particular, it catches the async exceptions used by both killThread and timeout. I think it's fair to say that there's not going to be a single function that solves all cases correctly, but it is a common enough situation that people need to write code that resumes work in the case of an exception that I think we need to either have some guidelines for the right approach here, or perhaps even a utility function along the lines of: shouldBeCaught :: SomeException - Bool One first stab at such a function would be to return `False` for AsyncException and Timeout, and `True` for everything else, but I'm not convinced that this is sufficient. Are there any thoughts on the right approach to take here? ___ 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 -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE: MFlow 3.0
Thanks Adrian. The racket people where pioneers in this idea I think. There is another web framework in Ocaml, Osigen that it is also continuation based. MFlow is not continuation-based but it also define the navigation as a sequence. But only Seaside (and now MFlow) supports many flows in the same page. See for example this: [PDF] *Seaside* – A *Multiple* Control *Flow* Web Application Frameworkhttp://www.google.es/url?sa=trct=jq=esrc=sfrm=1source=webcd=3cad=rjaved=0CEwQFjACurl=http%3A%2F%2Fscg.unibe.ch%2Farchive%2Fpapers%2FDuca04eSeaside.pdfei=WnPdUYHPI-Ly7Aaa0oHQDAusg=AFQjCNFxwsFQc9QsQCNPRFfD4t6ReQtP5gsig2=_klwtzxIKW5UzAOUDOvFCw There is also other: Apache Coccoon that run in a special kind of JavaScript. The continuation-based frameworks have the reputation of storing a lot of application state and to be non scalable. MFlow uses backtracking and It does not have these problems. 2013/7/10 Adrian May adrian.alexander@gmail.com Oh how nice! I have been looking at MFlow a lot lately and I think it's got something quite special that Yesod, Happstack, etc don't seem to have, at least, not as far as I know. I mean, look at this: sumWidget= pageFlow sum $ do n1 - p Enter first number ++ getInt Nothing ** submitButton enter ++ br n2 - p Enter second number ++ getInt Nothing ** submitButton enter ++ br n3 - p Enter third number ++ getInt Nothing ** submitButton enter ++ br p (The result is: ++show (n1 + n2 + n3)) ++ wlink () b menu ++ p you can change the numbers in the boxes to see how the result changes Is that pretty or what? That's the code for this: http://mflowdemo.herokuapp.com/noscript/fviewmonad To me that's a real technological step over and above the usual servlets paradigm and I'd love to see more people getting involved. It seems like Yesod and Happstack have a lot more manpower behind them, but unless I've missed something, MFlow is going somewhere new and should be helped along. Adrian. PS. Besides Seaside, Racket is playing with the same ideas. They (Jay McCarthy) have something to say about performance but I didn't quite understand it. On 10 July 2013 06:41, Alberto G. Corona agocor...@gmail.com wrote: The third version of MFlow is out. http://hackage.haskell.org/package/MFlow MFlow is an all-heterodox web application framework, but very haskellish. Now MFlow support restful URLs. It is the first stateful web framework to my knowledge that supports it. The type safe routes are implicitly expressed as normal monadic code within a navigation monad. The application look as a normal imperative console application, but the navigation monad goes back and forth to match the path of the URL. The user has control of the state, that can roll-back or not when the navigation goes back depending on the application needs. The state is in the form of normal Haskell variables In a monadic computation, with the weird addition of backtracking. The menu of the application below is implemented as an imperative-like syntax, but the application navigate forward and backward to synchronize with the requests of the web browser: http://mflowdemo.herokuapp.com/ This version support in-page flows. What is that? look at this example: http://mflowdemo.herokuapp.com/noscript/fviewmonad These flows are implemented as formlets with a monad instance, and callbacks which change the look. I call them widgets: http://haskell-web.blogspot.com.es/2013/06/the-promising-land-of-monadic-formlets.html Each page may have many of these active widgets, each one running their own flow. These widgets refresh themselves trough Ajax if they are enclosed in the primitive autoRefresh. If there is no Ajax or JavaScript available, they gracefully degrade by refreshing the entire page: http://mflowdemo.herokuapp.com/noscript/combination http://haskell-web.blogspot.com.es/2013/06/and-finally-widget-auto-refreshing.html The page flows and the multiflow idea was inspired in Seasidehttp://www.seaside.st/, a great Smalltalk web framework and adapted to the pure recursive nature of Haskell and the formlets. It also support some JQuery widgets integrated: modal and not modal dialogs, datePicker and other active widgets that handle other widgets. It also support the older features: persistent state, WAI, blaze-html and others integration, server process timeouts, Ajax, requirements, content management, caching of widget rendering and all the other previous stuff. I wish to thank some people for their feedback. Specially Adrian May for his feedback and interest -- Alberto. ___ 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] ANNOUNCE: MFlow 3.0
My plan is to synchronize MFlow servers using cloud Haskell since the state serialization is small. I´m working on it. However continuation based frameworks can not synchronize state. There is swarm in scala that generate portable continuations but this is not used in the context of web application since the state in a continuation is big and can not be synchronized fast enough. In other languages these states are not even portable between machines. 2013/7/10 Alexander Kjeldaas alexander.kjeld...@gmail.com Here are some common-lisp web frameworks using continuations: http://common-lisp.net/project/cl-weblocks/ http://common-lisp.net/project/ucw/features.html What always worried me with these frameworks is how they could be made robust in case of failures. Storing all state in a database backend often makes it possible to isolate failures. However, it seems to me that it is be possible to solve this in Haskell where state can be serialized and synchronized between multiple machines using Cloud Haskell, something that is error-prone or impossible in other languages. But that step has never been taken. Alexander On Wed, Jul 10, 2013 at 4:48 PM, Alberto G. Corona agocor...@gmail.comwrote: Thanks Adrian. The racket people where pioneers in this idea I think. There is another web framework in Ocaml, Osigen that it is also continuation based. MFlow is not continuation-based but it also define the navigation as a sequence. But only Seaside (and now MFlow) supports many flows in the same page. See for example this: [PDF] *Seaside* – A *Multiple* Control *Flow* Web Application Frameworkhttp://www.google.es/url?sa=trct=jq=esrc=sfrm=1source=webcd=3cad=rjaved=0CEwQFjACurl=http%3A%2F%2Fscg.unibe.ch%2Farchive%2Fpapers%2FDuca04eSeaside.pdfei=WnPdUYHPI-Ly7Aaa0oHQDAusg=AFQjCNFxwsFQc9QsQCNPRFfD4t6ReQtP5gsig2=_klwtzxIKW5UzAOUDOvFCw There is also other: Apache Coccoon that run in a special kind of JavaScript. The continuation-based frameworks have the reputation of storing a lot of application state and to be non scalable. MFlow uses backtracking and It does not have these problems. 2013/7/10 Adrian May adrian.alexander@gmail.com Oh how nice! I have been looking at MFlow a lot lately and I think it's got something quite special that Yesod, Happstack, etc don't seem to have, at least, not as far as I know. I mean, look at this: sumWidget= pageFlow sum $ do n1 - p Enter first number ++ getInt Nothing ** submitButton enter ++ br n2 - p Enter second number ++ getInt Nothing ** submitButton enter ++ br n3 - p Enter third number ++ getInt Nothing ** submitButton enter ++ br p (The result is: ++show (n1 + n2 + n3)) ++ wlink () b menu ++ p you can change the numbers in the boxes to see how the result changes Is that pretty or what? That's the code for this: http://mflowdemo.herokuapp.com/noscript/fviewmonad To me that's a real technological step over and above the usual servlets paradigm and I'd love to see more people getting involved. It seems like Yesod and Happstack have a lot more manpower behind them, but unless I've missed something, MFlow is going somewhere new and should be helped along. Adrian. PS. Besides Seaside, Racket is playing with the same ideas. They (Jay McCarthy) have something to say about performance but I didn't quite understand it. On 10 July 2013 06:41, Alberto G. Corona agocor...@gmail.com wrote: The third version of MFlow is out. http://hackage.haskell.org/package/MFlow MFlow is an all-heterodox web application framework, but very haskellish. Now MFlow support restful URLs. It is the first stateful web framework to my knowledge that supports it. The type safe routes are implicitly expressed as normal monadic code within a navigation monad. The application look as a normal imperative console application, but the navigation monad goes back and forth to match the path of the URL. The user has control of the state, that can roll-back or not when the navigation goes back depending on the application needs. The state is in the form of normal Haskell variables In a monadic computation, with the weird addition of backtracking. The menu of the application below is implemented as an imperative-like syntax, but the application navigate forward and backward to synchronize with the requests of the web browser: http://mflowdemo.herokuapp.com/ This version support in-page flows. What is that? look at this example: http://mflowdemo.herokuapp.com/noscript/fviewmonad These flows are implemented as formlets with a monad instance, and callbacks which change the look. I call them widgets: http://haskell-web.blogspot.com.es/2013/06/the-promising-land-of-monadic-formlets.html Each page may have many of these active widgets, each one running their own flow. These widgets refresh themselves trough Ajax if they are enclosed
[Haskell-cafe] ANNOUNCE: MFlow 3.0
The third version of MFlow is out. http://hackage.haskell.org/package/MFlow MFlow is an all-heterodox web application framework, but very haskellish. Now MFlow support restful URLs. It is the first stateful web framework to my knowledge that supports it. The type safe routes are implicitly expressed as normal monadic code within a navigation monad. The application look as a normal imperative console application, but the navigation monad goes back and forth to match the path of the URL. The user has control of the state, that can roll-back or not when the navigation goes back depending on the application needs. The state is in the form of normal Haskell variables In a monadic computation, with the weird addition of backtracking. The menu of the application below is implemented as an imperative-like syntax, but the application navigate forward and backward to synchronize with the requests of the web browser: http://mflowdemo.herokuapp.com/ This version support in-page flows. What is that? look at this example: http://mflowdemo.herokuapp.com/noscript/fviewmonad These flows are implemented as formlets with a monad instance, and callbacks which change the look. I call them widgets: http://haskell-web.blogspot.com.es/2013/06/the-promising-land-of-monadic-formlets.html Each page may have many of these active widgets, each one running their own flow. These widgets refresh themselves trough Ajax if they are enclosed in the primitive autoRefresh. If there is no Ajax or JavaScript available, they gracefully degrade by refreshing the entire page: http://mflowdemo.herokuapp.com/noscript/combination http://haskell-web.blogspot.com.es/2013/06/and-finally-widget-auto-refreshing.html The page flows and the multiflow idea was inspired in Seasidehttp://www.seaside.st/, a great Smalltalk web framework and adapted to the pure recursive nature of Haskell and the formlets. It also support some JQuery widgets integrated: modal and not modal dialogs, datePicker and other active widgets that handle other widgets. It also support the older features: persistent state, WAI, blaze-html and others integration, server process timeouts, Ajax, requirements, content management, caching of widget rendering and all the other previous stuff. I wish to thank some people for their feedback. Specially Adrian May for his feedback and interest -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [web-devel] The promising world of Monadic formlets
I have a similar problema with the ids of formlets of different branches of execution. For example in the first case statement the branch represented can be one or the other depending on the previous user response. The identifiers of each branch must be different or else, the server application will be confused by misreading states (values in my case) of different branches. For this purpose each branch has a pageflow call that add a new prefix to the identifiers and initialize a counter used to compose a sequence of suffixes for each branch, so that each element has an unique identifier and the identifiers of one branch do not collide with the ones of the other branch. Is this similar and hopefully applicable to your problema? 2013/6/22 Anton Tayanovskyy anton.tayanovs...@gmail.com Our team at IntelliFactory has worked with monadic formlets for a while, we call them flowlets, in the context of WebSharper/F#. We even have an obscure paper out there about it. The difference with your approach is that we are working directly with DOM nodes and imperative widgets to execute entirely in the browser in JavaScript. This makes for nice looking demos, but unfortunately comes with a price. With imperative widgets, identity matters. If you work with console text output or re-creating an HTML document, you simply model what you present to the user with a tree, with inductively defined equivalence. In DOM world, however, two HTML trees with an input textbox may serialize equivalently but be distinct, in a sense that the textboxes have distinct identity and hidden state (such as focus), and substituting one for another will be noticed by the user. To this day I have not been able to come up with a convincing simple model and a notion of equivalence that would take that into account and allow to prove monadic laws to hold for the flowlet combinators. I suspect it should be possible though and even likely done already :) Thanks, --A On Sat, Jun 22, 2013 at 12:49 AM, Daniel Frumin difru...@gmail.comwrote: This looks interesting. I'll be following the development of it On Jun 20, 2013, at 2:56 PM, Alberto G. Corona agocor...@gmail.com wrote: Here is the example with better rendering and additional information as well as some identifies issues to be solved. http://haskell-web.blogspot.com.es/2013/06/the-promising-land-of-monadic-formlets.html And I made strong statements there. What do you think? If you have questions or want to be involved in the development of this and other related concepts, please send me a message. 2013/6/20 Alberto G. Corona agocor...@gmail.com I don´t know how, but the google mail has changed the applicative functor operator after (,) Left and Rigth by -. 2013/6/19 Alberto G. Corona agocor...@gmail.com Hi, This is just to let you know the promising results of some experimentation: Formlets are about applicative instances, but what about monadic instances? What a Monad instance of formlets means? I recently experimented with this and the results are very interesting and powerful- It mixes the best of web forms, with the flexibility of console applications. ???!! Althoug this example is for the formlets of the MFlow https://github.com/agocorona/MFlowframework , it can be ported to other formlet implementations. Although the MFLow formlets include web formatting that is not supported in other formlets implementations. Static HTML templating don´t work well with monadic formlets, so it is important to include the formatting as a part of the computation: import MFlow.Wai.Blaze.Html.All dynamicForm= wform $ do (n,s) - (,) - p Who are you? ++ getString Nothing ! hint name ++ br * getString Nothing ! hint surname ++ br ** submitButton ok ++ br flag - b do you ++ getRadio[radiob work?,radiob study?] ++ br r-case flag of work - pageFlow l $ Left - b do you enjoy your work? ++ getBool True yes no ** submitButton ok ++ br study- pageFlow r $ Right - b do you study in ++ getRadio[radiob University ,radiob High School] p (You are ++n++ ++s) ++ case r of Left fl - p (You work and it is ++ show fl ++ that you enjoy your work) ++ noWidget Right stu - p (You study at the ++ stu) ++ noWidget hint s= [(placeholder,s)] onClickSubmit= [(onclick,this.form.submit())] radiob s n= text s ++ setRadio s n ! onClickSubmit Here wform, getBool, getString , getRadio etc are formlet elements The first sentence is an applicative composition that generate a 2 tuple, to show that applicative and monadic can be mixed. the operations ++ add
Re: [Haskell-cafe] The promising world of Monadic formlets
Here is the example with better rendering and additional information as well as some identifies issues to be solved. http://haskell-web.blogspot.com.es/2013/06/the-promising-land-of-monadic-formlets.html And I made strong statements there. What do you think? If you have questions or want to be involved in the development of this and other related concepts, please send me a message. 2013/6/20 Alberto G. Corona agocor...@gmail.com I don´t know how, but the google mail has changed the applicative functor operator after (,) Left and Rigth by -. 2013/6/19 Alberto G. Corona agocor...@gmail.com Hi, This is just to let you know the promising results of some experimentation: Formlets are about applicative instances, but what about monadic instances? What a Monad instance of formlets means? I recently experimented with this and the results are very interesting and powerful- It mixes the best of web forms, with the flexibility of console applications. ???!! Althoug this example is for the formlets of the MFlow https://github.com/agocorona/MFlowframework , it can be ported to other formlet implementations. Although the MFLow formlets include web formatting that is not supported in other formlets implementations. Static HTML templating don´t work well with monadic formlets, so it is important to include the formatting as a part of the computation: import MFlow.Wai.Blaze.Html.All dynamicForm= wform $ do (n,s) - (,) - p Who are you? ++ getString Nothing ! hint name ++ br * getString Nothing ! hint surname ++ br ** submitButton ok ++ br flag - b do you ++ getRadio[radiob work?,radiob study?] ++ br r-case flag of work - pageFlow l $ Left - b do you enjoy your work? ++ getBool True yes no ** submitButton ok ++ br study- pageFlow r $ Right - b do you study in ++ getRadio[radiob University ,radiob High School] p (You are ++n++ ++s) ++ case r of Left fl - p (You work and it is ++ show fl ++ that you enjoy your work) ++ noWidget Right stu - p (You study at the ++ stu) ++ noWidget hint s= [(placeholder,s)] onClickSubmit= [(onclick,this.form.submit())] radiob s n= text s ++ setRadio s n ! onClickSubmit Here wform, getBool, getString , getRadio etc are formlet elements The first sentence is an applicative composition that generate a 2 tuple, to show that applicative and monadic can be mixed. the operations ++ add html to the formlet. the operatior ! add attributes to the formlet element.. noWidget is a dumb formlet that does not validate. The second monadic statement is an election between two options. The beauty of the monadic instance is that the rest of the form can vary depending on the previous answers. Since the formlets validate the input, unless the election is made, the radio will not validate, so the monadic execution will be aborted beyond any unanswered question, so nothing will appear after the question. The rest of the form will appear when the user choose one of the two options. once one or the other option is chosen, then another binary question is presented. (either he likes his work or where he study). When the questions are finised, the results are presented. I hope that you get the idea. The benefit is not only the familiar coding and presentation of a sequential console application: Since the form encloses all the fields, At any time the user can change previous inputs and the form will reflect these changes. For example if the user change from work to study (second statements) the where do you study will appear and the work related questions and answers will disappear. That is wonderfully useful for heavily interactive applications. There is a problem however and it is the issue of the formlet identifiers. Unlike in an applicative presentation, now the number and type of the formlets will vary, so the response to a previous form create a new kind of form, and the post response can be misinterpreted. To avoid that , the pageFlow call creates fixed field labels for each branch of execution. I will release a version of MFlow that support this kind of monadic composition of fomlets, but In essence it is nothing but to add Monad instance to formlets. A single server procedure, that executes the formlet code can support all the interaction so any framework can do it. The usability of that is huge:It is possible to interact in a web page in a console style with questions and answers with the versatitly of a dynamic foms: Any modification in the form change the subsequent flow of interaction. Another application of this monadic
[Haskell-cafe] The promising world of Monadic formlets
Hi, This is just to let you know the promising results of some experimentation: Formlets are about applicative instances, but what about monadic instances? What a Monad instance of formlets means? I recently experimented with this and the results are very interesting and powerful- It mixes the best of web forms, with the flexibility of console applications. ???!! Althoug this example is for the formlets of the MFlow https://github.com/agocorona/MFlowframework , it can be ported to other formlet implementations. Although the MFLow formlets include web formatting that is not supported in other formlets implementations. Static HTML templating don´t work well with monadic formlets, so it is important to include the formatting as a part of the computation: import MFlow.Wai.Blaze.Html.All dynamicForm= wform $ do (n,s) - (,) - p Who are you? ++ getString Nothing ! hint name ++ br * getString Nothing ! hint surname ++ br ** submitButton ok ++ br flag - b do you ++ getRadio[radiob work?,radiob study?] ++ br r-case flag of work - pageFlow l $ Left - b do you enjoy your work? ++ getBool True yes no ** submitButton ok ++ br study- pageFlow r $ Right - b do you study in ++ getRadio[radiob University ,radiob High School] p (You are ++n++ ++s) ++ case r of Left fl - p (You work and it is ++ show fl ++ that you enjoy your work) ++ noWidget Right stu - p (You study at the ++ stu) ++ noWidget hint s= [(placeholder,s)] onClickSubmit= [(onclick,this.form.submit())] radiob s n= text s ++ setRadio s n ! onClickSubmit Here wform, getBool, getString , getRadio etc are formlet elements The first sentence is an applicative composition that generate a 2 tuple, to show that applicative and monadic can be mixed. the operations ++ add html to the formlet. the operatior ! add attributes to the formlet element.. noWidget is a dumb formlet that does not validate. The second monadic statement is an election between two options. The beauty of the monadic instance is that the rest of the form can vary depending on the previous answers. Since the formlets validate the input, unless the election is made, the radio will not validate, so the monadic execution will be aborted beyond any unanswered question, so nothing will appear after the question. The rest of the form will appear when the user choose one of the two options. once one or the other option is chosen, then another binary question is presented. (either he likes his work or where he study). When the questions are finised, the results are presented. I hope that you get the idea. The benefit is not only the familiar coding and presentation of a sequential console application: Since the form encloses all the fields, At any time the user can change previous inputs and the form will reflect these changes. For example if the user change from work to study (second statements) the where do you study will appear and the work related questions and answers will disappear. That is wonderfully useful for heavily interactive applications. There is a problem however and it is the issue of the formlet identifiers. Unlike in an applicative presentation, now the number and type of the formlets will vary, so the response to a previous form create a new kind of form, and the post response can be misinterpreted. To avoid that , the pageFlow call creates fixed field labels for each branch of execution. I will release a version of MFlow that support this kind of monadic composition of fomlets, but In essence it is nothing but to add Monad instance to formlets. A single server procedure, that executes the formlet code can support all the interaction so any framework can do it. The usability of that is huge:It is possible to interact in a web page in a console style with questions and answers with the versatitly of a dynamic foms: Any modification in the form change the subsequent flow of interaction. Another application of this monadic style is to ease multistep processes such are registration, check-out and payment ad so on. Even a entire interactive dynamic application can be coded in a single page. And no javascript is needed!. To run this formlet in MFlow: main=do addMessageFlows [(, transient $ runFlow $ ask dynamicForm )] wait $ run port waiMessageFlow This video show how the presentation of this example vary with the user input: http://youtu.be/DryBQc9agFg I hope that you find the idea interesting. If you want to experiment with this in MFlow, I have to say that the implementation of this feature is in an early stage. The code is in the head branch
Re: [Haskell-cafe] The promising world of Monadic formlets
I don´t know how, but the google mail has changed the applicative functor operator after (,) Left and Rigth by -. 2013/6/19 Alberto G. Corona agocor...@gmail.com Hi, This is just to let you know the promising results of some experimentation: Formlets are about applicative instances, but what about monadic instances? What a Monad instance of formlets means? I recently experimented with this and the results are very interesting and powerful- It mixes the best of web forms, with the flexibility of console applications. ???!! Althoug this example is for the formlets of the MFlow https://github.com/agocorona/MFlowframework , it can be ported to other formlet implementations. Although the MFLow formlets include web formatting that is not supported in other formlets implementations. Static HTML templating don´t work well with monadic formlets, so it is important to include the formatting as a part of the computation: import MFlow.Wai.Blaze.Html.All dynamicForm= wform $ do (n,s) - (,) - p Who are you? ++ getString Nothing ! hint name ++ br * getString Nothing ! hint surname ++ br ** submitButton ok ++ br flag - b do you ++ getRadio[radiob work?,radiob study?] ++ br r-case flag of work - pageFlow l $ Left - b do you enjoy your work? ++ getBool True yes no ** submitButton ok ++ br study- pageFlow r $ Right - b do you study in ++ getRadio[radiob University ,radiob High School] p (You are ++n++ ++s) ++ case r of Left fl - p (You work and it is ++ show fl ++ that you enjoy your work) ++ noWidget Right stu - p (You study at the ++ stu) ++ noWidget hint s= [(placeholder,s)] onClickSubmit= [(onclick,this.form.submit())] radiob s n= text s ++ setRadio s n ! onClickSubmit Here wform, getBool, getString , getRadio etc are formlet elements The first sentence is an applicative composition that generate a 2 tuple, to show that applicative and monadic can be mixed. the operations ++ add html to the formlet. the operatior ! add attributes to the formlet element.. noWidget is a dumb formlet that does not validate. The second monadic statement is an election between two options. The beauty of the monadic instance is that the rest of the form can vary depending on the previous answers. Since the formlets validate the input, unless the election is made, the radio will not validate, so the monadic execution will be aborted beyond any unanswered question, so nothing will appear after the question. The rest of the form will appear when the user choose one of the two options. once one or the other option is chosen, then another binary question is presented. (either he likes his work or where he study). When the questions are finised, the results are presented. I hope that you get the idea. The benefit is not only the familiar coding and presentation of a sequential console application: Since the form encloses all the fields, At any time the user can change previous inputs and the form will reflect these changes. For example if the user change from work to study (second statements) the where do you study will appear and the work related questions and answers will disappear. That is wonderfully useful for heavily interactive applications. There is a problem however and it is the issue of the formlet identifiers. Unlike in an applicative presentation, now the number and type of the formlets will vary, so the response to a previous form create a new kind of form, and the post response can be misinterpreted. To avoid that , the pageFlow call creates fixed field labels for each branch of execution. I will release a version of MFlow that support this kind of monadic composition of fomlets, but In essence it is nothing but to add Monad instance to formlets. A single server procedure, that executes the formlet code can support all the interaction so any framework can do it. The usability of that is huge:It is possible to interact in a web page in a console style with questions and answers with the versatitly of a dynamic foms: Any modification in the form change the subsequent flow of interaction. Another application of this monadic style is to ease multistep processes such are registration, check-out and payment ad so on. Even a entire interactive dynamic application can be coded in a single page. And no javascript is needed!. To run this formlet in MFlow: main=do addMessageFlows [(, transient $ runFlow $ ask dynamicForm )] wait $ run port waiMessageFlow This video show how the presentation of this example vary with the user input
Re: [Haskell-cafe] (no subject)
I have ever wondered how a committee could have made Haskell. My conclusion is the following: For one side there were many mathematicians involved, the authors of the most terse language(s) existent: the math notation. For the other, the lemma avoid success at all costs which kept the committee away of pressures for doing it quick and dirty and also freed it from deleterious individualities 2013/6/10 Tobias Dammers tdamm...@gmail.com On Mon, Jun 10, 2013 at 05:41:05PM +0530, Zed Becker wrote: Haskell, is arguably the best example of a design-by-committee language. You do realize that design-by-committee is generally understood to refer to the antipattern where a committee discusses a design to death and delivers an inconsistent, mediocre spec, as opposed to a situation where a leader figure takes the loose ends, runs with them, and turns them into a coherent, inspiring whole? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] voting sytem DSL
In the package Workflow there is a DSL for workflow patterns that include a very broad notion of voting using monoids. The other workflow combinators resemble a lot the async package, but applied to workflows. Maybe you can draw something from that to construct higuer level votation DSL. The reason to use the workflow monad is because during a votation process there may be machine failures. Decisions with various votation steps can stay running for months, so it is necessary to save and recover the state of the computation. http://hackage.haskell.org/packages/archive/Workflow/0.8. 0.5/doc/html/Control-Workflow-Patterns.HTML 2013/6/5 AlanKim Zimmerman alan.z...@gmail.com Have you looked at http://frictionfreedemocracy.org/ They are using https://github.com/agocorona/Workflow amongst other things to define election work flows. Alan On Jun 5, 2013 11:25 PM, Corentin Dupont corentin.dup...@gmail.com wrote: Hi haskellers! I am trying to make a DSL able to describe a voting system. That DSL should be able to describe many different voting procedures: unanimity or majority, open or secret ballot, one or two turns... It should also work for referendums (yes/no question) or elections (electing one or several people)... Are you aware of any such DSL? In Haskell I haven't see it, maybe in another language? Cheers, Corentin ___ 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 -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] HTML framework for web-ui
If you like to create a stand alone application I know that happstack was created for stand-alone applications with no database, although Yesod and Snap can do it as well. If your application is a-single-page-doit-all by using a lot of JavaScript (or Fay) , then any of these restful frameworks will work well. In the other side, if you application has different pages and need to manage state in the server, then you may consider MFlow . It can make things easier a lot. The application flow is codified just like in a console application. It uses formlets, blaze-html and WAI-warp http://hackage.haskell.org/package/MFlow you can find examples here: http://haskell-web.blogspot.com.es/ 2013/5/21 Vlatko Basic vlatko.ba...@gmail.com Hi, I'd like to start using web pages as the UI for apps. I found out for yesod, snapp and happstack as the candidates. Would you recommend any of them as better for app ui (not classical web pages)? Or maybe another one? thanks, vlatko __**_ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/**mailman/listinfo/haskell-cafehttp://www.haskell.org/mailman/listinfo/haskell-cafe -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Propositions in Haskell
Not exactly what you ask, but it is noteworthy that the mind has different logic processors. The fastest one work with IF THEN ELSE rules applied specifically to deals. This is why your example (and most examples of logic) involves a kind of deal expressed in the first person. This trigger a fast mental evaluation, while an equivalent but more general case is harder to process and need some paper work. (That special treatment of first person deals logic respond to the need to detect breaks of deals as fast as possible) http://en.wikipedia.org/wiki/Wason_selection_task That's why higher level languages have redundant logical structures and do not follow a general abstract and short mathematical notation. Therefore higher level, in programming languages, does not mean higher mathematical abstraction, but to be closer to the way the mind works. 2013/5/15 Patrick Browne patrick.bro...@dit.ie -- Hi -- I am trying to show that a set of propositions and a conclusion the form a valid argument. -- I used two approaches; 1) using if-then-else, 2) using pattern matching. -- The version using if-then-else seems to be consistent with my knowledge of Haskell and logic (either of which could be wrong). -- Can the second approach be improved to better reflect the propositions and conclusion? Maybe type level reasoning could be used? -- -- Valid argument? -- 1. I work hard or I play piano -- 2. If I work hard then I will get a bonus -- 3. But I did not get a bonus -- Therefore I played piano -- Variables: p = Piano, w = worked hard, b = got a bonus --(w \/ p) /\ (w = b) /\ ¬(b) -- --- --p -- First approach using language control structure if-then-else w, p, b::Bool -- Two equivalences for (w \/ p) as an implication. -- 1. (w \/ p) =equivalent-to= (not p) = w -- 2. (w \/ p) =equivalent-to= (not w) = p -- Picked 2 p = if (not w) then True else False -- Contrapositive: (w = b) =equivalent-to= ~b = ~w w = if (not b) then False else True b = False -- gives p is true and w is false -- Second approach using pattern matching -- I think the rewriting goes from left to right but the logical inference goes in the opposite direction. w1, p1, b1::Bool p1 = (not w1) w1 = b1 -- Not consistent with statements, but I do not know how to write ~b1 = ~w1 in Haskell b1 = False -- Again gives p1 is true and w1 is false Tá an teachtaireacht seo scanta ó thaobh ábhar agus víreas ag Seirbhís Scanta Ríomhphost de chuid Seirbhísí Faisnéise, ITBÁC agus meastar í a bheith slán. http://www.dit.ie This message has been scanned for content and viruses by the DIT Information Services E-Mail Scanning Service, and is believed to be clean. http://www.dit.ie ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] I wish cabal-dev to travel back in time
Hi Café: I created just now an issue in cabal-dev: https://github.com/creswick/cabal-dev/issues/101 When compiling old developments, I wish cabal-dev to install and build dependencies that were available at a that time I don't know if there are alternatives to solving this issue. I think that this is very useful and necessary, specially now when library updates are increasingly frequent. Maybe this problem is already solved and I just don´t know (as is often the case, for example when, in a sudden aha moment, I reinvented cabal-install months after the release). That is the reason why I tell you about it here in order to discuss it. motivation: I´m installing now an old soft development. Since many of my dependencies were labeled with -any or with , neither I neither cabal know which library versions are the right ones. By taking into account a date parameter, cabal-dev can figure out which libraries were the latest and the right ones at that time. -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Fwd: Backward compatibility
The case of WASH is a pity. Architecturally It was more advanced that many recent haskell web frameworks. The package would have been a success with little changes in the DSL syntax. I suspect that there are many outstanding packages with great ideas abandoned, like WASH 2013/5/5 Brandon Allbery allber...@gmail.com On Sun, May 5, 2013 at 7:55 AM, Raphael Gaschignard dasur...@gmail.comwrote: Forgive me if I'm wrong, but I feel like I've seen such suggestions in GHC errors before. If so, does that mean there's some sort of mechanism in the compiler already in place for such error recognition? Like some simple pattern stuff? If not, I think that it might not be bad to consider this stuff (misused packaged, changed semantics that create compiler errors), and to put something into place for future modifications. This could make it a lot easier to deal with unmaintained code. There's some very limited capability now; the GHC folks are tossing around ideas for something more general like that. -- brandon s allbery kf8nh sine nomine associates allber...@gmail.com ballb...@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Follow up on type error diagnosis for DSLs in Haskell
Jurriaan: That is very good news for the people that create DSLs for industry, for haskell teaching and in general for the Haskell comunity. For a context, I add here the ticket http://hackage.haskell.org/trac/ghc/ticket/7870 and the discussion: https://groups.google.com/forum/?fromgroups#!topic/haskell-cafe/PrPtjw5GsHI Thanks Alberto 2013/5/5 Jurriaan Hage j.h...@uu.nl Dear all (and in particular Alberto G. Corona and Stephen Tetley), First of all, thanks Stephen for pointing out our work to Alberto. Second, you may be interested to know that I just (as in two weeks ago) obtained a grant to hire a PhD student to scale the work of the ICFP '03 paper (as mentioned by Stephen) up to Haskell 2011 (or whatever variant will be appropriate). The plan is to first prototype this work in the UHC compiler, and, if succesful, build it into the GHC. I shall surely send out a job vancancy on some of the Haskell mailing lists. best, Jurriaan Hage -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Fwd: Backward compatibility
Well, the main one is that is in the group of continuation based frameworks, like other advanced web frameworks such are seaside (smalltalk) ocsigen (ocaml) or coccoon (JavaScript) . That means that it is not based on the event model, and the flow is in a single procedure. This makes the navigation much more readable, as a console application. But WASH is not continuation based, but log based, and the log was stored in the client, that means that it was also restful to a certain level. That approach solved the big problems of memory usage and serialization of continuation based frameworks. It also solved the problem of form safety before the development of formlets and the widespread of applicative functors. But I do not pretend to resucitate WASH. I just miss a continuation of this line of work , but this was not the case. I took a deeper look at WASH after developping MFlow, years after the discontinuation of WASH. MFlow coincidentally, is log based in a different way. I supposed that it was based on continuations, and I didn't like them, but it was not. If the project would have been prosecuted, who knows...It had a edge over other web developments in other languages, but it was hard to understand, just because the approach was original and unique. I consider MFlow as a continuation of WASH in philosophical terms. 2013/5/6 Tom Ellis tom-lists-haskell-cafe-2...@jaguarpaw.co.uk On Sun, May 05, 2013 at 10:46:23PM +0200, Alberto G. Corona wrote: The case of WASH is a pity. Architecturally It was more advanced that many recent haskell web frameworks. The package would have been a success with little changes in the DSL syntax. Could you briefly summarise the difference between WASH's approach and that of the more recent frameworks? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] A three page web application in a tweet (in Haskell)
Hi, Just to share my excitement with you: https://twitter.com/AGoCorona/status/329648864082677760 See the link in the tweet for an explanation Best Regards, -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell compilation errors break the complexity encapsulation on DSLs
I hope that the GHC people will give to this a high priority. Specially for the people of FP Complete for which this should be a first target. I know that Simon Peyton Jones gave up in avoid success at all costs and not it invest in the industry. Isn't? Alberto - frictionfreedemocracy.org 2013/4/27 Ozgur Akgun ozgurak...@gmail.com Hi, On 27 April 2013 10:07, Alberto G. Corona agocor...@gmail.com wrote: I created a ticket for the feature request: Ticket #7870 Teachers, newbies and people working in Industry: Please push it! A link to the ticket may be helpful for the lazy. http://hackage.haskell.org/trac/ghc/ticket/7870 I quite like this idea, and I think this is one thing people use TH for now instead. (Using quasi-quotes, you can produce any compilation error you like...) It would be great if we didn't have to pull in the full power of TH (or QQ) for this. Cheers, Ozgur -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell compilation errors break the complexity encapsulation on DSLs
I created a ticket for the feature request: Ticket #7870 Teachers, newbies and people working in Industry: Please push it! 2013/4/24 Alberto G. Corona agocor...@gmail.com Maybe it is possible to do something In a google summer of code. Nothing as sophisticated as the Helium paper (Scripting the Type Inference Process, but maybe a partial implementation of the techniques mentioned, so that the development can be enhanced in the future. Maybe some kind of library that permits postprocessing of GHC errors and/or the identification of points in the current type checker where some kind of rules can be defined by the programmer can be the first step. 2013/4/23 Brent Yorgey byor...@seas.upenn.edu On Tue, Apr 23, 2013 at 12:49:59PM +0200, Alberto G. Corona wrote: Hi I ever was worried about the barrier that the complexity of the Haskell errors impose to users of DSLs. Many DSLs look so simple that even someone without knowledge of Haskell can make use of them for some domains. However when the program is compiled then al the monsters of the deep appear in the surface: polymorphisms, undefined instances, type errors reported in a line produced by a type assumption in another, etc. This is a problem for an industrial use of Haskell in the large scale. For obvious reasons. Indeed. For example, in my experience this is a big problem for diagrams. The question: Is it possible to develop a GHC extension that attach (or prepend) such an explanation to the ghc error? Or any other alternative that carry out the same functionality. Surely it is possible. I have wanted this too. I guess the majority of the work would just be in coming up with a good, general design which is useful but not too difficult to implement. If anyone wanted to undertake such a project I would be happy to contribute some ideas. -Brent ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Alberto. -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell compilation errors break the complexity encapsulation on DSLs
Maybe it is possible to do something In a google summer of code. Nothing as sophisticated as the Helium paper (Scripting the Type Inference Process, but maybe a partial implementation of the techniques mentioned, so that the development can be enhanced in the future. Maybe some kind of library that permits postprocessing of GHC errors and/or the identification of points in the current type checker where some kind of rules can be defined by the programmer can be the first step. 2013/4/23 Brent Yorgey byor...@seas.upenn.edu On Tue, Apr 23, 2013 at 12:49:59PM +0200, Alberto G. Corona wrote: Hi I ever was worried about the barrier that the complexity of the Haskell errors impose to users of DSLs. Many DSLs look so simple that even someone without knowledge of Haskell can make use of them for some domains. However when the program is compiled then al the monsters of the deep appear in the surface: polymorphisms, undefined instances, type errors reported in a line produced by a type assumption in another, etc. This is a problem for an industrial use of Haskell in the large scale. For obvious reasons. Indeed. For example, in my experience this is a big problem for diagrams. The question: Is it possible to develop a GHC extension that attach (or prepend) such an explanation to the ghc error? Or any other alternative that carry out the same functionality. Surely it is possible. I have wanted this too. I guess the majority of the work would just be in coming up with a good, general design which is useful but not too difficult to implement. If anyone wanted to undertake such a project I would be happy to contribute some ideas. -Brent ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Instances for continuation-based FRP
If you are not looking for the full reactive formalism but to treat event driven applications in a procedural ,sequential, imperative way (whatever you may call it) by means o continuations, then this is a good paper in the context of web applications: inverting back the inversion of control http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.29.3112 2013/4/24 Conal Elliott co...@conal.net Hi Hans. I'm delighted to hear that you have a precise denotation to define correctness of your implementation. So much of what gets called FRP these days abandons any denotational foundation, as well as continuous time, which have always been the two key properties of FRPhttp://stackoverflow.com/a/5878525/127335for me. I like your goal of finding a provably correct (perhaps correct by construction/derivation) implementation of the simple denotational semantics. I'm happy to give feedback and pointers if you continue with this goal. While I like the idea of TCMs very much, they do not seem to be applicable for things that lack a denotation, such as IO I suppose so, although I'd say it the other way around: things that lack denotation are not applicable for fulfilling denotational principles. Which suggests to me that IO will not get you to your goal. Instead, I recommend instead looking for a subset of imperative computation that suffices to implement the denotation you want, but is well-defined denotationally and tractable for reasoning. IO (general imperative computation) is neither, which is why we have denotative/functional programming in the first place. Regards, - Conal On Wed, Apr 24, 2013 at 8:31 AM, Hans Höglund h...@hanshoglund.se wrote: Hi Conal, Thank you for replying. My aim is to find the simplest possible implementation of the semantics you describe in Push-pull FRP http://conal.net/papers/push-pull-frp/, so the denotational semantics are already in place. I guess what I am looking for is a simple translation of a denotational program into an imperative one. My intuition tells me that such a translation is possible, maybe even trivial, but I am not sure how to reason about correctness. While I like the idea of TCMs very much, they do not seem to be applicable for things that lack a denotation, such as IO. Maybe it is a question of how to relate denotational semantics to operational ones? Hans On 24 apr 2013, at 02:18, Conal Elliott wrote: Hi Hans, Do you have a denotation for your representation (a specification for your implementation)? If so, it will likely guide you to exactly the right type class instances, via the principle of type class morphismshttp://conal.net/papers/type-class-morphisms/(TCMs). If you don't have a denotation, I wonder how you could decide what correctness means for any aspect of your implementation. Good luck, and let me know if you want some help exploring the TCM process, -- Conal On Tue, Apr 23, 2013 at 6:22 AM, Hans Höglund h...@hanshoglund.sewrote: Hi everyone, I am experimenting with various implementation styles for classical FRP. My current thoughts are on a continuation-style push implementation, which can be summarized as follows. newtype EventT m r a= E { runE :: (a - m r) - m r - m r } newtype ReactiveT m r a = R { runR :: (m a - m r) - m r } type Event= EventT IO () type Reactive = ReactiveT IO () The idea is that events allow subscription of handlers, which are automatically unsubscribed after the continuation has finished, while reactives allow observation of a shared state until the continuation has finished. I managed to write the following Applicative instance instance Applicative (ReactiveT m r) where pure a = R $ \k - k (pure a) R f * R a = R $ \k - f (\f' - a (\a' - k $ f' * a')) But I am stuck on finding a suitable Monad instance. I notice the similarity between my types and the ContT monad and have a feeling this similarity could be used to clean up my instance code, but am not sure how to proceed. Does anyone have an idea, or a pointer to suitable literature. Best regards, Hans ___ 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 -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Haskell compilation errors break the complexity encapsulation on DSLs
Hi I ever was worried about the barrier that the complexity of the Haskell errors impose to users of DSLs. Many DSLs look so simple that even someone without knowledge of Haskell can make use of them for some domains. However when the program is compiled then al the monsters of the deep appear in the surface: polymorphisms, undefined instances, type errors reported in a line produced by a type assumption in another, etc. This is a problem for an industrial use of Haskell in the large scale. For obvious reasons. I would like to know 1) which techniques are used to minimize the problem 2) To suggest some kind of extension that would allow for example to add extra information to the error messages by the library developer.. For example, in http://hackage.haskell.org/packages/archive/control-monad-exception/0.10.3.1/doc/html/Control-Monad-Exception.html There is a nice documentation about two kind of errors that are frequent when using that library: *A type error of the form: * *No instance for (UncaughtException MyException) arising from a use of `g' at examples/docatch.hs:21:32-35 Possible fix: add an instance declaration for (UncaughtException MyException) In the expression: g ()* *is the type checker saying: * *hey, you are trying to run a computation which throws a MyExceptionwithout handling it, and I won't let you * *Either handle it or declare MyException as an UncaughtExceptionhttp://hackage.haskell.org/packages/archive/control-monad-exception/0.10.3.1/doc/html/Control-Monad-Exception.html#t:UncaughtException. * The question: Is it possible to develop a GHC extension that attach (or prepend) such an explanation to the ghc error? Or any other alternative that carry out the same functionality. -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell compilation errors break the complexity encapsulation on DSLs
Stephen The paper is very interesting. We need something like that: ... As a result, the beginning programmer is likely to be discouraged from pro-gramming in a functional language, and may see the rejection of programs as a nuisance instead of a blessing. The experienced user might not look at the messages at all. *The problem is exacerbated in the case of combinator languages. Combinator languages are a means of defining domain specific lan-guages embedded within an existing programming language, using the abstraction facilities present in the latter. However, since the domain specific extensions are mapped to constructs present in the underlying language, all type errors are reported in terms of the host language, and not in terms of concepts from the combinator library. In addition, the developer of a combinator library may be aware of various mistakes which users of the library can make, something which he can explain in the documentation for the library, but which he cannot make part of the library itself.* In the meantime maybe we can have a simpler solution like a postprocessing of errors in some way 2013/4/23 Stephen Tetley stephen.tet...@gmail.com Helium - Utrecht University's simplified Haskell - had scriptable Type inference directives so the creator of an EDSL was able to augment the type checker to provide better error messages, see: Scripting the Type Inference Process Bastiaan Heeren Jurriaan Hage S. Doaitse Swierstra ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE: monoid-subclasses-0.1.1, incremental-parser-0.2.2, and SCC-0.8
Thanks The cancelative monoid is the right class for rolling back transactions, by the way. 2013/3/22 Mario Blažević blama...@acanac.net 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, containers, bytestring, and text packages. These classes were initially a part of the incremental-parser package [2] but they've moved, so incremental-parser-0.2.2 now depends on monoid-subclasses which has added more class methods and instances. The parsers constructed using the incremental-parser library generally work on any ReductiveMonoid, FactorialMonoid or TextualMonoid. You can thus construct a generic parser that operates on String, ByteString, or Text input, or even on Product Integer or a Map if you are so inclined. The version 0.8 of Streaming Component Combinators (a.k.a. SCC) has also been re-designed from the ground up. In the earlier versions, as in the pipes and conduit packages, the types of streams and stream-processing components were parametrized by the type of the individual items flowing through. All sources and sinks are now parametrized instead by the type of the monoid they produce or consume. As a consequence, SCC coroutines can now communicate in chunks of ByteString or Text instead of just lists, and these chunks can be of arbitrary size. The boundaries of producer's chunks are invisible to the consumer (excepting some low-level functions), which must specify the amount of data it wants to receive using a ReadRequest. This change at the heart of SCC has had a positive impact on outer layers, and especially on the Splitter component type which has become much simpler. [1] http://hackage.haskell.org/**package/monoid-subclasses-0.1.**1http://hackage.haskell.org/package/monoid-subclasses-0.1.1 [2] http://hackage.haskell.org/**package/incremental-parser-0.**2.2http://hackage.haskell.org/package/incremental-parser-0.2.2 [3] http://hackage.haskell.org/**package/scc-0.8http://hackage.haskell.org/package/scc-0.8 __**_ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/**mailman/listinfo/haskell-cafehttp://www.haskell.org/mailman/listinfo/haskell-cafe -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] N-ANN: HBlog-0.1
No responses, but I'm sure that, like me, many laughed at this ;) 2013/4/2 Tom Murphy amin...@gmail.com Oh, and happy April 1! On Mon, Apr 1, 2013 at 6:16 AM, Tom Murphy amin...@gmail.com wrote: Hi All, Not particularly happy to announce the non-release of my latest library, HBlog 0.1. I've been working on it steadily for a long time now, but it's still not ready. The library -- when it's finished -- will be a 100% Haskell representation of blogs, from authors and posts up to the most abstract notion of an entire blog as a Haskell data type. I'd like to finish the library sometime, but I've been so busy! Any spare time I've had, I've just ended up watching TV. I've been so caught up with the final season of The Office, I didn't realize how much time had passed since I originally had the idea! (2 years.) Didn't it seem like Jim and Pam were going to break up a couple weeks ago?! Anyway, here's the code I've definitely settled on so far: data Author = Author { name :: String } deriving (Show, Eq) data Post = Post { title :: String , body:: String , authors :: [Author] } deriving (Show) data Blog = Blog [Post] hasSingleAuthor :: Post - Bool hasSingleAuthor post = 1 == (length $ authors post) Feel free to use portions of this code in your own projects! Just be sure to put at the top of all your source files: Portions of this code (c) 2013 Tom Murphy. All rights reserved. ROADMAP: -- Lenses sound pretty cool, so I've started writing lenses for the Author type, as well as finding out what a lens is. Maybe one day there'll be lenses for the Post type, too -- keep your fingers crossed! -- One time when I was walking home from work, I had the idea for blogs being modeled as monads. Wouldn't that be awesome?: The Blog Monad. I haven't done it yet, though, because I haven't figured out what bind would do. If you figure out how to model blogs as monads, just be sure to include this in all of your sourcefiles: Idea for blog monad (c) 2013 Tom Murphy. All rights reserved. Happy hacking! Tom ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Make a DSL serializable
Hi Luc, I really don't know what exactly what FRP is. Every time i read about it, I figure out different things depending on the library. I used the term event in a wider way as something that happens in the computation no matter if it is generated inside or outside. Workflow does not handle -external- events althout it can be used in this context, like the example loop that I wrote above. I think that it can be used to recover the state of a FRP program after restart, in the same ortogonal way than in the example above, lifting the computation with the workflow transformer 2013/3/26 luc taesch luc.tae...@gmail.com On 2013-03-25 19:00:42 +, Alberto G. Corona said: It is possible as long as there is a empty event and there is a operation that mix two events to créate an state and an operation that mix an state and a event to créate an state. I just read thisat a time I am learning FRP Reactive banana and these two collides : Workflow (Event, state) ~ FRP (Event, bahavior) is that anyway connected, Alberto ? ( workflow and FRP ) ( are worflow are serializable persitent FRP Network ?) - __**_ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/**mailman/listinfo/haskell-cafehttp://www.haskell.org/mailman/listinfo/haskell-cafe -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Make a DSL serializable
It is possible as long as there is a empty event and there is a operation that mix two events to créate an state and an operation that mix an state and a event to créate an state. Then, if the events are serializable, the deserialization of the state from a serialized list of events would be deserialize list= mconcat . read $ list it is a way to have a general expression for the deserialization instead of a ad-hoc loop. 2013/3/25 Corentin Dupont corentin.dup...@gmail.com What do you mean by monoid? It's not clear to me how a state (essentially a structure with many fields) can be a monoid... I figured out that the Writer monad may be good for that purpose. On Mon, Mar 25, 2013 at 1:50 AM, Alberto G. Corona agocor...@gmail.comwrote: That is the advantage of recording the sequence of events instead of the final state: that the state don´t need to be seriallizable. And this indeed the way to serlize something that can be decomposed in events. I think that this is elegant.. Specially if the events and the state are elements of a Monoid instance. 2013/3/24 Corentin Dupont corentin.dup...@gmail.com Hi Brandon, in fact, that's what I'm doing. I record the list of actions performed by the players, including the submission of the code. I serialize this list of actions instead of the state of the game. When deserializing, I replay all the players actions from scratch to get back to the same state than before. This is the only way to do it (replaying from scratch), since the pieces of code submitted can interact with other pieces of code submitted earlier: they are not independant. But I always bothered me that this state is not serializable... On Sun, Mar 24, 2013 at 10:02 PM, Brandon Allbery allber...@gmail.comwrote: On Sun, Mar 24, 2013 at 4:16 PM, Corentin Dupont corentin.dup...@gmail.com wrote: Hi Daniel, in my game the handlers are supplied by the players as part of little programs that they submit. An haskell interpreter is reading the program code submitted and inserts it in the game. So there is an infinite number of handlers... You might store both the compiled code and the originally submitted code, and serialize the latter in a form that restart can recompile. I don't think that can be any less safe than the original submission/compilation/insertion. -- brandon s allbery kf8nh sine nomine associates allber...@gmail.com ballb...@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Alberto. -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Make a DSL serializable
Corentin: Thanks. It is not exactly the serialization of IO state computations, but when re-started, the IO state is recreated from the serialized intermediate results. It makes use of a simple idea, although it is not easy to realize it practically. I suppose that scala does something similar for their serializable delimited continuations. 2013/3/25 Corentin Dupont corentin.dup...@gmail.com Workflow is impressive! I didn't know you could serialize IO states/computations. On Mon, Mar 25, 2013 at 2:06 AM, Alberto G. Corona agocor...@gmail.comwrote: the package Workflow serialize also the state of a computation, so it can be re-started and continued. It uses also the above mentioned event trick to serialize the state. By the way you can use the workflow monad transformer to recover the state of the game. You don´t need to serialize anything explicitly, the transformer will do it, but your step results must be serializable. If you have this code: loop= do eventhandlercode - receive handler - compile eventhandlercode execute handler loop then the lifted process in the workflow monad would be: loop=do eventhandlercode - step receive handler - liftIO $ compile eventhandlercode liftIO $ execute handler loop step will store the result and will recover the execution state. Only the step result should be serializable. 2013/3/24 Corentin Dupont corentin.dup...@gmail.com I also came across Scala's Swarm, making use serializable delimited continuations. Looks good! http://www.scala-lang.org/node/3485 On Sun, Mar 24, 2013 at 11:13 PM, Michael Better mbet...@gmail.comwrote: Isn't this similar to the problem Cloud Haskell had to solve to send code to another process to run? Mike On Mar 24, 2013 5:06 PM, Brandon Allbery allber...@gmail.com wrote: On Sun, Mar 24, 2013 at 5:44 PM, Corentin Dupont corentin.dup...@gmail.com wrote: But I always bothered me that this state is not serializable... I am not quite sure how to respond to that. You seem to be asking for magic. That kind of state has never been sanely serializeable. Not in Haskell, not anywhere else. The usual hack is to dump an entire memory image to disk, either as an executable (see gcore and undump; also see how the GNU emacs build dumps a preloaded emacs executable) or by dumping the data segment as raw bytes and reloading it as such (which doesn't work so well in modern demand paged executables; it can work better with a virtual machine environment, and various Lisp and Smalltalk implementations dump and reload their raw VM images this way). I would not be surprised if what you seem to be asking for turns out to be yet another guise of the halting problem. -- brandon s allbery kf8nh sine nomine associates allber...@gmail.com ballb...@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net ___ 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 -- Alberto. -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Make a DSL serializable
That is the advantage of recording the sequence of events instead of the final state: that the state don´t need to be seriallizable. And this indeed the way to serlize something that can be decomposed in events. I think that this is elegant.. Specially if the events and the state are elements of a Monoid instance. 2013/3/24 Corentin Dupont corentin.dup...@gmail.com Hi Brandon, in fact, that's what I'm doing. I record the list of actions performed by the players, including the submission of the code. I serialize this list of actions instead of the state of the game. When deserializing, I replay all the players actions from scratch to get back to the same state than before. This is the only way to do it (replaying from scratch), since the pieces of code submitted can interact with other pieces of code submitted earlier: they are not independant. But I always bothered me that this state is not serializable... On Sun, Mar 24, 2013 at 10:02 PM, Brandon Allbery allber...@gmail.comwrote: On Sun, Mar 24, 2013 at 4:16 PM, Corentin Dupont corentin.dup...@gmail.com wrote: Hi Daniel, in my game the handlers are supplied by the players as part of little programs that they submit. An haskell interpreter is reading the program code submitted and inserts it in the game. So there is an infinite number of handlers... You might store both the compiled code and the originally submitted code, and serialize the latter in a form that restart can recompile. I don't think that can be any less safe than the original submission/compilation/insertion. -- brandon s allbery kf8nh sine nomine associates allber...@gmail.com ballb...@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Make a DSL serializable
the package Workflow serialize also the state of a computation, so it can be re-started and continued. It uses also the above mentioned event trick to serialize the state. By the way you can use the workflow monad transformer to recover the state of the game. You don´t need to serialize anything explicitly, the transformer will do it, but your step results must be serializable. If you have this code: loop= do eventhandlercode - receive handler - compile eventhandlercode execute handler loop then the lifted process in the workflow monad would be: loop=do eventhandlercode - step receive handler - liftIO $ compile eventhandlercode liftIO $ execute handler loop step will store the result and will recover the execution state. Only the step result should be serializable. 2013/3/24 Corentin Dupont corentin.dup...@gmail.com I also came across Scala's Swarm, making use serializable delimited continuations. Looks good! http://www.scala-lang.org/node/3485 On Sun, Mar 24, 2013 at 11:13 PM, Michael Better mbet...@gmail.comwrote: Isn't this similar to the problem Cloud Haskell had to solve to send code to another process to run? Mike On Mar 24, 2013 5:06 PM, Brandon Allbery allber...@gmail.com wrote: On Sun, Mar 24, 2013 at 5:44 PM, Corentin Dupont corentin.dup...@gmail.com wrote: But I always bothered me that this state is not serializable... I am not quite sure how to respond to that. You seem to be asking for magic. That kind of state has never been sanely serializeable. Not in Haskell, not anywhere else. The usual hack is to dump an entire memory image to disk, either as an executable (see gcore and undump; also see how the GNU emacs build dumps a preloaded emacs executable) or by dumping the data segment as raw bytes and reloading it as such (which doesn't work so well in modern demand paged executables; it can work better with a virtual machine environment, and various Lisp and Smalltalk implementations dump and reload their raw VM images this way). I would not be surprised if what you seem to be asking for turns out to be yet another guise of the halting problem. -- brandon s allbery kf8nh sine nomine associates allber...@gmail.com ballb...@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net ___ 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 -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] RFC: rewrite-with-location proposal
Additionally, Another way to include line number information and to improve readability of the degugging code is to add verify as an assert with flipped parameters so we can write: let x= head xs `verify` (not $ null xs) So the assertions appear on the right , separated from the rest of the code. instead of let x= assert (not $ null xs) xs 2013/2/26 Gershom Bazerman gersh...@gmail.com On 2/25/13 9:42 AM, Simon Peyton-Jones wrote: I’m afraid the rewrite-rule idea won’t work. RULES are applied during optimisation, when tons of inlining has happened and the program has been shaken around a lot. No reliable source location information is available there. ** ** See http://hackage.haskell.org/trac/ghc/wiki/ExplicitCallStack; and please edit it. ** ** One idea I had, which that page does not yet describe, is to have an implicit parameter, something like ?loc::Location, with errLoc :: ?loc:Location = String - a errLoc s = error (“At “ ++ ?loc ++ “\n” ++ s) ** ** This behave exactly like an ordinary implicit parameter, EXCEPT that if there is no binding for ?loc::Location, then the current location is used. Thus I like the general approach of this proposal quite a bit. I'd very much like Location to be not just a string, but a record type. Ideally we could recover not just module name, line and character, but also the name of the function that takes the location. This would eliminate an entire swath of use-cases for Template Haskell. For example, I've worked out a template-haskell-free version of the Cloud Haskell closure API, which hopefully is getting merged in at some point. The major drawback it has is that the user is required to provide a globally-unique identifier for each closure, ideally stable across compilations. The current TH code solves this by grabbing the function and module name. If we could get direct access to these things without requiring template haskell, that would be quite nice. Other types of RPC libraries I've worked on could similarly benefit from this. Cheers, Gershom ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [Haskell] ANNOUNCE: MFlow 0.2
The template look is very simple but it uses a lot of dynamic code behind I changed the template to something more light. http://haskell-web.blogspot.com.es/ 2013/1/20 bri...@aracnet.com On Thu, 17 Jan 2013 16:07:41 +0100 Alberto G. Corona agocor...@gmail.com wrote: The entry in my blog, with the announcement and the philosophy behind http://haskell-web.blogspot.com.es/2013/01/announce-mflow-02.html FYI That page never comes up for me. I just see spinning gears. iceweasel 10.0.7 Brian -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] hackage builds stopped?
What is the schedule of the hackage builds?. My package has been uploaded since three days ago, and it has not been compiled yet... -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] hackage builds stopped?
It seems that other packages have been build. Mine is http://hackage.haskell.org/package/MFlow-0.2.0.3 the previous uploads that I sent the past week have been compiled (error logs produced). But this last version don't. Are there some processing policy that I may don´t know? 2013/1/15 Alberto G. Corona agocor...@gmail.com What is the schedule of the hackage builds?. My package has been uploaded since three days ago, and it has not been compiled yet... -- Alberto. -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Object Oriented programming for Functional Programmers
Anyway, Type checking is essentially an application of set theory : (I did no search in te literature for this, It is just my perception). When I say (+) :: Num a = a - a - a . I mean that (+) takes two elements of the set of Num typeclass and return another. This is in principle a weak restriction, because many functions do it as well, for example (*). A propery check or a contract would be much more restrictive and thus would detect much more program errors. But it seems that no other language but haskell took this set theoretical analysis so exhaustively, and without it, a property check is like detecting microscopic cracks in nuclear waste vessel without first making sure that the cover has been sealed. 2013/1/2 MigMit miguelim...@yandex.ru On Jan 3, 2013, at 2:09 AM, Gershom Bazerman gersh...@gmail.com wrote: On 1/2/13 4:29 PM, MigMit wrote: BTW. Why you think that Eiffel type system is unsafe? Well, if I remember correctly, if you call some method of a certain object, and this call compiles, you can't be certain that this object actually has this method. Could be that this object belongs to some subclass which removes this method. Eiffel doesn't handle the relationship of co- and contra-variance of arguments with subtyping in a principled way. This is apparently known as the catcall problem. See, e.g., this article: http://www.eiffelroom.org/node/517 Yes, variance is another big source of unsafety, that's for sure. And another reason I think there is no real theory behind Eiffel, just a bunch of features (or concepts) boiled together. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hoogle index completeness
Hayoo has them all: 2012/12/19 Radical radi...@google.com Thanks, Petr. I see that the comments are from years ago. Are there any ongoing efforts to expand the default search set? (Or alternatively, to implement the +hackage modifier mentioned.) Is there interest in either of these things happening? Alvaro On Wed, Dec 19, 2012 at 12:06 PM, Petr P petr@gmail.com wrote: Hi Alvaro, by default Hoogle only searches some standard set of packages, which is only a relatively small subset of all Hackage content. From http://www.haskell.org/haskellwiki/Hoogle#Scope_of_Web_Searches : Using the standard web interface, Hoogle searches: array, arrows, base, bytestring, Cabal, cgi, containers, directory, filepath, haskell-src, HUnit, mtl, old-locale, old-time, packedstring, parallel, parsec, pretty, process, QuickCheck, random, stm, template-haskell, time, xhtml. See http://www.haskell.org/haskellwiki/Hoogle/Packages One solution is to install Hoogle locally and let it index all packages you have installed. Best regards, Petr 2012/12/19 Radical radi...@google.com Searching Hoogle for symbols like `rstrip` or `lstrip` produces No results found for me, even though they exist in the MissingH library. To wit: http://hackage.haskell.org/packages/archive/MissingH/1.2.0.0/doc/html/Data-String-Utils.html Is this behavior intentional, or a regression of some sort? I could have sworn the above symbols showed up at some point. Thanks! Alvaro ___ 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 -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hoogle index completeness
http://holumbus.fh-wedel.de/hayoo/hayoo.html 2012/12/19 Alberto G. Corona agocor...@gmail.com Hayoo has them all: 2012/12/19 Radical radi...@google.com Thanks, Petr. I see that the comments are from years ago. Are there any ongoing efforts to expand the default search set? (Or alternatively, to implement the +hackage modifier mentioned.) Is there interest in either of these things happening? Alvaro On Wed, Dec 19, 2012 at 12:06 PM, Petr P petr@gmail.com wrote: Hi Alvaro, by default Hoogle only searches some standard set of packages, which is only a relatively small subset of all Hackage content. From http://www.haskell.org/haskellwiki/Hoogle#Scope_of_Web_Searches : Using the standard web interface, Hoogle searches: array, arrows, base, bytestring, Cabal, cgi, containers, directory, filepath, haskell-src, HUnit, mtl, old-locale, old-time, packedstring, parallel, parsec, pretty, process, QuickCheck, random, stm, template-haskell, time, xhtml. See http://www.haskell.org/haskellwiki/Hoogle/Packages One solution is to install Hoogle locally and let it index all packages you have installed. Best regards, Petr 2012/12/19 Radical radi...@google.com Searching Hoogle for symbols like `rstrip` or `lstrip` produces No results found for me, even though they exist in the MissingH library. To wit: http://hackage.haskell.org/packages/archive/MissingH/1.2.0.0/doc/html/Data-String-Utils.html Is this behavior intentional, or a regression of some sort? I could have sworn the above symbols showed up at some point. Thanks! Alvaro ___ 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 -- Alberto. -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Motion to unify all the string data types
Andrew: There is a ListLike package, which does this nice abstraction. but I don't know if it is ready for and/or enough complete for serious usage. I´m thinking into using it for the same reasons. Anyone has some experiences to share about it? 2012/11/10 Andrew Pennebaker andrew.penneba...@gmail.com Frequently when I'm coding in Haskell, the crux of my problem is converting between all the stupid string formats. You've got String, ByteString, Lazy ByteString, Text, [Word], and on and on... I have to constantly lookup how to convert between them, and the overloaded strings GHC directive doesn't work, and sometimes ByteString.unpack doesn't work, because it expects [Word8], not [Char]. AAAH!!! Haskell is a wonderful playground for experimentation. I've started to notice that many Hackage libraries are simply instances of typeclasses designed a while ago, and their underlying implementations are free to play around with various optimizations... But they ideally all expose the same interface through typeclasses. Can we do the same with String? Can we pick a good compromise of lazy vs strict, flexible vs fast, and all use the same data structure? My vote is for type String = [Char], but I'm willing to switch to another data structure, just as long as it's consistently used. -- Cheers, Andrew Pennebaker www.yellosoft.us ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [ANNOUNCE] network-bitcoin
Thanks. I like the idea of BitCoin very much I'll l try to integrate it in MFlow 2012/11/5 Clark Gaebel cgae...@uwaterloo.ca Hello Cafe, You've heard of the neat crypto-currency bitcoin[1], haven't you? Well, I've just released network-bitcoin[2] which provides Haskell bindings to the bitcoin daemon. Hopefully, this will make your bitcoin-related goals easier to achieve. Who knows, it might even make bitcoin integration for the various web frameworks a bit easier. Special thanks to Michael Hendricks who wrote the original version of network-bitcoin, which I used as a base for this release. Regards, - Clark [1] http://bitcoin.org [2] http://hackage.haskell.org/package/network-bitcoin-1.0.1 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE: btree-concurrent
Hi. That´s fine. I missed an implementation of a persistent b-tree in haskell. I planned to do my own, but it is not trivial task. how the IO and STM is managed? . The serialization- deserialization is automatic or programmer must write the cached blocks? (i suppose that the block reads are automatic on data requests). The state in the disk is coherent at every moment?. I mean, if there is a program failure, the state in the btree in the file would be coherent? For example, if I write two TVars in two different blocks within the same STM transaction, do I have the guarantee that either both updated values will be in the file storage or none of them will be? Alberto 2012/10/30 Johan Brinch brin...@gmail.com Greetings Haskellers, We are pleased to announce this new package, featuring a concurrent b-tree developed as part of our master's thesis on backup systems. The package features code related to STM, caching, QuickCheck and of course concurrency and parallelism. And it's also on Hackage: http://hackage.haskell.org/package/btree-concurrent In case the build fails on Hackage and the documentation doesn't work, it's also available here: http://hindsight.dk/doc/html/btree-concurrent Credits to Thomas Conway of Melbourne University, for discussions related to the implementation, and to our supervisor Ken Friis Larsen of University of Copenhagen. And now, the description of the package: = A backend agnostic, concurrent BTree with relaxed balance[1] written in Haskell using a mix of IO operations and pure STM. Although the code does work, it is neither production-ready nor complete. Features include: * Caching: While nodes are periodically saved on persistent storage (e.g. disk) they are cached in-memory during operations. * Live flushing: It is possible to save the current version of the tree to disk and run modifying operations at the same time. The nodes are updated buttom-up to ensure a valid tree in the case of a crash. * Backend agnosticism: A simple API is used as an abstraction for the persistent storage. * Verification: The test-suite uses QuickCheck to compare the trees behaviour to that of Data.Map. Deficients include: * Memory greedy. Nodes are not stored in a compact fashion and are constantly being serialised/deserialised. * findMin and findMax are incomplete and may fail (see the TODO for details). * The implementation does not parallelise well. [1] B-trees with relaxed balance, K. S. Larsen R. Fagerberg, Parallel Processing Symposium, 1995. Proceedings., 9th International -- Johan Brinch Morten Brøns-Pedersen ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Why Kleisli composition is not in the Monad signature?
What hiders according with my experience, the understanding of this generalization are some mistakes. two typical mistakes from my side was to consider an arrow as a function, and the consideration of m as a kind of container, which it is not from the point of view of category theory. a - m b instead of as a container, 'm b' must be considered as the set of elements of type b (wrapped within some constructor) plus zero or more null elements of the monad 'm', Such are elements like, for example, Nothing, the empty list or Left . so that: null = f= nulland f = \x - null= null in the other side (-) is an arrow of category theory, not a function.That means that there may be weird additional things that functions are not be permitted to have. For example, from an element in the set of 'a' may depart many arrows to elements of 'b'. This permits the nondeterminism of the list monad. A function like this: repeatN :: Int - a - [a] can have two interpretations: one functional interpretation, where repeatN is a pure function with results in the list container. The other is the category interpretation, where 'repeatN n' is a morphism that produces n arrows from the set of the Strings to the set of String plus the empty set, The list container is a particular case of container that hold the result of this nondeterministic morphism (other instantiations of this nondeterministic monad would be a set monad or whatever monad build using a multielement container. The container type is not the essence. the essence it is the nondeterministic nature, which, in haskell practical terms, needs a multielement container to hold the multiple results). so the monadic re-ínterpretation of the repeatN signature is: repeatN ::Int - a - a + {[]} Here the empty list is the null element of the list monad in the same way: functional signature: a - Maybe b monadic interpretation: a - b + {Nothing} functional signature: a - Either c b monadic interpretation: a - b + {Left c} So when i see m b in the context of a monad, I think on nothing more that the set of values of type b (wrapped within some constructor) plus some null elements (if they exist). so in essence a - m b is a - (b + some null elements) that´s a generalisation of a - b where - is an arrow, not a function (can return more than one result, can return different things on each computation etc) And this instance of monoid show how kleisly is the composition and return is the identity element *instance Monad m = Monoid (a - m a) where* *mappend = (=)* *mempty = return* * * According with the above said, 'a - m a' must be understood as the set of monadic endomorphisms in a: a - a +{null elements of the monad m} Which is, in essence, a - a 2012/10/16 Simon Thompson s.j.thomp...@kent.ac.uk Not sure I really have anything substantial to contribute, but it's certainly true that if you see a - m b as a generalisation of the usual function type, a - b, then return generalises the identity and kleisli generalises function composition. This makes the types pretty memorable (and often the definitions too). Simon On 16 Oct 2012, at 20:14, David Thomas davidleotho...@gmail.com wrote: class Monad m where return :: a - m a kleisli :: (a - m b) - (b - m c) - (a - m c) Simon Thompson | Professor of Logic and Computation School of Computing | University of Kent | Canterbury, CT2 7NF, UK s.j.thomp...@kent.ac.uk | M +44 7986 085754 | W www.cs.kent.ac.uk/~sjt ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Why Kleisli composition is not in the Monad signature?
The particular case from which the former is a generalization: *instance Monad m = Monoid (a - a) where* *mappend = (.)* *mempty = id* * * Here the monoid is defined for the functions within the set of values of type a. There are no null elements. 2012/10/24 Alberto G. Corona agocor...@gmail.com What hiders according with my experience, the understanding of this generalization are some mistakes. two typical mistakes from my side was to consider an arrow as a function, and the consideration of m as a kind of container, which it is not from the point of view of category theory. a - m b instead of as a container, 'm b' must be considered as the set of elements of type b (wrapped within some constructor) plus zero or more null elements of the monad 'm', Such are elements like, for example, Nothing, the empty list or Left . so that: null = f= nulland f = \x - null= null in the other side (-) is an arrow of category theory, not a function.That means that there may be weird additional things that functions are not be permitted to have. For example, from an element in the set of 'a' may depart many arrows to elements of 'b'. This permits the nondeterminism of the list monad. A function like this: repeatN :: Int - a - [a] can have two interpretations: one functional interpretation, where repeatN is a pure function with results in the list container. The other is the category interpretation, where 'repeatN n' is a morphism that produces n arrows from the set of the Strings to the set of String plus the empty set, The list container is a particular case of container that hold the result of this nondeterministic morphism (other instantiations of this nondeterministic monad would be a set monad or whatever monad build using a multielement container. The container type is not the essence. the essence it is the nondeterministic nature, which, in haskell practical terms, needs a multielement container to hold the multiple results). so the monadic re-ínterpretation of the repeatN signature is: repeatN ::Int - a - a + {[]} Here the empty list is the null element of the list monad in the same way: functional signature: a - Maybe b monadic interpretation: a - b + {Nothing} functional signature: a - Either c b monadic interpretation: a - b + {Left c} So when i see m b in the context of a monad, I think on nothing more that the set of values of type b (wrapped within some constructor) plus some null elements (if they exist). so in essence a - m b is a - (b + some null elements) that´s a generalisation of a - b where - is an arrow, not a function (can return more than one result, can return different things on each computation etc) And this instance of monoid show how kleisly is the composition and return is the identity element *instance Monad m = Monoid (a - m a) where* *mappend = (=)* *mempty = return* * * According with the above said, 'a - m a' must be understood as the set of monadic endomorphisms in a: a - a +{null elements of the monad m} Which is, in essence, a - a 2012/10/16 Simon Thompson s.j.thomp...@kent.ac.uk Not sure I really have anything substantial to contribute, but it's certainly true that if you see a - m b as a generalisation of the usual function type, a - b, then return generalises the identity and kleisli generalises function composition. This makes the types pretty memorable (and often the definitions too). Simon On 16 Oct 2012, at 20:14, David Thomas davidleotho...@gmail.com wrote: class Monad m where return :: a - m a kleisli :: (a - m b) - (b - m c) - (a - m c) Simon Thompson | Professor of Logic and Computation School of Computing | University of Kent | Canterbury, CT2 7NF, UK s.j.thomp...@kent.ac.uk | M +44 7986 085754 | W www.cs.kent.ac.uk/~sjt ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Alberto. -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] serialize an unknown type
You can include the type in the serialized string. When recovering you can read the type and use to look for the appropriate deserializer in a lookup table where you have registered the deserializer. I use this trick in the IDynamic package,. that serializes-deserializes dynamic types: http://hackage.haskell.org/package/IDynamic-0.1 2012/10/20 Corentin Dupont corentin.dup...@gmail.com Hi the list! I have a simple question, how can I serialize/deserialize a structure like this: data InputChoice c deriving Typeable data Event a where InputChoice :: (Eq c, Show c) = [c] - c - Event (InputChoice c) (...) I'd like that the values of type c get serialized to a String... That's the easy part, but for deserializing, oops! Cheers, Corentin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] One of the new buzz phrases is Event-Sourcing; is Haskell suitable for this?
Hi,Marcelo, No. .Acid state is explcitly managed by the process by means of state management primitives In Control.Workflow the state is managed in a implicit way. It is a monad transformer mainly is designed for wrapping IO computations. the lifting primitive, step, store the intermediate result and recover the application state. in acid state the process choose what to write in the state in workflow the state written is the complete state of the process. See the example in the documentation. the process , http://hackage.haskell.org/packages/archive/Workflow/0.7.0.7/doc/html/Control-Workflow.html import Control.Workflow import Control.Concurrent(threadDelay) import System.IO (hFlush,stdout) mcount n= do step http://hackage.haskell.org/packages/archive/Workflow/0.7.0.7/doc/html/Control-Workflow.html#v:step $ do putStr (show n ++ ) hFlush stdout threadDelay 100 mcount (n+1) return () -- to disambiguate the return type main= exec1 http://hackage.haskell.org/packages/archive/Workflow/0.7.0.7/doc/html/Control-Workflow.html#v:exec1 count $ mcount (0 :: Int) *runghc demos\sequence.hs*0 1 2 3 CTRL-C Pressed *runghc demos\sequence.hs*3 4 5 6 7 CTRL-C Pressed *runghc demos\sequence.hs*7 8 9 10 11 ... in subsequent executions the process start to execute IO computations from the last point logged: As the documentation says some side effect can be re-executed after recovery if the log is not complete. This may happen after an unexpected shutdown (in this case Contro-C has been pressed) or due to an asynchronous log writing policy. (see syncWritehttp://hackage.haskell.org/packages/archive/Workflow/0.7.0.7/doc/html/Control-Workflow.html#v:syncWrite ) (writing is cached). Althoug this is not event sourcing, The logging and recovery facilities can be used for even sourcing. Alberto 2012/9/30 Marcelo Sousa dipyt...@gmail.com Hi, On Sun, Sep 30, 2012 at 4:22 AM, Alberto G. Corona agocor...@gmail.com wrote: It´´s a very iteresting concept. The Workflow Monad transformer [1], in Control.Workflow perform logging and recovery of application istate from the log created. It has no implementation of roll-back or limited recovery upto a point, but this is easy to implement. Is Control.Workflow similar with acid-state with respect to the way you recovery the current state? It also has many inspection and synchronization primitives. It has been used also for translating the log of a program and recovering the state in another machine. The log can be pretty-printed for debugging. Can you somehow recover impure (IO) computations? [1] http://hackage.haskell.org/package/Workflow Regards, Marcelo 2012/9/30 KC kc1...@gmail.com: http://martinfowler.com/eaaDev/EventSourcing.html http://martinfowler.com/articles/lmax.html -- -- Regards, KC ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] One of the new buzz phrases is Event-Sourcing; is Haskell suitable for this?
It´´s a very iteresting concept. The Workflow Monad transformer [1], in Control.Workflow perform logging and recovery of application istate from the log created. It has no implementation of roll-back or limited recovery upto a point, but this is easy to implement. It also has many inspection and synchronization primitives. It has been used also for translating the log of a program and recovering the state in another machine. The log can be pretty-printed for debugging. [1] http://hackage.haskell.org/package/Workflow 2012/9/30 KC kc1...@gmail.com: http://martinfowler.com/eaaDev/EventSourcing.html http://martinfowler.com/articles/lmax.html -- -- Regards, KC ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Fwd: [Haskell] ANNOUNCE: MFlow-0.1.5
Hi, This is an difficult problem in which the design principles of MFlow can help to creare a solution amazingly easily. I forward this message from, Web-devel because I think that it may be of interest A Web app. that creates Haskel computations from form responses. Store them, retrieve and execute them http://haskell-web.blogspot.com.es/2012/09/a.html Alberto 2012/9/18 Alberto G. Corona agocor...@gmail.com However if in a tab out of sync the user press refresh, the tab will refresh to the current state. I took care not to try to synchronize back as a consequence of a page that is in a forward state in one tab, as a consequence of navigating back in other tab. However I may have not considered all the edge extreme cases. There is a back detection primitive goingBack that allow the programmer to control the back behaviour in some special cases. For example if i want to step over a menu and present a default page, But if when the user go back i want to present the menu, I can detect this condition and present this menu, that did not appeared in a normal navigation: This code sets and get a default option in the menu, so the menu is not shown again in the navigation, except in the case that the user press the back button. Otherwise, the menu would be never accessible. However this is very specialized. normally the back button detection is not necessary. In a persistent flow even this default entry option would be completely automatic, since the process would restar at the last page visited. No setting is necessary. menu= do mop - getGoStraighTo back - goingBack case (mop,back) of (Just goop,False) - goop _ - do r - ask option1 | option2 case r of op1 - setGoStraighTo (Just goop1) goop1 op2 - setGoStraighTo (Just goop2) goop2 2012/9/18 Alberto G. Corona agocor...@gmail.com Hi Jake, right, it depends on the identification of the session: iAll the tabs share the same state because they share the same cookies. so if in one tab the use continue the interaction then the other tabs are out of sync. If the user goes to these other tabs and press any widget, the application will synchronize back to this page. This happens also if the user is logged in different computers. Alberto. 2012/9/18 Jake McArthur jake.mcart...@gmail.com Actually, I meant users that spawn multiple tabs from a single root session. You mentioned that you have some special support for the back button. What happens if I open a couple new tabs in which I may or may not go forward and backward. Do they all share the same state? Different states (how?)? Partially shared states? On Tue, Sep 18, 2012 at 12:33 PM, Alberto G. Corona agocor...@gmail.com wrote: Oh, I´m stupid. You mean web pages with multiple tabs I have not tested it. but each tab can be handled easily by a different server process.. or it can be handled in a single server process, like in a menu. For example, this code present different options, and the process renders different things depending on the response. The last option is a link to a different process, while the others( wlinks) are links that return back to the same process. The operator | is the applicative operator. a breakline is prepended to each link: data Ops= Ints | Strings | Actions | Ajax | Opt deriving(Typeable,Read, Show) mainf= do r - ask $ wlink Ints (bold increase an Int) | br ++ wlink Strings (bold increase a String) | br ++ wlink Actions (bold Example of a string widget with an action) | br ++ wlink Ajax (bold Simple AJAX example) | br ++ wlink Opt (bold select options) ++ (br +++ linkShop) -- this is an ordinary XHtml link case r of Ints- clickn 0 Strings - clicks 1 Actions - actions 1 Ajax- ajaxsample Opt - options mainf where linkShop= toHtml $ hotlink shop shopping . Alberto 2012/9/18 Alberto G. Corona agocor...@gmail.com: Hi Jake I don´t know what you mean with multiple tabs. The user management is simple, anonymous clients are identified with a cookie. if the user is logged (MFlow has widgets for logging-validation) the user is the identifier. The state of a process is associated to the client identifier and to the path invoked in the url requested. I don´t know if this answer your question Alberto 2012/9/18 Jake McArthur jake.mcart...@gmail.com: This sounds really cool. How do you handle users having multiple tabs? On Tue, Sep 18, 2012 at 11:26 AM, Alberto G. Corona agocor...@gmail.com wrote: Hi haskellers and specially the web developers. http://hackage.haskell.org/package/MFlow-0.1.5.3 MFlow is a is a Web
Re: [Haskell-cafe] Platform Versioning Policy: upper bounds are not our friends
Just thinking aloud: What if we add -current ? pacage -current Would select the versions of the package that were current art the time the cabal file was uploaded and sucessfully compiled in hackage, if the packae is installed from hackage If the cabal file is local then current == any. This option would eliminate the need to guess bounds for package dependencies. It would also give more guaranties that the package will compile sucessfully when downloaded from hackage. Certainly,it would not guarantee it if your version of ghc differs from the one in Hackage, but it would make things more simple and would reduce the spectrum of possible failures 2012/8/24 wren ng thornton w...@freegeek.org On 8/22/12 12:35 PM, David Menendez wrote: As I see it, there are four possibilities for a given version of dependency: 1. The version DOES work. The author (or some delegate) has compiled the package against this version and the resulting code is considered good. 2. The version SHOULD work. No one has tested against this version, but the versioning policy promises not to break anything. 3. The version MIGHT NOT work. No one has tested against this version, and the versioning policy allows breaking changes. 4. The version DOES NOT work. This has been tested and the resulting code (if any) is considered not good. Obviously, cases 1 and 4 can only apply to previously released versions. The PVP requires setting upper bounds in order to distinguish cases 2 and 3 for the sake of future compatibility. Leaving off upper bounds except when incompatibility is known essentially combines cases 2 and 3. Right-o. So there are two failure modes: I. A version which DOES work is outside the bounds (that is, in case 3). I think eliminating case 3 is too extreme. I like the idea of temporarily overriding upper bounds with a command-line option. The danger here is that we might actually be in case 4, in which case we don't want to override the bounds, but requiring an explicit override gives users a chance to determine if a particular version is disallowed because it is untested or because it is known to be incompatible. There are two failure modes with overriding stated bounds, however. On the one hand, the code could fail to compile. Okay, we know we're in case 4; all is well. On the other hand the code could successfully compile in ways the package designer knows to be buggy/wrong; we're actually in case 4, but the user does not know this. This is why it's problematic to simply allow overriding constraints. The package developer has some special knowledge that the compiler lacks, but if all constraints are considered equal then the developer has no way to convey that knowledge to the user (i.e., in an automated machine-checkable way). Consequently, the user can end up in a bad place because they thought this second failure mode was actually the success mode. This is why I advocate distinguishing hard constraints from soft constraints. By making this distinction, the developer has a means of conveying their knowledge to users. A soft bound defines an explicit boundary between case 1 and cases 2--4, which can be automatically (per PVP) extended to an implicit boundary between cases 1--2 and cases 3--4; a boundary which, as you say, can only be truly discovered after the code has been published. Extending soft boundaries in this way should be safe; at least it's as safe as possible with the foresight available to us. On the other hand, a hard bound defines an explicit boundary between case 4 and cases 1--3. If these are overridable, things may break silently as discussed above--- but the important thing is, in virtue of distinguishing hard and soft bounds, the user is made aware of this fact. By distinguishing hard and soft bounds, the developer can convey their special knowledge to the user. The user can ignore this information, but at least they'll do so in an informed way. -- Live well, ~wren __**_ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/**mailman/listinfo/haskell-cafehttp://www.haskell.org/mailman/listinfo/haskell-cafe -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANNOUNCE: MFlow-0.1.5
Hi haskellers and specially the web developers. http://hackage.haskell.org/package/MFlow-0.1.5.3 MFlow is a is a Web framework with some unique, and I mean unique, characteristics that I find exciting: - It is a Web application server that start and restart on-demand stateful web server processes (not request.-response) This means that all the page navigation can be coded in a single procedure. This increases readability of the programmer code. I woul call it a anti-node.js. Buit usual request-response (stateless) server processes are also allowed - When the process is invoqued as result of an URL request, the Web app server not only restart the process but also recover its execution state. The enclosing Workflow monad provides the thread state persistence. There are state timeouts and process timeouts defined by the programmer. Processes with no persistent state (transient) are possible. -The user interface is made of widgets. They are formlets with added formatting, attributes, validations, modifiers and callbacks, that are composable, so the pieces are reusable and return type safe responses to the calling process. Even the links are part of widgets and return back type safe inputs at compile time to the calling server process. Tho glue these components, ordinary applicative combinators and other extra combinators are used. - The widgets and the communication don´t make assumptions about the architecture, so it can be adapted to non-web environments. This versions has interface for WAI-warp, Hack, Text.XHtml (xhtml) , and Haskell Server Pages. -The widget rendering can be converted to ByteStrings automatically with special combinators. A mix of widgets with different formats can be combined in the same source file. For example Text.Html and HSP (Haskell server pages) -These widgets can be cached, to avoid widget rendering on every interaction. -To handle the back button, and because the processes are stateful, they can run backwards until the response match. This is transparent for the programmer, thanks to the embedded FlowM monad. -All the code is in pure Haskell. No deployment, special scripts, formats etc are necessary. -Besides automatic state persistence, TCache provides transactions and user data persistence, that can be configured for SQL databases. Default persistence in files permit very rapid prototyping. Just code and run it with runghc. -Has AJAX support All of this sounds very complicated, but really it is simple!. Most of these things are transparent. The resulting code is quite readable and has very little plumbing! There is a non trivial example that some of these functionalities embedded here that you can run: http://hackage.haskell.org/packages/archive/MFlow/0.1.5.3/doc/html/MFlow-Forms.html Take a look and tell me your opinion. I hope that you find it as exciting as me. I´m looking for people to collaborate in the development of MFlow. Although still it is experimental, it is being used in at least one future commercial project. So I have te commitment to continue its development. There are many examples in the documentation and in the package. Alberto ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Fwd: [Haskell] ANNOUNCE: MFlow-0.1.5
Oh, I´m stupid. You mean web pages with multiple tabs I have not tested it. but each tab can be handled easily by a different server process.. or it can be handled in a single server process, like in a menu. For example, this code present different options, and the process renders different things depending on the response. The last option is a link to a different process, while the others( wlinks) are links that return back to the same process. The operator | is the applicative operator. a breakline is prepended to each link: data Ops= Ints | Strings | Actions | Ajax | Opt deriving(Typeable,Read, Show) mainf= do r - ask $ wlink Ints (bold increase an Int) | br ++ wlink Strings (bold increase a String) | br ++ wlink Actions (bold Example of a string widget with an action) | br ++ wlink Ajax (bold Simple AJAX example) | br ++ wlink Opt (bold select options) ++ (br +++ linkShop) -- this is an ordinary XHtml link case r of Ints- clickn 0 Strings - clicks 1 Actions - actions 1 Ajax- ajaxsample Opt - options mainf where linkShop= toHtml $ hotlink shop shopping . Alberto 2012/9/18 Alberto G. Corona agocor...@gmail.com: Hi Jake I don´t know what you mean with multiple tabs. The user management is simple, anonymous clients are identified with a cookie. if the user is logged (MFlow has widgets for logging-validation) the user is the identifier. The state of a process is associated to the client identifier and to the path invoked in the url requested. I don´t know if this answer your question Alberto 2012/9/18 Jake McArthur jake.mcart...@gmail.com: This sounds really cool. How do you handle users having multiple tabs? On Tue, Sep 18, 2012 at 11:26 AM, Alberto G. Corona agocor...@gmail.com wrote: Hi haskellers and specially the web developers. http://hackage.haskell.org/package/MFlow-0.1.5.3 MFlow is a is a Web framework with some unique, and I mean unique, characteristics that I find exciting: - It is a Web application server that start and restart on-demand stateful web server processes (not request.-response) This means that all the page navigation can be coded in a single procedure. This increases readability of the programmer code. I woul call it a anti-node.js. Buit usual request-response (stateless) server processes are also allowed - When the process is invoqued as result of an URL request, the Web app server not only restart the process but also recover its execution state. The enclosing Workflow monad provides the thread state persistence. There are state timeouts and process timeouts defined by the programmer. Processes with no persistent state (transient) are possible. -The user interface is made of widgets. They are formlets with added formatting, attributes, validations, modifiers and callbacks, that are composable, so the pieces are reusable and return type safe responses to the calling process. Even the links are part of widgets and return back type safe inputs at compile time to the calling server process. Tho glue these components, ordinary applicative combinators and other extra combinators are used. - The widgets and the communication don´t make assumptions about the architecture, so it can be adapted to non-web environments. This versions has interface for WAI-warp, Hack, Text.XHtml (xhtml) , and Haskell Server Pages. -The widget rendering can be converted to ByteStrings automatically with special combinators. A mix of widgets with different formats can be combined in the same source file. For example Text.Html and HSP (Haskell server pages) -These widgets can be cached, to avoid widget rendering on every interaction. -To handle the back button, and because the processes are stateful, they can run backwards until the response match. This is transparent for the programmer, thanks to the embedded FlowM monad. -All the code is in pure Haskell. No deployment, special scripts, formats etc are necessary. -Besides automatic state persistence, TCache provides transactions and user data persistence, that can be configured for SQL databases. Default persistence in files permit very rapid prototyping. Just code and run it with runghc. -Has AJAX support All of this sounds very complicated, but really it is simple!. Most of these things are transparent. The resulting code is quite readable and has very little plumbing! There is a non trivial example that some of these functionalities embedded here that you can run: http://hackage.haskell.org/packages/archive/MFlow/0.1.5.3/doc/html/MFlow-Forms.html Take a look and tell me your opinion. I hope that you find it as exciting as me. I´m looking for people to collaborate in the development of MFlow. Although still it is experimental, it is being used
Re: [Haskell-cafe] Fwd: [Haskell] ANNOUNCE: MFlow-0.1.5
Hi Jake, right, it depends on the identification of the session: iAll the tabs share the same state because they share the same cookies. so if in one tab the use continue the interaction then the other tabs are out of sync. If the user goes to these other tabs and press any widget, the application will synchronize back to this page. This happens also if the user is logged in different computers. Alberto. 2012/9/18 Jake McArthur jake.mcart...@gmail.com Actually, I meant users that spawn multiple tabs from a single root session. You mentioned that you have some special support for the back button. What happens if I open a couple new tabs in which I may or may not go forward and backward. Do they all share the same state? Different states (how?)? Partially shared states? On Tue, Sep 18, 2012 at 12:33 PM, Alberto G. Corona agocor...@gmail.com wrote: Oh, I´m stupid. You mean web pages with multiple tabs I have not tested it. but each tab can be handled easily by a different server process.. or it can be handled in a single server process, like in a menu. For example, this code present different options, and the process renders different things depending on the response. The last option is a link to a different process, while the others( wlinks) are links that return back to the same process. The operator | is the applicative operator. a breakline is prepended to each link: data Ops= Ints | Strings | Actions | Ajax | Opt deriving(Typeable,Read, Show) mainf= do r - ask $ wlink Ints (bold increase an Int) | br ++ wlink Strings (bold increase a String) | br ++ wlink Actions (bold Example of a string widget with an action) | br ++ wlink Ajax (bold Simple AJAX example) | br ++ wlink Opt (bold select options) ++ (br +++ linkShop) -- this is an ordinary XHtml link case r of Ints- clickn 0 Strings - clicks 1 Actions - actions 1 Ajax- ajaxsample Opt - options mainf where linkShop= toHtml $ hotlink shop shopping . Alberto 2012/9/18 Alberto G. Corona agocor...@gmail.com: Hi Jake I don´t know what you mean with multiple tabs. The user management is simple, anonymous clients are identified with a cookie. if the user is logged (MFlow has widgets for logging-validation) the user is the identifier. The state of a process is associated to the client identifier and to the path invoked in the url requested. I don´t know if this answer your question Alberto 2012/9/18 Jake McArthur jake.mcart...@gmail.com: This sounds really cool. How do you handle users having multiple tabs? On Tue, Sep 18, 2012 at 11:26 AM, Alberto G. Corona agocor...@gmail.com wrote: Hi haskellers and specially the web developers. http://hackage.haskell.org/package/MFlow-0.1.5.3 MFlow is a is a Web framework with some unique, and I mean unique, characteristics that I find exciting: - It is a Web application server that start and restart on-demand stateful web server processes (not request.-response) This means that all the page navigation can be coded in a single procedure. This increases readability of the programmer code. I woul call it a anti-node.js. Buit usual request-response (stateless) server processes are also allowed - When the process is invoqued as result of an URL request, the Web app server not only restart the process but also recover its execution state. The enclosing Workflow monad provides the thread state persistence. There are state timeouts and process timeouts defined by the programmer. Processes with no persistent state (transient) are possible. -The user interface is made of widgets. They are formlets with added formatting, attributes, validations, modifiers and callbacks, that are composable, so the pieces are reusable and return type safe responses to the calling process. Even the links are part of widgets and return back type safe inputs at compile time to the calling server process. Tho glue these components, ordinary applicative combinators and other extra combinators are used. - The widgets and the communication don´t make assumptions about the architecture, so it can be adapted to non-web environments. This versions has interface for WAI-warp, Hack, Text.XHtml (xhtml) , and Haskell Server Pages. -The widget rendering can be converted to ByteStrings automatically with special combinators. A mix of widgets with different formats can be combined in the same source file. For example Text.Html and HSP (Haskell server pages) -These widgets can be cached, to avoid widget rendering on every interaction. -To handle the back button, and because the processes are stateful, they can run backwards until
Re: [Haskell-cafe] Fwd: [Haskell] ANNOUNCE: MFlow-0.1.5
However if in a tab out of sync the user press refresh, the tab will refresh to the current state. I took care not to try to synchronize back as a consequence of a page that is in a forward state in one tab, as a consequence of navigating back in other tab. However I may have not considered all the edge extreme cases. There is a back detection primitive goingBackhttp://hackage.haskell.org/packages/archive/MFlow/0.1.5.3/doc/html/MFlow-Forms.html#v:goingBack that allow the programmer to control the back behaviour in some special cases. For example if i want to step over a menu and present a default page, But if when the user go back i want to present the menu, I can detect this condition and present this menu, that did not appeared in a normal navigation: This code sets and get a default option in the menu, so the menu is not shown again in the navigation, except in the case that the user press the back button. Otherwise, the menu would be never accessible. However this is very specialized. normally the back button detection is not necessary. In a persistent flow even this default entry option would be completely automatic, since the process would restar at the last page visited. No setting is necessary. menu= do mop - getGoStraighTo back - goingBack http://hackage.haskell.org/packages/archive/MFlow/0.1.5.3/doc/html/MFlow-Forms.html#v:goingBack case (mop,back) of (Just goop,False) - goop _ - do r - ask http://hackage.haskell.org/packages/archive/MFlow/0.1.5.3/doc/html/MFlow-Forms.html#v:ask option1 | option2 case r of op1 - setGoStraighTo (Just goop1) goop1 op2 - setGoStraighTo (Just goop2) goop2 2012/9/18 Alberto G. Corona agocor...@gmail.com Hi Jake, right, it depends on the identification of the session: iAll the tabs share the same state because they share the same cookies. so if in one tab the use continue the interaction then the other tabs are out of sync. If the user goes to these other tabs and press any widget, the application will synchronize back to this page. This happens also if the user is logged in different computers. Alberto. 2012/9/18 Jake McArthur jake.mcart...@gmail.com Actually, I meant users that spawn multiple tabs from a single root session. You mentioned that you have some special support for the back button. What happens if I open a couple new tabs in which I may or may not go forward and backward. Do they all share the same state? Different states (how?)? Partially shared states? On Tue, Sep 18, 2012 at 12:33 PM, Alberto G. Corona agocor...@gmail.com wrote: Oh, I´m stupid. You mean web pages with multiple tabs I have not tested it. but each tab can be handled easily by a different server process.. or it can be handled in a single server process, like in a menu. For example, this code present different options, and the process renders different things depending on the response. The last option is a link to a different process, while the others( wlinks) are links that return back to the same process. The operator | is the applicative operator. a breakline is prepended to each link: data Ops= Ints | Strings | Actions | Ajax | Opt deriving(Typeable,Read, Show) mainf= do r - ask $ wlink Ints (bold increase an Int) | br ++ wlink Strings (bold increase a String) | br ++ wlink Actions (bold Example of a string widget with an action) | br ++ wlink Ajax (bold Simple AJAX example) | br ++ wlink Opt (bold select options) ++ (br +++ linkShop) -- this is an ordinary XHtml link case r of Ints- clickn 0 Strings - clicks 1 Actions - actions 1 Ajax- ajaxsample Opt - options mainf where linkShop= toHtml $ hotlink shop shopping . Alberto 2012/9/18 Alberto G. Corona agocor...@gmail.com: Hi Jake I don´t know what you mean with multiple tabs. The user management is simple, anonymous clients are identified with a cookie. if the user is logged (MFlow has widgets for logging-validation) the user is the identifier. The state of a process is associated to the client identifier and to the path invoked in the url requested. I don´t know if this answer your question Alberto 2012/9/18 Jake McArthur jake.mcart...@gmail.com: This sounds really cool. How do you handle users having multiple tabs? On Tue, Sep 18, 2012 at 11:26 AM, Alberto G. Corona agocor...@gmail.com wrote: Hi haskellers and specially the web developers. http://hackage.haskell.org/package/MFlow-0.1.5.3 MFlow is a is a Web framework with some unique, and I mean unique, characteristics that I find exciting: - It is a Web application server that start and restart
Re: [Haskell-cafe] From monads to monoids in a small category
Moreover, `m a` is 'a' plus some terminal element , for example Nothing, [], Left _ etc, So a morphism (a - m a) contains all the morphisms of (m a - m a). 2012/9/5 Alberto G. Corona agocor...@gmail.com: Alexander, In my post (excuses for my dyslexia) I try to demonstrate that the codomain (m a), from the point of view of C. Theory, can be seen as 'a' plus, optionally, some additional element, so a monadic morphism (a - m a) is part of a endofunctor in (m a - m a) When considering the concept of arrow from category theory, (not the concept of function), a point in the domain can send more than one arrow to the codomain, while a function do not. I think that this is the most interesting part of the interpretation, if I´m right. About this, I found this article revealing: http://cdsmith.wordpress.com/2012/04/18/why-do-monads-matter/ Therefore, codomains of (a - m a) which are containers with multiple a elements can be considered as multi-arrow morphisms from 'a' to 'a' with the optional addition of some special elements that denote special conditions. For example (a - [a]) May be considered as the general signature of the morphisms from the set 'a' to the set ('a' + []) So a monadic transformation (a - [a]) can be considered as a point transformation of a endofunctor within the set (a + []). Alberto 2012/9/5 Alexander Solla alex.so...@gmail.com: On Tue, Sep 4, 2012 at 4:21 PM, Alexander Solla alex.so...@gmail.com wrote: On Tue, Sep 4, 2012 at 3:39 AM, Alberto G. Corona agocor...@gmail.com wrote: Monads are monoids in the category of endofunctors This Monoid instance for the endofunctors of the set of all elements of (m a) typematch in Haskell with FlexibleInstances: instance Monad m = Monoid (a - m a) where mappend = (=) -- kleisly operator mempty = return The objects of a Kliesli category for a monad m aren't endofunctors. You want something like: instance Monad m = Monoid (m a - m (m a)) where ... /These/ are endofunctors, in virtue of join transforming an m (m a) into an (m a). Actually, even these aren't endofunctors, for a similar reason that : you really want something like instance Monad m = Monoid (m a - m a) where mempty = id mappend = undefined -- exercise left to the reader (i.e., you want to do plumbing through the Eilenberg-Moore category for a monad, instead of the Kliesli category for a monad -- my last message exposes the kind of plumping you want, but not the right types.) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] From monads to monoids in a small category
Thanks, Kristopher 2012/9/4 Kristopher Micinski krismicin...@gmail.com: Your post feels similar to another one posted recently... http://web.jaguarpaw.co.uk/~tom/blog/2012/09/02/what-is-a-monad-really.html just fyi, :-), kris On Tue, Sep 4, 2012 at 6:39 AM, Alberto G. Corona agocor...@gmail.com wrote: Monads are monoids in the category of endofunctors This Monoid instance for the endofunctors of the set of all elements of (m a) typematch in Haskell with FlexibleInstances: instance Monad m = Monoid (a - m a) where mappend = (=) -- kleisly operator mempty = return The article can be found here: http://haskell-web.blogspot.com.es/2012/07/from-monads-to-monoids-in-small.html I would appreciate some comments. ___ 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] From monads to monoids in a small category
Alexander, In my post (excuses for my dyslexia) I try to demonstrate that the codomain (m a), from the point of view of C. Theory, can be seen as 'a' plus, optionally, some additional element, so a monadic morphism (a - m a) is part of a endofunctor in (m a - m a) When considering the concept of arrow from category theory, (not the concept of function), a point in the domain can send more than one arrow to the codomain, while a function do not. I think that this is the most interesting part of the interpretation, if I´m right. About this, I found this article revealing: http://cdsmith.wordpress.com/2012/04/18/why-do-monads-matter/ Therefore, codomains of (a - m a) which are containers with multiple a elements can be considered as multi-arrow morphisms from 'a' to 'a' with the optional addition of some special elements that denote special conditions. For example (a - [a]) May be considered as the general signature of the morphisms from the set 'a' to the set ('a' + []) So a monadic transformation (a - [a]) can be considered as a point transformation of a endofunctor within the set (a + []). Alberto 2012/9/5 Alexander Solla alex.so...@gmail.com: On Tue, Sep 4, 2012 at 4:21 PM, Alexander Solla alex.so...@gmail.com wrote: On Tue, Sep 4, 2012 at 3:39 AM, Alberto G. Corona agocor...@gmail.com wrote: Monads are monoids in the category of endofunctors This Monoid instance for the endofunctors of the set of all elements of (m a) typematch in Haskell with FlexibleInstances: instance Monad m = Monoid (a - m a) where mappend = (=) -- kleisly operator mempty = return The objects of a Kliesli category for a monad m aren't endofunctors. You want something like: instance Monad m = Monoid (m a - m (m a)) where ... /These/ are endofunctors, in virtue of join transforming an m (m a) into an (m a). Actually, even these aren't endofunctors, for a similar reason that : you really want something like instance Monad m = Monoid (m a - m a) where mempty = id mappend = undefined -- exercise left to the reader (i.e., you want to do plumbing through the Eilenberg-Moore category for a monad, instead of the Kliesli category for a monad -- my last message exposes the kind of plumping you want, but not the right types.) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] From monads to monoids in a small category
Monads are monoids in the category of endofunctors This Monoid instance for the endofunctors of the set of all elements of (m a) typematch in Haskell with FlexibleInstances: instance Monad m = Monoid (a - m a) where mappend = (=) -- kleisly operator mempty = return The article can be found here: http://haskell-web.blogspot.com.es/2012/07/from-monads-to-monoids-in-small.html I would appreciate some comments. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] From monads to monoids in a small category
Not to mention the ugly formatting ;) 2012/9/5 Richard O'Keefe o...@cs.otago.ac.nz: On 4/09/2012, at 10:39 PM, Alberto G. Corona wrote: Monads are monoids in the category of endofunctors This Monoid instance for the endofunctors of the set of all elements of (m a) typematch in Haskell with FlexibleInstances: instance Monad m = Monoid (a - m a) where mappend = (=) -- kleisly operator mempty = return The article can be found here: http://haskell-web.blogspot.com.es/2012/07/from-monads-to-monoids-in-small.html I would appreciate some comments. s/kleisly/Kleisli/ In the article, s/Lets/Let's/ /Here 'm b' as/ s/as/is/ s/this_are/this are/ s/first, is/first is/ s/haskell/Haskell/ s/polimorphic/polymorphic/ s/x=/x =/ s/let's/Let's/ s/condition, associativity/condition, associativity,/ /if not where that way, .* guess/ I *think* you mean to say something like (If it were not so, it would be impossible to define the denotational semantics of imperative languages in terms of monads, I guess.) Generally, it's according TO, not according WITH, and associated WITH, not associated TO. instance Functor a doesn't seem to be legal Haskell. At this point I stopped reading. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE: persistent-vector-0.1.0.1
Where the persistent part of the name comes from?. It can be serialized/deserialized from a persistent storage automatically or on demand? 2012/8/29 Tristan Ravitch travi...@cs.wisc.edu I uploaded a package implementing persistent vectors using array mapped tries (based on the implementation in clojure). Version 0.1.0.0 was broken, so I am starting off with 0.1.0.1. http://hackage.haskell.org/package/persistent-vector Persistent vectors are a sequence container offering efficient and purely functional append (snoc), indexing, and updates. This is similar to Data.Sequence from containers. The array mapped trie is closely related to the data structure used in the unordered-containers package. Comparison to Sequence: * Faster indexing and append * Slightly slower updates to existing elements * O(1) slicing * Sequence offers efficient prepend and concatenate (persistent-vector does not implement prepend, while concatenate is O(n)). I tried to model the API after Sequence as much as was reasonable, but a few functions are still missing. Some are reasonable to implement and some would be difficult to make efficient. The results from criterion (mostly comparing against Sequence and IntMap) are posted here: http://pages.cs.wisc.edu/~travitch/pvec.html The *Vec* runs are the vectors from this package and IM and Seq are IntMap and Sequence from containers. Hopefully someone will find this useful. Comments and suggestions are definitely welcome for anything: API, implementation, test suite, or benchmarks. ___ 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] OS-independent auto-monitoring of a program to do things depending on resource usage at runtime
For a caching library, I need to know the runtime usage of memory of the program and the total amount of memory, the total memory used by all the programs etc. I need not do profiling or monitoring but to do different things inside my program depending on memory usage. The search is difficult because all searches go to profiling utilities which I don´t need. Are there some portable way to to this? . The various monitoring libraries indicates that there are ways to do it, but they seem not to allow runtime internal automonitoring ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] OS-independent auto-monitoring of a program to do things depending on resource usage at runtime
Joachim: Thanks a lot 2012/8/27 Joachim Breitner m...@joachim-breitner.de Hi, Am Montag, den 27.08.2012, 18:20 +0200 schrieb Alberto G. Corona : For a caching library, I need to know the runtime usage of memory of the program and the total amount of memory, the total memory used by all the programs etc. I need not do profiling or monitoring but to do different things inside my program depending on memory usage. The search is difficult because all searches go to profiling utilities which I don´t need. Are there some portable way to to this? . The various monitoring libraries indicates that there are ways to do it, but they seem not to allow runtime internal automonitoring you can use the GHC.Stats module, see http://www.haskell.org/ghc/docs/latest/html/libraries/base/GHC-Stats.html, and remember to pass +RTS -T to the program, or -with-rtsopts=-T to the compiler. Greetings, Joachim -- Joachim nomeata Breitner m...@joachim-breitner.de | nome...@debian.org | GPG: 0x4743206C xmpp: nome...@joachim-breitner.de | http://www.joachim-breitner.de/ ___ 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] Martin Odersky on What's wrong with Monads
The problem of monads is that it defines different execution models, besides the funcional,/lazy/declarative mode. There is no such problem in imperative languages, which work ever in an hardwired IO monad. But this means that the programmer has to code the extra behaviour needed in each application to do the same. I summarized this here: http://haskell-web.blogspot.com.es/2012/06/intuitive-explanation-of-algorithms-in.html It pretend to be intuitive, not accurate. (See disclaimer ;) . Comments welcome 2012/6/27 Yves Parès yves.pa...@gmail.com I'm not happy with any of these options. Why are you unhappy with the ImplicitParams option? It's pretty much like resorting to a newtype, as it's been suggested before. 2012/6/27 Tillmann Rendel ren...@informatik.uni-marburg.de Hi Rico, Rico Moorman wrote: data Tree = Leaf Integer | Branch (Tree Integer) (Tree Integer) amount:: Tree - Integer amount (Leaf x) = x amount (Branch t1 t2) = amountt1 + amountt2 [...] additional requirement: If the command-line flag --multiply is set, the function amount computes the product instead of the sum. How would you implement this requirement in Haskell without changing the line amount (Leaf x) = x? The (for me at least) most obvious way to do this would be, to make the operation to be applied to determine the amount (+ or *) an explicit parameter in the function's definition. data Tree a = Leaf a | Branch (Tree a) (Tree a) amount :: (a - a - a) - Tree a - a amount fun (Leaf x) = x amount fun (Branch t1 t2) = amount fun t1 `fun` amount fun t2 I agree: This is the most obvious way, and also a very good way. I would probably do it like this. Which drawbacks do you see besides increased verbosity? Well, you did change the equation amount (Leaf x) = x to amount fun (Leaf x) = x. In a larger example, this means that you need to change many lines of many functions, just to get the the value of fun from the point where it is known to the point where you need it. [...] I am wondering which ways of doing this in Haskell you mean. I thought of the following three options, but see also Nathan Howells email for another alternative (that is related to my option (1) below): (1) Implicit parameters: {-# LANGUAGE ImplicitParams #-} data Tree = Leaf Integer | Branch Tree Tree amount :: (?fun :: Integer - Integer - Integer) = Tree - Integer amount (Leaf x) = x amount (Branch t1 t2) = ?fun (amount t1) (amount t2) (2) Lexical Scoping: data Tree = Leaf Integer | Branch Tree Tree amount :: (Integer - Integer - Integer) - Tree - Integer amount fun = amount where { amount (Leaf x) = x ; amount (Branch t1 t2) = fun (amount t1) (amount t2) } (3) UnsafePerformIO: import System.IO.Unsafe (unsafePerformIO) data Tree = Leaf Integer | Branch Tree Tree amount :: Tree - Integer amount (Leaf x) = x amount (Branch t1 t2) = fun (amount t1) (amount t2) where fun = unsafePerformIO ... I'm not happy with any of these options. Personally, I would probably go ahead and transform the whole program just to get the value of fun to where it is needed. Nevertheless, having actually done this before, I understand why Martin Odersky doesn't like doing it :) Tillmann __**_ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/**mailman/listinfo/haskell-cafehttp://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] Martin Odersky on What's wrong with Monads
My pocket explanation: While e a function gives one only value of the codomain for each element of the domain set (and thus it can be evaluated a single time), a category is a generalization that accept many graphs that goes from each element of the domain to the codomain. For that matter getChar can be understood mathematically only using cathegory theory. To discover where the chain of graphs goes each time, it is necessary to execute the chain of sentences. Imperative languages works categorically every time, so they don´t need an special syntax for doing so. Haskell permits to discriminate functional code from normal categorical/imperative code, so the programmer and the compiler can make use of the mathematical properties of functions. For example, graph reduction thank to the uniqueness of the paths. Besides that, everything, functional or monadic is equally beatiful and polimorphic. i don´t think that monadic code is less fine. It is unavoidable and no less mathematical. 2012/6/25 Anton Kholomiov anton.kholom...@gmail.com The class you're looking for is Applicative. The (*) operator handles application of effectful things to effectful things, whereas ($) handles the application of non-effectful things to effectful things. This situation is interesting because it highlights the fact that there is a distinction between the meaning of whitespace between function and argument vs the meaning of whitespace between argument and argument. `Applicative` is not enough for monads. `Applicative` is like functor only for functions with many arguments. It's good for patterns: (a - b - c - d) - (m a - m b - m c - m d) Monads are good for patterns (a - b - c - m d) - (m a - m b - m c - m d) So I can not express it with `Applicative`. My analogy really breaks down on functions with several arguments, since as you have pointed out there are two white spaces. But I like the idea of using one sign for normal and monadic and maybe applicative applications. Anton ___ 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] haskellonline.org, a web frontend for ghc
That´s very good. What tecnology, libraries etc did you use? 2012/5/3 Gintautas Miliauskas gintau...@miliauskas.lt: Hello, check out http://haskellonline.org, an online Haskell typechecker. It is essentially a thin web wrapper over ghc, but it takes some friction out of learning Haskell, if only because no local setup is required. It is a weekend's work, so do not be too harsh, but feedback is welcome! I have also written up an accompanying blog post [1]. [1] http://blog.miliauskas.lt/2012/05/online-haskell-typechecker.html Best regards, -- Gintautas Miliauskas ___ 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] Generalizing (++) for monoids instead of using ()
Thinking aloud, I dónt know if the transition to more abstract type signatures can be aleviated using language directives. Someting like: Restrict (++) String - String - String that locally would restrict the type within the module. Althoug it does not avoid breaking the old code, It permits an easy fix. Moreover, This may have applications in other contexts, for example teaching, because the wild abstraction of the error messages is the most difficult barrier in haskell learning. Cheers Alberto 2012/4/1 Thomas DuBuisson thomas.dubuis...@gmail.com: On Sun, Apr 1, 2012 at 1:58 PM, aditya bhargava bluemangrou...@gmail.com wrote: After asking this question: http://stackoverflow.com/questions/9963050/standard-way-of-joining-two-data-texts-without-mappend I found out that the new infix operator for `mappend` is (). I'm wondering why ghc 7.4 didn't generalize (++) to work on monoids instead. Such decisions should really be made by the Haskell Prime committee (vs GHC HQ). In Haskell there is a continuing tension between making things polymorphic and to keep the prelude functions monomorphic so they generate simple error messages (among other arguments). At the point, the additional argument of any new definition of Haskell remaining backwards compatible also holds weight and this slows the rate-of-change. This is not a new issue, there are a number of functions that could be defined more generally (common example: map/fmap). The problem making such changes is a matter of consensus and will to see things though. Cheers, Thomas ___ 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] Generalizing (++) for monoids instead of using ()
Fine ;) So the transition should not be so problematic. An OldPrelude.hs may be created easily with this. Once again, thinking aloud. 2012/5/4 Malcolm Wallace malcolm.wall...@me.com: On 4 May 2012, at 10:02, Alberto G. Corona wrote: Restrict (++) String - String - String that locally would restrict the type within the module. import qualified Prelude import Prelude hiding ((++)) (++) :: String - String - String (++) = Prelude.(++) ___ 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] Automatic discovery of tests
Hi, trying to learn haskell and the associated build env. I come from a java/scala world so trying to understand the how to invoke tests. Have a cabal file that invokes a main function to execute a test. But wondering if there is any automatic discovery of tests as per junit. I have seen test-framework-th but to me that implies putting a testGroupGenerator into each module. Am i correct about that and if so is there an example of calling multiple modules tests ? Or is there a better way just to invoke specific functions prefixed with case_ prop_ etc in the entire src/test directory of the cabal build ? Thanks ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Osx, brew install of 64 bit ghc
Got a new ghc via brew 7.0.4 and then recompiled / installed haskell-platform via brew Not getting issue trying to compile using ideah in intellij such as Bad interface file: /usr/local/Cellar/ghc/64-apple-darwin/lib/ghc-7.0.4/base-4.3.1.0/Prelude.hi magic number mismatch: old/corrupt interface file? (wanted 129742, got 33214052) Anyone point me in the right direction as to the issue ? Have tried trashing the project etc with no luck. Thanks ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Fail-back monad
Thaks Oleg for your clarification. I thoutgh on the use or ErrorT or something similar but the fact is that i need many bacPoints, not just one. That is, The user can go many pages back in the navigation pressing many times te back buttton.,. My code has a failure detection in each backPoint , so the computation can fail-back to the previous backpoint and so on. Doing this with errorT result in a ugly syntax. 2012/3/29 o...@okmij.org: Alberto G. Corona wrote about a monad to set a checkpoint and be able to repeatedly go to that checkpoint and re-execute the computations following the checkpoint. http://haskell-web.blogspot.com.es/2012/03/failback-monad.html The typical example is as follows. test= runBackT $ do lift $ print will not return back here liftBackPoint $ print will return here n2 - lift $ getLine lift $ print second input n3 - lift $ getLine if n3 == back then fail else lift $ print $ n2++n3 Let us first consider a slightly simplified problem, with a different signature for liftBackPoint. Rather than writing do liftBackPoint $ print will return here other_computation we will write do backPoint $ do lift $ print will return here other_computation In that case, backPoint will be implemented with the Exception or Error monad. For example, backPoint :: Monad m = ErrorT SomeException m a - ErrorT SomeException m a backPoint m = catchError m handler where handler e | Just RestartMe - fromException e = backPoint m handler e = throwError e -- other errors propagate up We designate one exception RestartMe as initiating the restart from the checkpoint. Other exceptions will propagate as usual. Obviously, if we are in IO or some MonadIO, we could use the regular exception-handling facilities: throw/catch. Suppose however that marking of the checkpoint should be a single action rather that exception-like handling form. Then we need the continuation monad: type BackT r m a = ContT r (ErrorT SomeException m) a backPointC :: Monad m = ContT e (ErrorT SomeException m) () backPointC = ContT (\k - backPoint (k ())) (we have re-used the earlier backPoint). Incidentally, the continuation monad will be faster than BackT in the original article. Attentive reader must have noticed that backPointC is shift in disguise. Here is the complete code. {-# LANGUAGE DeriveDataTypeable #-} module BackT where import Control.Monad.Trans import Control.Monad.Error import Control.Monad.Cont import Control.Exception import Data.Typeable data RestartMe = RestartMe deriving (Show, Typeable) instance Exception RestartMe instance Error SomeException -- Make a `restartable' exception -- (restartable from the beginning, that is) -- We redo the computation once we catch the exception RestartMe -- Other exceptions propagate up as usual. -- First, we use ErrorT backPoint :: Monad m = ErrorT SomeException m a - ErrorT SomeException m a backPoint m = catchError m handler where handler e | Just RestartMe - fromException e = backPoint m handler e = throwError e -- other errors propagate up test1 = runErrorT $ do lift $ print will not return back here backPoint $ do lift $ print will return here n2 - lift $ getLine lift $ print second input n3 - lift $ getLine if n3 == back then throwError (toException RestartMe) else lift $ print $ n2++n3 -- Obviously we can use error handling in the IO monad... -- Suppose we don't want backPoint that takes monad as argument. -- We wish backPoint that is a simple m () action. -- We will use Cont monad then: That is, we use Cont + Error Monad -- We reuse the old backPoint type BackT r m a = ContT r (ErrorT SomeException m) a backPointC :: Monad m = ContT e (ErrorT SomeException m) () backPointC = ContT (\k - backPoint (k ())) abort e = ContT(\k - e) test2 :: BackT r IO () test2 = do liftIO $ print will not return back here backPointC -- This line differs liftIO $ print will return here -- (and the indentation on here) n2 - liftIO $ getLine liftIO $ print second input n3 - liftIO $ getLine if n3 == back then abort $ throwError (toException RestartMe) else liftIO $ print $ n2++n3 test2r = runErrorT $ runContT test2 return ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Fail-back monad
But, on my side, BackT [BackPoint 1] and BackT [NoBack 1] can be made indistinguishable outside the code where the monad is defined. Probably the effect required is not possible without breaking the law 2012/3/31 Ross Paterson r...@soi.city.ac.uk: On Wed, Mar 28, 2012 at 01:34:29AM +0100, Alberto G. Corona wrote: In my package MFlow [1] I program an entire web navigation in a single procedure. That happened in the good-old WASH web application framework. The problem is the back button in the Browser. To go back in the code to the previous interactions when the data input does not match the expected because the user pressed the back button one or more times, i came across this Monad specimen,: that solves the problem. This definition does not satisfy the right identity law (m = return = m) included in the monad definition: *FailBack BackT [BackPoint 1] = return BackT [NoBack 1] ___ 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] Fail-back monad
Sorry, the text example again without HTML formatting: test= runBackT $ do lift $ print will not return back here liftBackPoint $ print will return here n2 - lift $ getLine lift $ print second input n3 - lift $ getLine if n3 == back then fail else lift $ print $ n2++n3 I wrote a blog entry about this : http://haskell-web.blogspot.com.es/2012/03/failback-monad.html 2012/3/28 Alberto G. Corona agocor...@gmail.com: Hi Haskellers. In my package MFlow [1] I program an entire web navigation in a single procedure. That happened in the good-old WASH web application framework. The problem is the back button in the Browser. To go back in the code to the previous interactions when the data input does not match the expected because the user pressed the back button one or more times, i came across this Monad specimen,: that solves the problem. data FailBack a = BackPoint a -- will go back to this point | NoBack a . -- Normal outcome | GoBack -- exception:: must go to the last backPoint newtype BackT m a = BackT { runBackT :: m (FailBack a ) } -- this monad nas a loop instance Monad m = Monad (BackT m) where fail _ = BackT $ return GoBack return x = BackT . return $ NoBack x x = f = BackT $ loop where loop = do v - runBackT x case v of NoBack y - runBackT (f y) -- business as usual BackPoint y - do z - runBackT (f y) case z of GoBack - loop -- if x was a backpoint, then redirects the flow to this backpoint other - return other GoBack - return GoBack --propagate the signal back This monad does not perform exploration of alternatives as is the case of MonadPlus instances. It does not perform the kind of backtracking of nondeterministic three navigations in the Prolog style. It just go back to the last point where the computation can restart again in a sequence of actions. In this example: liftBackPoint f= BackT $ f = \x - return $ BackPoint x test= runBackT $ do lift $ print will not return back here liftBackPoint $ print will return here n2 lt;- lift $ getLine lift $ print second input n3 lt;- lift $ getLine if n3 == back then fail else lift $ print $ n2++n3 Whenever the second input is back The procedure will go back to where liftBackPoint is. Otherwise, it will return the concatenation of the two inputs. If the underlying monad is an instance of MonadState, it can transport the state that caused the failure to the backpoint. Are there something similar? May it be functionally equivalent to something simpler or with more grounds? I looked at some exception monads out there, but they did not seems to share the same idea [1] http://haskell-web.blogspot.com.es/2012/02/web-application-server-with-stateful.html ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Fail-back monad
Hi Stephen: It could be: It performs a rollback indeed. I guess that this monad can be used in something similar to nonblocking (multilevel) transactions. if GoBack is changed to Goback String, and a trace string is added to each NoBack step, then each NoBack step could sum the traces of all the previous steps. The when GoBack condition is reached, it can transport back the entire trace of the failed execution. to the BackPoint 2012/3/28 Stephen Tetley stephen.tet...@gmail.com: Maybe this is a version of William Harrison's DebugT monad with rollback, listed in his periodic table of effects? http://www.cs.missouri.edu/~harrisonwl/Presentations/UIUCFM05.ppt I've never seen a definition of the monad itself... http://www.haskell.org/pipermail/beginners/2010-January/003371.html ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Fail-back monad
Hi Haskellers. In my package MFlow [1] I program an entire web navigation in a single procedure. That happened in the good-old WASH web application framework. The problem is the back button in the Browser. To go back in the code to the previous interactions when the data input does not match the expected because the user pressed the back button one or more times, i came across this Monad specimen,: that solves the problem. data FailBack a = BackPoint a -- will go back to this point | NoBack a . -- Normal outcome | GoBack-- exception:: must go to the last backPoint newtype BackT m a = BackT { runBackT :: m (FailBack a ) } -- this monad nas a loop instance Monad m = Monad (BackT m) where fail _ = BackT $ return GoBack return x = BackT . return $ NoBack x x = f = BackT $ loop where loop = do v - runBackT x case v of NoBack y - runBackT (f y) -- business as usual BackPoint y - do z - runBackT (f y) case z of GoBack - loop -- if x was a backpoint, then redirects the flow to this backpoint other - return other GoBack - return GoBack --propagate the signal back This monad does not perform exploration of alternatives as is the case of MonadPlus instances. It does not perform the kind of backtracking of nondeterministic three navigations in the Prolog style. It just go back to the last point where the computation can restart again in a sequence of actions. In this example: liftBackPoint f= BackT $ f = \x - return $ BackPoint x test= runBackT $ do lift $ print will not return back here liftBackPoint $ print will return here n2 lt;- lift $ getLine lift $ print second input n3 lt;- lift $ getLine if n3 == back then fail else lift $ print $ n2++n3 Whenever the second input is back The procedure will go back to where liftBackPoint is. Otherwise, it will return the concatenation of the two inputs. If the underlying monad is an instance of MonadState, it can transport the state that caused the failure to the backpoint. Are there something similar? May it be functionally equivalent to something simpler or with more grounds? I looked at some exception monads out there, but they did not seems to share the same idea [1] http://haskell-web.blogspot.com.es/2012/02/web-application-server-with-stateful.html ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] An idea to document inter department dependencies in Haskell
Hi, Just thinking aloud : A way to start is to define concrete workflows for concrete events. What It is necessary to do if. This may make things more explicit and to clarify the problems. .Later, .maybe. these concrete workflows can be abstracted away from procedural/imperative to declarative and from concrete events to categories of events and tasks.. The declarative abstract description then could create concrete workflows. The best way to express the abstract description, and the way to transform the description in a concrete set of instructions depend on what is needed (The workflows produced can be just informative, in the form of a textual description of activities). Thus, the power users should handle the abstract descriptions, and the ordinary users could run the engine, perhaps they should answer some questions to obtain the concrete workflows for their intended tasks Not very informative, but better than nothing ;) Alberto 2012/3/13 C K Kashyap ckkash...@gmail.com My dear Haskell folks, I work in a software company where I develop components that go into a really complex system that's built of several components developed by different teams that are geographically distributed. The components themselves run in a distributed manner across client and several servers. All our design documents are in wiki's (fashionably so). As a result of the above situation and the fact that our code base is not in Haskell, we are almost always dealing with Oh I did not know this would effect that and Oh I have no clue what all this change will impact. I've been wondering if it would be a good idea to try and create a spec for the system in Haskell, such that would could get a better handle on the dependencies. Perhaps an EDSL, that would allow Product Managers to introduce new requirements - compilation failures would indicate the areas that would need to be touched. How is it different from having a spec in a diagram - well, in that case, we are requiring humans to look at the diagram to detect dependencies instead of the compiler telling me about the dependencies. I am about to start off with some implementation to capture my idea - I can articulate it better then. However, I just wanted to throw it out there to check if anyone's had some thought in this direction or if there is some prior art here. Regards, Kashyap ___ 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] Haskell-platform and ghc 7.4
Am new to haskell, but one thing I wanted to try out was the performance of an app in haskel. Having issues getting it to compile under ghc 7.0.4. The owner recommend trying to upgrade to 7.2/7.4 I see a warning that the haskell-platform isn't compatible with with 7.4.1, or so my homebrew install says. Can it be made to compile ?? Can I remove the haskell-platform and then install the dev tools from the haskell-platform via cabal etc once I have moved to 7.4.x etc ? Thanks ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell-platform and ghc 7.4
Ah, sounds a good idea. Thanks___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ghc: could not execute: opt
Thanks, i though the llvm was part of the OS install these days. Not that I know much about OSX coding. Will download and try it. Thanks ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] network-2.3.0.10 compiled for ghc 7.4.1 windows
Theoretically you only have to exec cabal install at the directory where setup.hs is located. It is not necessary neither cygwin neither mingw I guess ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] network-2.3.0.10 compiled for ghc 7.4.1 windows
I put Network Version 2.3.0.10 compiled for ghc.7.4.1 Windows (this time without runtime errors) in the address refereed above. Just in case someone want to avoid cabal configure-build and just want to cabal install. 2012/2/13 Johan Tibell johan.tib...@gmail.com: Resending as the last message got held for moderation: On Mon, Feb 13, 2012 at 10:18 AM, Johan Tibell johan.tib...@gmail.com wrote: Version 2.3.0.11 released. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] network-2.3.0.10 compiled for ghc 7.4.1 windows
yes i did it,. the error is as follows: shop.exe: NetworkSocket.hsc:(948,3)-(1007,23): Non-exhaustive patterns in case I will download network form hackage and will do it form the beginning. . 2012/2/8 Holger Reinhardt hreinha...@gmail.com: Did you run cabal clean before rebuilding with Git Bash? And can you post the exact runtime error you get? 2012/2/8 Alberto G. Corona agocor...@gmail.com I switched to Git bash and the runtime error produced by the library is the same. This error may be produced because the configuration it does not detect the netwiorkin related includes such is socket.h. This does not exist neither in the ghc installation neither in GIT/Mingw 2012/2/7 Holger Reinhardt hreinha...@gmail.com: I just use the version of MSys that is included with Git [1]. This puts a Git bash icon on your desktop which you can then use to build the network library. [1] http://code.google.com/p/msysgit/ 2012/2/7 Alberto G. Corona agocor...@gmail.com Nothing bur a long history of failures. The problem is the configuration and versioning of MinGW and MSys. This is a nighmare. 2012/2/7 Holger Reinhardt hreinha...@gmail.com: Oh you are using Cygwin. I'm using MSys so this is why I cannot reproduce your problem. Is there anything preventing you from using MSys? 2012/2/7 Alberto G. Corona agocor...@gmail.com The problem this time is in Configure : case $host in *-mingw32) EXTRA_SRCS=cbits/initWinSock.c, cbits/winSockErr.c, cbits/asyncAccept.c EXTRA_LIBS=ws2_32 CALLCONV=stdcall ;; *-solaris2*) EXTRA_SRCS=cbits/ancilData.c EXTRA_LIBS=nsl, socket CALLCONV=ccall ;; *) EXTRA_SRCS=cbits/ancilData.c EXTRA_LIBS= CALLCONV=ccall ;; esac Since I´m cross-compiling with cygwin, the variable Host does not contain ¨*-muingw32 but i686-pc-cygwin changing the case , the library incorporates the lost C coded files. Now the library links fine win imported, but there is a runtime error: NetworkSocket.hsc:(948,3)-(1007,23): Non-exhaustive patterns in case maybe it is due to some other preprocessor directive mismatch 2012/2/7 Holger Reinhardt hreinha...@gmail.com: Did you also change the files in the /cbits/ folder? Because they also check for HAVE_WINSOCK_H. 2012/2/7 Alberto G. Corona agocor...@gmail.com The code is evolving and none of the versions match exactily with the patch, but substituting HAVE_WINSOCK by HAVE WINSOCK2 in these files solves the compilation problem at least in the network 2.3.0.10 version from hackage. However it produces the same undefined references when this library is imported in my application. It seems that some object code is not included in the final library. I verified that at least some of these undefined references correspond with C code in the source, but somehow this is not included in the object library 2012/2/7 Johan Tibell johan.tib...@gmail.com: Note that there are two branches on github, master and stable. You want the latter. On Feb 7, 2012 8:23 AM, Alberto G. Corona agocor...@gmail.com wrote: This is quite different. I don´t know how but I was looking at some other older patch around the same issue and I supposed that it was the one refered by Yohan Tibell. I´ll try your patch. Thanks!. 2012/2/7 Holger Reinhardt hreinha...@gmail.com: Hi, (I submitted the patch that Johan linked to) Network/Socket/Internal.hsc has the following code: #if defined(WITH_WINSOCK) || defined(cygwin32_HOST_OS) type CSaFamily = (#type unsigned short) #elif defined(darwin_HOST_OS) type CSaFamily = (#type u_char) #else type CSaFamily = (#type sa_family_t) #endif You have patched this part to always use 'unsigned short'. But the real issue is that WITH_WINSOCK is not defined, even though it should be. The reason for this lies in include/HsNet.h: #if defined(HAVE_WINSOCK_H) !defined(cygwin32_HOST_OS) # define WITH_WINSOCK 1 #endif The problem here is that it checks for HAVE_WINSOCK_H, but the configure script never defines this variable. Instead it defines HAVE_WINSOCK2_H. It seems that the network library used Winsock1 in the past and in the transition to Winsock2 someone forgot to change a few of the #ifdefs. My patch just changes all occurences of HAVE_WINSOCK_H to HAVE_WINSOCK2_H. You might want to try that and report back if it works for you. 2012/2/7 Alberto G. Corona agocor...@gmail.com Hi Johan
[Haskell-cafe] ANNOUNCE MFlow-0.0.3 an Application Server for stateful web apps with statically typed widget combinators
Hi Haskellers I I´m happy to announce the first version of MFlow http://hackage.haskell.org/package/MFlow MFlow permits the execution of web applications in a procedural form, that is, with multiple requests-response interactions in a single procedure. MFlow stores the execution state, manage timeouts, shutdown and restart the procedure on demand at the point of execution, even after server stop. These services are transparent for the programmer. The other aspect of MFlow are combinators for the definition of widgets and formlets that can be mixed freely with HTML formatting and produce statically typed values using the traditional formlet/applicative approach. There are bindings for the package XHtml, so no need to learn new paradigms/scripting/formatting.. Console and window oriented apps are possible. Out of te box serialization in files permits very rapid prototyping, but any backend can be used . MFlow (MessageFlow) was created initially as the user interface for the Workflow package . Currently is an alpha version. It has only basic authentication but I plan to inprove it for serious applications. I upload this version just in case anyone wants to play with it. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE MFlow-0.0.3 an Application Server for stateful web apps with statically typed widget combinators
Here you can take a look at a complete example included in the package: http://haskell-web.blogspot.com/2012/02/web-application-server-with-stateful.html This snippet is the web page in declarative form: shopProds :: V.Vector Int - [Prod] - View Html IO (Either Int Prod)shopProds cart products= br ++-- add Html to the first widget p -Shopping List- ++ widget(Selection{ stitle = bold choose an item, sheader= [ bold item , bold price, bold times chosen], sbody= [([toHtml pname, toHtml $ show pprice, toHtml $ show $ cart V.! i],i ) | (Prod{..},i ) - zip products [1..]]}) +-- operator to mix two wdigets br ++-- add Html to the second widget p ---Add a new product--- ++ table -- encloses a widget in HTML tags (tr td ! [valign top] widget (Form (Nothing :: Maybe Prod) ) ++ -- append Html after the widget tr td ! [align center] hotlink hello (bold Hello World)) 2012/2/7 Alberto G. Corona agocor...@gmail.com: Hi Haskellers I I´m happy to announce the first version of MFlow http://hackage.haskell.org/package/MFlow MFlow permits the execution of web applications in a procedural form, that is, with multiple requests-response interactions in a single procedure. MFlow stores the execution state, manage timeouts, shutdown and restart the procedure on demand at the point of execution, even after server stop. These services are transparent for the programmer. The other aspect of MFlow are combinators for the definition of widgets and formlets that can be mixed freely with HTML formatting and produce statically typed values using the traditional formlet/applicative approach. There are bindings for the package XHtml, so no need to learn new paradigms/scripting/formatting.. Console and window oriented apps are possible. Out of te box serialization in files permits very rapid prototyping, but any backend can be used . MFlow (MessageFlow) was created initially as the user interface for the Workflow package . Currently is an alpha version. It has only basic authentication but I plan to inprove it for serious applications. I upload this version just in case anyone wants to play with it. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] network-2.3.0.10 compiled for ghc 7.4.1 windows
Hi Johan, The patch is not for the current version of network and the code is quite different. Basically it is necesary to define this variable as unsigned short that is the thing intended in the patch. however I put it by brute force, without regard of the prerpocessor directives. With this change the code compiles well with: http://neilmitchell.blogspot.com/2010/12/installing-haskell-network-library-on.html However my compiled library lack the methods defined as foreign. I´ll keep trying. 2012/2/6 Johan Tibell johan.tib...@gmail.com: Hi, Someone recently contributed a fix that should make network build with 7.4: https://github.com/haskell/network/pull/25 Can you see if that works for you? I haven't yet had time to merge and release that fix (I'm on vacation.) -- Johan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] network-2.3.0.10 compiled for ghc 7.4.1 windows
This is quite different. I don´t know how but I was looking at some other older patch around the same issue and I supposed that it was the one refered by Yohan Tibell. I´ll try your patch. Thanks!. 2012/2/7 Holger Reinhardt hreinha...@gmail.com: Hi, (I submitted the patch that Johan linked to) Network/Socket/Internal.hsc has the following code: #if defined(WITH_WINSOCK) || defined(cygwin32_HOST_OS) type CSaFamily = (#type unsigned short) #elif defined(darwin_HOST_OS) type CSaFamily = (#type u_char) #else type CSaFamily = (#type sa_family_t) #endif You have patched this part to always use 'unsigned short'. But the real issue is that WITH_WINSOCK is not defined, even though it should be. The reason for this lies in include/HsNet.h: #if defined(HAVE_WINSOCK_H) !defined(cygwin32_HOST_OS) # define WITH_WINSOCK 1 #endif The problem here is that it checks for HAVE_WINSOCK_H, but the configure script never defines this variable. Instead it defines HAVE_WINSOCK2_H. It seems that the network library used Winsock1 in the past and in the transition to Winsock2 someone forgot to change a few of the #ifdefs. My patch just changes all occurences of HAVE_WINSOCK_H to HAVE_WINSOCK2_H. You might want to try that and report back if it works for you. 2012/2/7 Alberto G. Corona agocor...@gmail.com Hi Johan, The patch is not for the current version of network and the code is quite different. Basically it is necesary to define this variable as unsigned short that is the thing intended in the patch. however I put it by brute force, without regard of the prerpocessor directives. With this change the code compiles well with: http://neilmitchell.blogspot.com/2010/12/installing-haskell-network-library-on.html However my compiled library lack the methods defined as foreign. I´ll keep trying. 2012/2/6 Johan Tibell johan.tib...@gmail.com: Hi, Someone recently contributed a fix that should make network build with 7.4: https://github.com/haskell/network/pull/25 Can you see if that works for you? I haven't yet had time to merge and release that fix (I'm on vacation.) -- Johan ___ 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