Re: [Haskell-cafe] How to implement a digital filter, using Arrows?
Hi David, I was referring to the `f' in the `runAuto' function, not the `liftAu' function. -db On Wed, Oct 19, 2011 at 8:53 PM, David Barbour dmbarb...@gmail.com wrote: On Wed, Oct 19, 2011 at 8:07 PM, Captain Freako capn.fre...@gmail.com wrote: One more question on the `runAuto' code, John: If I understand the code correctly, `f' is an arrow. Yet, we're using it on the right side of `=' in a simple assignment. How are we getting away with that? Thanks, -db liftAu' f s0 = proc x - do rec (y,s') - arr f - (x,s) s - delay s0 - s' returnA - (y,s) The value `f` is a function - a parameter of liftAu'. While all functions are arrows (Arrow is defined on (-)), the value `arr f` is an arrow of the automaton model. The `=` symbol is used to define the liftAu function. What are you imagining? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] hello Haskell
hey Haskell this is nuts http://www.business10i.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Online tutorial about Heist, Mvars, Anansi
Dear haskellers, I've spent the last few days scratching my head and wading through heist code. The result of my efforts is a tutorial available at: http://www.nadineloveshenry.com/haskell/heistTutorial.html Any corrections, suggestions, compliments or misc. personal abuse are always welcome. Best wishes, Henry -- Nadine Henry LaxenBelle, Venus, Aphrodite 10580 N. McCarran Blvd. Adonis, Jarod Suite 115-396 Via Alta # 6 Reno, NevadaChapala, Jalisco, Mexico 89503-1896 CP 45900 http://www.nadineloveshenry.com/ The rest is silence. (Hamlet) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Implementing a New primop
Have you tried rebuilding GHC completely after the change? I tried your change and the error went away after I rebuilt from scratch. The build system probably just didn't pick up all files that needed rebuilding. Might be worth reporting? Not sure. Greetings, Peter Wortmann ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to implement a digital filter, using Arrows?
On Thu, Oct 20, 2011 at 5:19 AM, Captain Freako capn.fre...@gmail.comwrote: Hi David, I was referring to the `f' in the `runAuto' function, not the `liftAu' function. -db Ah, I see. You quoted one thing and spoke of another, and I got all confused. Keep in mind that functions are arrows (instance Arrow (-)). type FilterAu b c = Automaton (-) b c runAuto :: FilterAu b c - [b] - [c] runAuto a [] = [] runAuto (Automaton f) (x:xs) = let (y,a) = f x in y:runAuto a xs ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] lost in generics
I need some help finding my way around the various generics libraries. My usage scenario is -- at least to start with -- the ASTs of programming languages. It appears to me that there are two generations of generics -- earlier there was generic haskell and strafunski Now there is uniplate and kure (and syb? -- not sure of its generation...) I get this impression because I saw a comment somewhat along these lines. And also the very first reference link on the strafunski webpage: http://www.haskell.org/haskellwiki/Applications_and_libraries/Generic_programming/Strafunski viz http://www.cs.vu.nl/Strafunski/ seems to be dead. So I am wondering whether strafunski is still under development or is it defunct? The following paras from http://www.cs.uu.nl/research/techreps/repo/CS-2008/2008-010.pdf The current status of generic programming in Haskell is comparable to the lazy Tower of Babel preceding the birth of Haskell in the eighties [Hudak et al., 2007]. We have many single-site languages or libraries, each individually lacking critical mass in terms of language/library-design effort, implementations, and users. Although generic programming has been used in several applications, it has few users for real-life projects. This is understandable. Developing a large application takes a couple of years, and choosing a particular approach to generic programming for such a project involves a risk. Few approaches that have been developed over the last decade are still supported, and there is a high risk that the chosen approach will not be supported anymore, or that it will change in a backwards-incompatible way in a couple of years time. sound omninous :-) In general my question is: What is alive/active and what is alive/active and what is -- um -- moved-on-from. And of course which are easier and which more difficult to dig into. Thanks Rusi ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] lost in generics
Hi Rusi, GHC has built-in support for two generic programming libraries. SYB [1] support has been there for a long time. The new generic mechanism [2], which allows you to define your own, (almost) derivable classes, only appeared in 7.2, but is planned to stay. What library you should use depends on what you want to do. There's a (slightly outdated) paper about that [3]. If you're looking into AST manipulations, SYB (or Uniplate [4]) might be the best pick. For most things I prefer the new generic mechanism, though. Cheers, Pedro [1] http://www.cs.uu.nl/wiki/GenericProgramming/SYB [2] http://www.haskell.org/ghc/docs/latest/html/users_guide/generic-programming.html [3] http://citeseer.ist.psu.edu/viewdoc/summary?doi=10.1.1.140.3330 [4] http://community.haskell.org/~ndm/uniplate/ On Thu, Oct 20, 2011 at 18:12, Rustom Mody rustompm...@gmail.com wrote: I need some help finding my way around the various generics libraries. My usage scenario is -- at least to start with -- the ASTs of programming languages. It appears to me that there are two generations of generics -- earlier there was generic haskell and strafunski Now there is uniplate and kure (and syb? -- not sure of its generation...) I get this impression because I saw a comment somewhat along these lines. And also the very first reference link on the strafunski webpage: http://www.haskell.org/haskellwiki/Applications_and_libraries/Generic_programming/Strafunski viz http://www.cs.vu.nl/Strafunski/ seems to be dead. So I am wondering whether strafunski is still under development or is it defunct? The following paras from http://www.cs.uu.nl/research/techreps/repo/CS-2008/2008-010.pdf The current status of generic programming in Haskell is comparable to the lazy Tower of Babel preceding the birth of Haskell in the eighties [Hudak et al., 2007]. We have many single-site languages or libraries, each individually lacking critical mass in terms of language/library-design effort, implementations, and users. Although generic programming has been used in several applications, it has few users for real-life projects. This is understandable. Developing a large application takes a couple of years, and choosing a particular approach to generic programming for such a project involves a risk. Few approaches that have been developed over the last decade are still supported, and there is a high risk that the chosen approach will not be supported anymore, or that it will change in a backwards-incompatible way in a couple of years time. sound omninous :-) In general my question is: What is alive/active and what is alive/active and what is -- um -- moved-on-from. And of course which are easier and which more difficult to dig into. Thanks Rusi ___ 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] runStateT execution times measurement baffling
Hello - I've been trying to measure execution time for some code I'm running with the StateT monad transformer. I have a function f :: StateT MyState IO a Now, I measure the time it takes to run an invocation of this function from beginning to end, i.e. f = do t0 - getCurrentTime stuffToDo t1 - getCurrentTime liftIO $ putStrLn (show $ diffUTCTime t1 t0) And also measure like this: g :: IO g = do t0 - getCurrentTime (val,newState) - runStateT f initialState t1 - getCurrentTime putStrLn $ outside: ++ (show $ diffUTCTime t1 t0) Curiously, the times reported for outside are about 5-8 times as long. I should probably note that stuffToDo calls itself a few hundred times (and uses liftIO once per loop). Anyone with ideas on why runStateT apparently has so much overhead? By the way I'm using ghc-6.10.4 and Control.Monad.Trans.State.Strict. Thanks for any suggestions or advice. Thomas ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] runStateT execution times measurement baffling
On Thu, Oct 20, 2011 at 10:38 AM, thomas burt thedwa...@gmail.com wrote: Curiously, the times reported for outside are about 5-8 times as long. What is the cost of putStrLn relative to performing `stuffToDo` a few hundred times? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] New rss maintainer
Hello, I've a small patch[1] that updates the rss package to the latest versions of its dependencies. (I'm trying to get the new hackage-server to build on ghc-7.2.1) However Bjorn Bringert told me he's no longer maintaining the package. He asked me to ask you if there's already a new maintainer. If not, does any one want to take over the package? Jeremy, maybe you? Otherwise I could take it over. I probably won't make lots of changes since I'm a bit swamped at the moment. Just updating it to the latest versions. Regards, Bas [1] http://code.haskell.org/~basvandijk/update_rss.dpatch ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE: vector-bytestring-0.0.0.0
On Wed, Oct 19, 2011 at 9:29 PM, Ketil Malde ke...@malde.org wrote: Michael Snoyman mich...@snoyman.com writes: sense to try and pursue something like what you're suggesting, but I think the default Show (Vector Word8) should be the one most useful, most of the time, and I think the general consensus seems to be the current ByteString instance fits that role. Hm. I think it is slightly weird to display a numeric value (Word8) as a Char. Also, I would prefer a representation making the type explicit (but unlike ByteString, vector seems to add a type annotation.) Would you still support the truncating behavior for 'read' and values above 255? (ByteString has two interfaces, ByteString and .Char8, but as there can be only one Show instance, I see why it works the way it does.) Perhaps the correct semantic approach would be to have: newtype Char8 = Char8 Word8 But I think that will break far too many applications to try to get it implemented. In an ideal world, I agree with both points: displaying a numeric value as a Char doesn't make sense, and there are definitely issues with the Read instance. However, I still think current behavior is the least of all available evils. Show/Read work properly as a pair and can encode/decode any ByteString, and there's never any presumption that all input to read is valid. Michael ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Data.Vector.Mutable.mapM
Hi, I’m consdering to change some performance critical code from Vector to MVector, hopefully avoiding a lot of copying and garbage collecting. But it seems that the Data.Vector.Mutable interface at http://hackage.haskell.org/packages/archive/vector/0.9/doc/html/Data-Vector-Mutable.html is quite limited; e.g. I am missing simple functions having type modifyM :: PrimMonad m = (a - m a) - MVector (PrimState m) a - m () that would do something with each element in the vector. Is this an indication that such use is actually not desired, or is it just the case that nobody has developed that yet? Thanks, Joachim -- Joachim nomeata Breitner m...@joachim-breitner.de | nome...@debian.org | GPG: 0x4743206C xmpp: nome...@joachim-breitner.de | http://www.joachim-breitner.de/ signature.asc Description: This is a digitally signed message part ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] runStateT execution times measurement baffling
On Thu, Oct 20, 2011 at 11:59 AM, David Barbour dmbarb...@gmail.com wrote: On Thu, Oct 20, 2011 at 10:38 AM, thomas burt thedwa...@gmail.com wrote: Curiously, the times reported for outside are about 5-8 times as long. What is the cost of putStrLn relative to performing `stuffToDo` a few hundred times? I am not sure it still takes about 5-8 times longer whether `stuffToDo` recurs a few times, a hunded times, or about a thousand times. Perhaps I will try and force `stuffToDo` not to leave any partially evaluated thunks behind and compare the cost then. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] lost in generics
On 20 October 2011 18:12, Rustom Mody rustompm...@gmail.com wrote: I need some help finding my way around the various generics libraries. My usage scenario is -- at least to start with -- the ASTs of programming languages. In general my question is: What is alive/active and what is alive/active and what is -- um -- moved-on-from. And of course which are easier and which more difficult to dig into. I'd group Strafunski, Uniplate and Kure together as they are all have extensive traversal control. Uniplate is a good choice as it is well documented and in active use. Kure is good if you know Strafunski, but might be a struggle to work with otherwise. Strafunski was pre-Hackage and used Drift for pre-processing so installing it nowadays would be a challenge. However, Strafunksi is well documented, especially the Design Patterns for Functional Strategic Programming[*] paper. Its worth reading this even if you don't use Strafunski. [*] http://arxiv.org/abs/cs/0204015 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Data.Vector.Mutable.mapM
Joachim Breitner m...@joachim-breitner.de wrote: I’m consdering to change some performance critical code from Vector to MVector, hopefully avoiding a lot of copying and garbage collecting. But it seems that the Data.Vector.Mutable interface at http://hackage.haskell.org/packages/archive/vector/0.9/doc/html/Data-Vector-Mutable.html is quite limited; e.g. I am missing simple functions having type modifyM :: PrimMonad m = (a - m a) - MVector (PrimState m) a - m () that would do something with each element in the vector. Is this an indication that such use is actually not desired, or is it just the case that nobody has developed that yet? In general you should try to work with immutable vectors as much as possible. Done properly you shouldn't lose much performance that way. However, sometimes an operation is just much easier to express and faster with the MVector interface. In these cases you can escape to the mutable interface using 'create', 'modify', 'thaw' and 'freeze'. Don't forget that you lose fusion that way, though. In other words: Don't use MVector exclusively. Use it only when you really need it. Greets, Ertugrul -- nightmare = unsafePerformIO (getWrongWife = sex) http://ertes.de/ signature.asc Description: PGP signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to implement a digital filter, using Arrows?
On 21/10/2011 3:00 AM, David Barbour wrote: the f in (Automaton f) is a pure funtion runAuto is deconstructing the arrow by pattern matching then applying the function to the input to obtain the result and the continuation. i.e. runAuto takes an arrow and applies it to a value. On Thu, Oct 20, 2011 at 5:19 AM, Captain Freakocapn.fre...@gmail.comwrote: Hi David, I was referring to the `f' in the `runAuto' function, not the `liftAu' function. -db Ah, I see. You quoted one thing and spoke of another, and I got all confused. Keep in mind that functions are arrows (instance Arrow (-)). type FilterAu b c = Automaton (-) b c runAuto :: FilterAu b c - [b] - [c] runAuto a [] = [] runAuto (Automaton f) (x:xs) = let (y,a) = f x in y:runAuto a xs ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] lost in generics
On 20 October 2011 19:12, Rustom Mody rustompm...@gmail.com wrote: And of course which are easier and which more difficult to dig into. If you're looking for an example for the new GHC generic mechanism: I recently added a generic default implementation to the ToJSON and FromJSON type classes of the aeson package (not in mainline yet): class ToJSON a where toJSON :: a - Value default toJSON :: (Generic a, GToJSON (Rep a)) = a - Value toJSON = gToJSON . from class FromJSON a where parseJSON :: Value - Parser a default parseJSON :: (Generic a, GFromJSON (Rep a)) = Value - Parser a parseJSON = fmap to . gParseJSON See: https://github.com/basvandijk/aeson/blob/newGenerics/Data/Aeson/Types/Internal.hs#L895 It wasn't that difficult to implement. However I did need to use some advanced type-level tricks to convert to and from records. Regards, Bas ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe