[Haskell-cafe] ANNOUNCE: dbus-core 0.9
D-Bus implementation for Haskell (dbus-core_0.9) This is the first significant release to dbus-core in a while, and it contains some significant improvements to both the API and implementation. Users are advised to upgrade, as the 0.8 branch will no longer be receiving improvements or corrections. * Release announcement: https://john-millikin.com/releases/dbus-core/0.9/ * API documentation: http://hackage.haskell.org/package/dbus-core * Source code (literate PDF): https://john-millikin.com/downloads/dbus-core_0.9.pdf * Source code (tarball): https://john-millikin.com/downloads/dbus-core_0.9.tar.gz Changes in release 0.9 == The biggest change in this release is that dbus-client has been merged into dbus-core. The original purpose of dbus-client (as a very high-level, often-updated support library) never materialized, and the split packaging caused issues with dependencies and versioning. The parts of dbus-client that were commonly used were moved into the DBus.Client and DBus.Client.Simple modules. Users are highly encouraged to use these modules in their applications. Other changes and improvements include: * The Array, Dictionary, and Structure types are no longer needed for most users. You can cast containers directly to corresponding standard types, such as Vector and Map. * Smart constructors for magic strings have been renamed so they're easier to read and type; for example, mkBusName is now just busName. * Support for custom transports and authentication mechanisms. * Removed some seldom-used modules, such as MatchRule and NameReservation. Their functionality has been merged into the new client modules. * Performance improvements for marshaling and unmarshaling messages. How to use the new simple client API The new API makes calling and exporting methods very easy; take a look at these examples! Getting a list of connected clients --- {-# LANGUAGE OverloadedStrings #-} module Main (main) where import Data.List (sort) import DBus.Client.Simple main :: IO () main = do client - connectSession -- Request a list of connected clients from the bus bus - proxy client org.freedesktop.DBus /org/freedesktop/DBus reply - call bus org.freedesktop.DBus ListNames [] -- org.freedesktop.DBus.ListNames returns a single value, which is -- a list of names. let Just names = fromVariant (reply !! 0) -- Print each name on a line, sorted so reserved names are below -- temporary names. mapM_ putStrLn (sort names) Exporting methods - {-# LANGUAGE OverloadedStrings #-} module Main (main) where import Control.Concurrent (threadDelay) import Control.Monad (forever) import DBus.Client.Simple onEcho :: String - IO String onEcho str = do putStrLn str return str onDivide :: Double - Double - IO Double onDivide x y = if y == 0 then throwError com.example.DivisionByZero Divided by zero [] else return (x / y) main :: IO () main = do client - connectSession -- Request a unique name on the bus. If the name is already -- in use, continue without it. requestName client com.example.ExportExample [] -- Export an example object at /divide export client /divide [ method com.example.Echo Echo onEcho , method com.example.Math Divide onDivide ] -- Wait forever for method calls forever (threadDelay 5) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Monad for binary tree data structure
2011/7/23 Александр kommunist1...@mail.ru: Hello, I built binary tree with: data Tree a = Empty | Node a (Tree a) (Tree a) deriving (Eq, Ord, Read, Show) How can i make Monad type class instance for this tree? And can i make it on not? i try: instance Monad Tree where return x = Node x Empty Empty Empty = f = Empty (Node x Empty Empty) = f = f x 1) Do you really need a Monad instance for this? 2) One possibility is just have it being (Node x _ _) = f = f x -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Monad for binary tree data structure
Hello, 1) Do you really need a Monad instance for this? Only for training purposes. 2) One possibility is just have it being (Node x _ _) = f = f x I've already tried to do so, but i get only 1 element. Look. I have a function fillTree that's fill this binary tree. let a = fillTree 1 Empty a = \x - return (x * 2) I got: Node 2 Empty Empty But i have tree with 100 elements. Thank you. Thank you. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Monad for binary tree data structure
2011/7/23 Александр kommunist1...@mail.ru: I built binary tree with: data Tree a = Empty | Node a (Tree a) (Tree a) deriving (Eq, Ord, Read, Show) How can i make Monad type class instance for this tree? And can i make it on not? If you had a monad for Tree a, then you'd have join :: Tree (Tree a) - Tree a join x = x = id It is non-obvious for me how such function would behave. (I'm not saying it's impossible.) However, you may try with a different binary tree, having data only on the leafs: data Tree a = Leaf a | Node (Tree a) (Tree a) It's pretty easy to define it as a monad: instance Monad Tree where return = Leaf Leaf a = f = f a Node l r = f = Node (l = f) (r = r) Then you get basically: join :: Tree (Tree a) - Tree a join (Left t) = t join (Node l r) = Node (join l) (join r) In other words, join just glues the trees on the leafs to the tree itself. It's kinda straightforward. Cheers, -- Felipe. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Monad for binary tree data structure
2011/7/23 Александр kommunist1...@mail.ru: Hello, 1) Do you really need a Monad instance for this? Only for training purposes. Then if you _must_ define Monad instances, maybe you should consider one for a data structure which makes more sense? 2) One possibility is just have it being (Node x _ _) = f = f x I've already tried to do so, but i get only 1 element. Look. I have a function fillTree that's fill this binary tree. let a = fillTree 1 Empty a = \x - return (x * 2) I got: Node 2 Empty Empty Well, yes, but that's the fault of your `f' ! ;-) But i have tree with 100 elements. OK, an alternative would be to adapt the approach taken for lists, which uses a right-fold. The problem that I see for this is how to combine the resulting trees from applying = f recursively on the right and left sub-trees with the left and right sub-trees in f x. -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Monad for binary tree data structure
2011/7/22 Александр kommunist1...@mail.ru How can i make Monad type class instance for this tree? And can i make it on not? You'll apply 'f' to every node in the tree. You'll need some sensible mechanism to merge the resulting trees. You might have an easier time for merging a slightly different tree type: Tree a = Leaf a | Node (Tree a) (Tree a) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ghc on arm status
On Wed, 20 Jul 2011 23:36:34 +0400 Sergey Mironov ier...@gmail.com wrote: Hi. I was searching for info about building ghc on ARM arch. I already know about [1] approach, and also saw debian binaries [2], but I am afraid I have to compile ghc by myself this time, since our system uses incompatible libc, so my question is addressed to gentoo users and sympathetic :) Did anybody see any working (currently or in the past) dev-lang/ghc arm ebuild? Which arm do you have? gentoo-haskell overlay got arm v5 binaries recently. I haven't got to test it on armv7 yet, but I expect it to work. https://github.com/gentoo-haskell/gentoo-haskell/blob/700677545a4e8b2f583c3641b99cd4c9588e9655/dev-lang/ghc/ghc-7.0.4.ebuild Gentoo uses ghc built against glibc, but I think it's feasible to bootstrap to non-glibc host as well. You would need to have 2 toolchains simultaneously so some sorts of hacks is required. Do you really need uclibc? Ghc is a relatively heavyweight thing. I would expect a need to path ghc to run it there. You might also like to look at jhc. It is able to cross-compile to other targets, but it's not a drop-in replacement of ghc. https://github.com/gentoo-haskell/gentoo-haskell/blob/700677545a4e8b2f583c3641b99cd4c9588e9655/dev-lang/jhc/jhc-.ebuild Ebuilds are hidden in haskell overlay (accessible via layman). -- Sergei signature.asc Description: PGP signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Monad for binary tree data structure
On Jul 23, 2011, at 7:31 AM, Александр wrote: data Tree a = Empty | Node a (Tree a) (Tree a) deriving (Eq, Ord, Read, Show) How can i make Monad type class instance for this tree? Like David said, you'll need a sensible way to merge 2 trees. As we have no Ord a, the only sensible thing to do is to append them, so the order of the elements is maintained and then the Monad instance will work like the list monad. First we'll have to agree on the ordering, I'll assume: toList :: Tree a - [a] toList Empty = [] toList (Node a l r) = toList l ++ [a] ++ toList r Next is the append function. Let's make a Monoid instance for extra fun. (You'll need to import Data.Monoid) instance Monoid (Tree a) where mempty = Empty mappend Empty x = x mappend (Node a l r) x = Node a l (mappend r x) This will generate unbalanced trees, but it'll have to do. Now the Monad instance: instance Monad Tree where return a = Node a Empty Empty Empty = _ = Empty Node a l r = f = case f a of Empty - (l = f) `mappend` (r = f) Node b lb rb - Node b ((l = f) `mappend` lb) (rb `mappend` (r = f)) Let's see if this indeed behaves like the list monad. fromList :: [a] - Tree a fromList [] = Empty fromList xs = Node a (fromList l) (fromList r) where (l, a:r) = splitAt (length xs `div` 2) xs toList $ fromList [10,20,30] = (\x - fromList [x - 1, x, x + 1]) [9,10,11,19,20,21,29,30,31] It works! -- Sjoerd Visscher ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cloud Haskell
On Fri, Jul 22, 2011 at 4:11 PM, Tom Murphy amin...@gmail.com wrote: Is anyone using Cloud Haskell yet? I'm really excited by the possibilities. Hello there! I'm currently looking at the possibility of incorporating it into my masters thesis project (A Haskell EDSL for agent-based simulation), but haven't yet implemented the part of the project that'll use it. I'd also be interested in anyone else's experiences with it as it seems like a fairly young project, and will try and write up some of my own once I've got a bit further with it! Thanks, Tim ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Github support for cabal files
Hello everybody I'm looking for a way to avoid having two files with almost the same information on github: README.markdown and package.cabal. As far as I can tell, a new github README parser[1] can be written, but it only supports README files with different extensions and requires either ruby or a script which converts stdin into html. Another solution would be that haddock supports a README file, just like github, as the index.html of the cabal package. Github houses a lot of cabal packages so more people could benefit from this solution. Greetings Joris [1]: https://github.com/github/markup ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Github support for cabal files
On 23 July 2011 10:35, Joris Putcuyps joris.putcu...@gmail.com wrote: Hello everybody I'm looking for a way to avoid having two files with almost the same information on github: README.markdown and package.cabal. As far as I can tell, a new github README parser[1] can be written, but it only supports README files with different extensions and requires either ruby or a script which converts stdin into html. Another solution would be that haddock supports a README file, just like github, as the index.html of the cabal package. Github houses a lot of cabal packages so more people could benefit from this solution. Greetings Joris [1]: https://github.com/github/markup I don't have any of my packages on Github, but I'd like to point out a few things: 1) The description field in a .cabal file uses Haddock syntax (and a slightly mangled one at that, what with not being able to have blank lines) rather than Markdown. 2) I see the package description and a README as being two different things: the description gives you an overview of what a package is/does and why you'd want to use it, the README gives you more information about _how_ you'd use it. There is some overlap, but it's usually in the sense that the description in the .cabal file as being a subset of the README. That said, it would be nice if Cabal supported explicit fields for README, TODO, ChangeLog, etc. files rather than banging them all in Extra-Source-Files. -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Github support for cabal files
Hi Joris, not exactly what you are think about, but still maybe somewhat related. I thought it would be nice to have support for literate Haskell in README files (say README.lhs) on GitHub. I've done something similar for WAI[1], using sed to transform it to markdown, native support support for README.lhs would still be nice. That said, I think if you'd integrate cabal support into GitHub's README facility, README.* should still have precedence. Cheers, Simon [1] https://github.com/yesodweb/wai/tree/master/wai ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Github support for cabal files
On Sat, 23 Jul 2011 10:47:18 + Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: On 23 July 2011 10:35, Joris Putcuyps joris.putcu...@gmail.com wrote: Hello everybody I'm looking for a way to avoid having two files with almost the same information on github: README.markdown and package.cabal. As far as I can tell, a new github README parser[1] can be written, but it only supports README files with different extensions and requires either ruby or a script which converts stdin into html. Another solution would be that haddock supports a README file, just like github, as the index.html of the cabal package. Github houses a lot of cabal packages so more people could benefit from this solution. Greetings Joris [1]: https://github.com/github/markup I don't have any of my packages on Github, but I'd like to point out a few things: 1) The description field in a .cabal file uses Haddock syntax (and a slightly mangled one at that, what with not being able to have blank lines) rather than Markdown. 2) I see the package description and a README as being two different things: the description gives you an overview of what a package is/does and why you'd want to use it, the README gives you more information about _how_ you'd use it. There is some overlap, but it's usually in the sense that the description in the .cabal file as being a subset of the README. That said, it would be nice if Cabal supported explicit fields for README, TODO, ChangeLog, etc. files rather than banging them all in Extra-Source-Files. Hello About your first point, I'm aware of that. It would have been nice if .cabal and haddock used markdown, this is very popular, thanks to pandoc. Then generating html, pdf, texinfo, ... would be very easy. When you create a package in github you add a short description, probably the same as the synopsis from .cabal. The description from .cabal could still go in the README. I agree that the README will probably contain more than just a description, it is more like a man page. Having this also parsed by haddock for the html docs would also make me content. Joris ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Github support for cabal files
On 23 July 2011 21:33, Joris Putcuyps joris.putcu...@gmail.com wrote: About your first point, I'm aware of that. It would have been nice if .cabal and haddock used markdown, this is very popular, thanks to pandoc. Then generating html, pdf, texinfo, ... would be very easy. This has been suggested before, e.g. http://haskell.1045720.n5.nabble.com/GSoC-Project-A-Haddock-Pandoc-documentation-tool-td3117580.html ; it just requires someone to implement it (I don't think that GSoC submission was successful). When you create a package in github you add a short description, probably the same as the synopsis from .cabal. The description from .cabal could still go in the README. I agree that the README will probably contain more than just a description, it is more like a man page. Having this also parsed by haddock for the html docs would also make me content. I think the README is more suitable for a website than Haddock docs; e.g. a README for haskell projects typically has at some point to get this, do `cabal install foo' which you don't really need for Haddock docs (as you're either already reading them on your machine after they've been installed, or on Haddock in which case a central specification of how to use cabal-install is more appropriate than repeating it multiple times). -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] question regarding the $ apply operator
I know the Reverse Polish is not a couple of hundred years old. I have an impression of reading something about people writing natural deduction systems using only dots in place of parenthesis. And it is said that it was natural in those pre-historic times. That's also why I had this (mis-)conception that ($) can be used to achieve something similar. It would be marginally interesting, since it saves us one character in the mental stack. I still remember looking at the parentheses in a lisp program. Anyways, thanks for the clarifications. On 19 July 2011 09:51, Maciej Marcin Piechotka uzytkown...@gmail.com wrote: On Tue, 2011-07-19 at 07:11 +, Ivan Lazar Miljenovic wrote: The only thing that I can think of that matches this is Reverse Polish Notation, and according to Wikipedia was about 90 years ago, not hundreds ;-) I may be wrong but weren't the RPN calculator slightly later then 90 years ago? In any case according to wikipedia RPN was proposed in 1954 so less then 60 years ago. (PN on the other hand was found around 90 years ago). You're right; I mis-read the wikipedia article whilst skimming it. -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] question regarding the $ apply operator
On Sat, 2011-07-23 at 06:37 -0700, Ting Lei wrote: I know the Reverse Polish is not a couple of hundred years old. I have an impression of reading something about people writing natural deduction systems using only dots in place of parenthesis. And it is said that it was natural in those pre-historic times. That's also why I had this (mis-)conception that ($) can be used to achieve something similar. It would be marginally interesting, since it saves us one character in the mental stack. I still remember looking at the parentheses in a lisp program. Anyways, thanks for the clarifications. Hmm. Maybe highlighting the parenthesis would help in more complicated expressions. I.e. the matching parenthesis are coloured in the same colour. For example )())())) rgbyyccbppgr r - red g - green b - blue c - black p - pink Regards 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] Why the reluctance to introduce the Functor requirement on Monad?
Would it be theoretically possible/convenient to be able to put boilerplate like this in class definitions? On Thu, Jul 21, 2011 at 5:58 AM, Felipe Almeida Lessa felipe.le...@gmail.com wrote: On Thu, Jul 21, 2011 at 8:31 AM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: Well, for fmap vs liftM, you have that liftM is automatically defined for you rather than needing to make the Functor instance, so if you're quickly defining a Monad for internal use then you can just use liftM, etc. without needing to also make Functor and Applicative instances (note that AFAIK, return and pure are the same thing, in that return isn't automatically defined like liftM is). Note that even if we had class Applicative m = Monad m where ..., we could say data X a = ... instance Functor X where fmap = liftM instance Applicative X where pure = return (*) = ap instance Monad X where return = ... x = f = ... So you just need five more lines of boilerplate to define both Functor and Applicative. Cheers, -- Felipe. ___ 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] Monad for binary tree data structure
2) One possibility is just have it being (Node x _ _) = f = f x It does not follow monad laws (right identity to be more precise): (Node 1 (Node 2 Empty Empty) Empty) = return ≡ return 1 ≡ Node 1 Empty Empty ≠ (Node 1 (Node 2 Empty Empty) Empty) Regards 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] Reactive Programming in Machine Learning
As far as I am aware, there has been very little work on combining these two, but that does not mean that it is a bad idea. I can give you some pointers from a very personal perspective: -Machine learning is mostly kernel methods and probabilistic inference, I can't really say much about how one would combine kernel methods and FRP, but more about probabilistic inference. -I work in physiology and we use FRP for data acquisition and for classifying different kinds of evidence. It appears that most data -- observed or inferred -- can be described as signals or as events. We have a paper about this but it is not yet published. -We do data analysis by building probabilistic models (i.e. probability distributions) for the reactive objects, i.e. signals or events, and applying bayesian inference to learn the parameters of these models. Lots of this work consists of thinking about what would be a good probability distribution for a signal or an event. -Gaussian processes make very good models for real-valued signals, especially when your underlying model is a stochastic differential equation (some of which can be rewritten as gaussian processes). -for events we use point processes such as the poisson processes. -I would love to work on probabilistic reactive control, but don't really have the time. You could use sequential monte carlo/particle filters to iteratively estimate the value of unobserved time-varying quantities and the use FRP-like systems to wire this up to an output signal. If you want to learn more about sequential monte carlo, there are lots of videos on videolectures.net. Nando de Freitas has a good introduction. Tom On Sat, Jul 23, 2011 at 2:30 AM, bob zhang bobzhang1...@gmail.com wrote: Hi all, I am doing a survey on combining Functional Reactive Programming and Machine Learning. Has anyone did relevant research on this topic? Any discussion or link is appreciable. Best,bob ___ 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] Slightly tangential topic about functional programming (specifically, Lambda-Calculus)
Hi everybody - I'm just starting to learn Haskell, and I figured it would be productive to first review my Lambda-Calculus that I picked up in college. Actually, we only touched upon it in college, so I'm effective learning it all over again for the first time. Anyway, I'm working my way through a textbook, and questions come up periodically, of course. My question - does anybody here belong to a forum, mailing list, or any other medium through which I might be able to engage some knowledgeable sources on Lambda-Calculus, and functional programming in general? (By the way, been hacking in Haskell for only two weeks and I'm already falling in love with it!) Thanks, and I look forward to 'chatting' with you all on more on-topic subjects in the future! Shaun shaunli...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Slightly tangential topic about functional programming (specifically, Lambda-Calculus)
I highly recommend that you check out #haskell on freenode. In my opinion its the best channel on freenode, and there are always tons of helpful people and a lot of stimulating conversation. Hope to see you there! ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] For class Monoid; better names than mempty mappend might have been: mid (mident) mbinop
It would be easier for beginners to grok. -- -- Regards, KC ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Reactive Programming in Machine Learning
I have spent several months studying use of generative grammars in multi-agent reactive systems [1] - granted, not FRP in particular, but RDP is reasonably close [2]. This result is, implicitly, a distributed, federated machine-learning system (briefly described at [3]). The 'learning' supports rapid agreement between agents and eliminating the volatility seen in a stateless reactive model. Individual agents are simple; intelligence in this model emerges only as we scale. It's a very simple learning model: individually, agents try to generate grammars that that are (based on history) likely to be accepted by other agents. Developers control what can be learned by specifying a non-deterministic choice in the generative grammar (i.e. non-determinism is seen as 'permission to choose and learn', not 'random'). By a simple extension of grammars with time (i.e. a grammar generates a sentence that says not just what to do, but when to do it), I believe I can achieve a huge level of intelligent coordination and cooperation between agents. I.e. they'll automatically schedule their activities, and reactively adjust to accommodate changes in plans or the introduction of new agents. I tabled further study of this promising model until I sufficiently develop RDP, which is far more suitable than FRP for open, scalable systems. [1] http://lambda-the-ultimate.org/node/4012 [2] http://awelonblue.wordpress.com/2011/05/21/comparing-frp-to-rdp/ [3] http://lambda-the-ultimate.org/node/4012#comment-62877http://lambda-the-ultimate.org/node/4012#comment-63105 On Fri, Jul 22, 2011 at 11:30 AM, bob zhang bobzhang1...@gmail.com wrote: Hi all, I am doing a survey on combining Functional Reactive Programming and Machine Learning. Has anyone did relevant research on this topic? Any discussion or link is appreciable. Best,bob ___ 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] OpenGL vs OpenGLRaw
Hello Café, Where do you people stand on using OpenGLRaw instead of the higher-level layer? I saw that the ports of the nehe tutorial use directly OpenGLRaw, and I wondered why that choice had been made. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] OpenGL vs OpenGLRaw
Translation from c is much more straightforward with openglraw compared with OpenGL. Also, many of the design decisions behind OpenGL are arbitrary or limiting, and some features aren't even exposed in its interface. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] OpenGL vs OpenGLRaw
I'm a bit curious about who might be using GPipe. I've been trying to find a good variation on OpenGL that integrates nicely with reactive programming. Issues such as texture management seem to be rather difficult targets. On Sat, Jul 23, 2011 at 12:06 PM, Jake McArthur jake.mcart...@gmail.comwrote: Translation from c is much more straightforward with openglraw compared with OpenGL. Also, many of the design decisions behind OpenGL are arbitrary or limiting, and some features aren't even exposed in its interface. ___ 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] OpenGL vs OpenGLRaw
On Sat, Jul 23, 2011 at 8:51 PM, Yves Parès limestr...@gmail.com wrote: Hello Café, Where do you people stand on using OpenGLRaw instead of the higher-level layer? I saw that the ports of the nehe tutorial use directly OpenGLRaw, and I wondered why that choice had been made. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe Hi, I was/am working on improving the OpenGL package. My view on things is that the Raw package is a pure ffi package that imports the C functions for use in haskell. The OpenGL package tries to make a more type safe interface on top of the Raw package. I think that the nehe tutorials are more easily and readable ported to the raw package (as it's using the raw C). The following is my viewpoint on the current packages, Some reasons for using the Raw package might be - more constant API, it's the raw C api, while the OpenGL package sometimes changes due to adding functionality. - functionality is supported earlier in the Raw package. Some reasons for using the OpenGL package - Better type safety (can't mismatch a Shader and program identifier) - Utility and typeclass (overloaded) functions The biggest disadvantage of the OpenGL package is that it is a bit outdated from the viewpoint of OpenGL functions, I was/am trying to add support for 3.0 and later. Hopefully the package OpenGL will improve over time to include functions for the newer OpenGL API versions. One other option, though not the nicest from somepoints, is using both. The idea is to use where ever possible the functions of the OpenGL package, and where necessary unsafeCoerce the object to the Identifier used by OpenGL and use that for the Raw function. This works because all (as far as I know) the OpenGL objects are represented by newtypes. Hopefully the number of functions where this is needed will be reduced in the near future, as there are quite some points where they are needed (Mostly for OpenGL = 3.0). Lars Corbijn ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] question regarding the $ apply operator
On 7/23/11 9:37 AM, Ting Lei wrote: I know the Reverse Polish is not a couple of hundred years old. I have an impression of reading something about people writing natural deduction systems using only dots in place of parenthesis. And it is said that it was natural in those pre-historic times. The dot notation was used in Principia Mathematica (1910--1913), where differing numbers of dots represented differing levels of grouping (N.B., not quite the same as depth of grouping, i.e. count of parentheses, as indicated by expressions such as p . = . q V r where, because the right dot is required for grouping the disjunct, we must also introduce the left dot in order to ensure that the p, the equality symbol, and the disjunctive expression are all on the same level). The dots were also used to represent logical conjunction. However parentheses, brackets, and braces do show up occasionally without much explanation as to their meaning. Whitehead and Russell claim to have taken the dot notation from Peano. In fact, the dot notation is the origin of the period in the current notation for binding forms like lambda, Pi, Sigma, forall, and exists; as well as, IIRC, the origin of the colon for typing expressions and set comprehensions. The PM notation for quantifications were (x) . P (exists x) . P and more-modern philosophical texts retain this notation sans the period. It is by far the most baffling notation IMO. The other popular notation in modern philosophical texts is to replace the period by bracketing, leading to forall x[P] exists x[P] Note that an apparent variant latter with the forall elided, is actually a notation for expressing an open term P (N.B., not an abstraction) which dates back to Frege. -- Live well, ~wren ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Monad for binary tree data structure
On 7/23/11 1:31 AM, #1040;#1083;#1077;#1082;#1089;#1072;#1085;#1076;#1088; wrote: Hello, I built binary tree with: data Tree a = Empty | Node a (Tree a) (Tree a) deriving (Eq, Ord, Read, Show) How can i make Monad type class instance for this tree? And can i make it on not? Of course you can. One way of thinking about monads is that it's just performing substitution, aka tree grafting. In this case, because the variables being substituted for are located within the tree, we need to make sure to distribute the substructure of the original tree over the result of substituting for the variable. Thus, we can define: data Tree a = Empty | Node a (Tree a) (Tree a) deriving (Eq, Ord, Read, Show) -- This one should be obvious. instance Functor Tree where fmap f Empty= Empty fmap f (Node x l r) = Node (f x) (fmap f l) (fmap f r) -- | The tree @graft gl gr t@ is the result of grafting @gl@ in -- place of all left @Empty@ leaves and @gr@ in place of all -- right @Empty@ leaves; with the empty tree mapped to itself. graft :: Tree a - Tree a - Tree a - Tree a graft gl gr = go where go Empty= Empty go (Node x Empty Empty) = Node x gl gr go (Node x Empty r) = Node x gl (go r) go (Node x l Empty) = Node x (go l) gr go (Node x l r) = Node x (go l) (go r) instance Monad Tree where return x = Node x Empty Empty Empty = _ = Empty Node x l r = f = graft (l = f) (r = f) (f x) And we can verify the correctness by using QuickCheck or lazy SmallCheck: import Control.Monad ((=)) import Test.QuickCheck instance Arbitrary a = Arbitrary (Tree a) where arbitrary = do b - elements [True,False] if b then return Empty else do x - arbitrary l - arbitrary r - arbitrary return (Node x l r) -- | Extensional function equality. (f === g) x = f x == g x prop_mapIdentity = fmap id === id prop_mapCompose f g = (fmap f . fmap g) === fmap (f . g) prop_leftUnit f =(return = f) === f prop_rightUnit f =(f = return) === f prop_assoc f g h = (f = (g = h)) === ((f = g) = h) Of course, there are other monads as well. In particular, for any semigroup on A there is a monad for Tree A. For these instances we would want to define a merging function: -- | The first argument is an associative operation for resolving -- conflicts in merging. Non-conflicts are resolved by assuming -- an identity element for the operation, thus lifting it into a -- monoid. merge :: (a - a - a) - Tree a - Tree a - Tree a merge _ Empty tr= tr merge _ tlEmpty = tl merge f (Node x xl xr) (Node y yl yr) = Node (f x y) (merge f xl yl) (merge f xr yr) Of course, there are only two semigroups which are parametric in A, hence there are only two more Monad instances we can define this way. newtype Tree2 a = T2 (Tree a) deriving (Eq, Ord, Read, Show) instance Monad Tree2 where return x = T2 $ Node x Empty Empty T2 Empty = _ = T2 Empty T2(Node x xl xr) = f = case f x of T2 Empty - T2 Empty T2 (Node y yl yr) - T2 $ Node y (merge' yl (T2 xl = f)) (merge' yr (T2 xr = f)) where merge' xs (T2 ys) = merge const xs ys instance Arbitrary a = Arbitrary (Tree2 a) where arbitrary = arbitrary = (return . T2) And we can similarly define Tree3 with (flip const) in place of const. All the other monads formed this way (with any semigroup operation in place of const) would require using a type class for restricted monads since we need to restrict the element type to support the semigroup operation we want to use. -- Live well, ~wren ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Why the reluctance to introduce the Functor requirement on Monad?
On 24 July 2011 00:49, Sebastien Zany sebast...@chaoticresearch.com wrote: Would it be theoretically possible/convenient to be able to put boilerplate like this in class definitions? Not really: what happens for Functors that aren't Monads? Also, for some Monads there may be a more efficient definition of fmap than using liftM, so even an automatic reverse instance wouldn't always be wanted. -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] For class Monoid; better names than mempty mappend might have been: mid (mident) mbinop
On 24 July 2011 04:41, KC kc1...@gmail.com wrote: It would be easier for beginners to grok. I don't think so... but while we're at it, what's with that weird name Monoid anyway, let alone Functor, Monad, etc.? ;-) -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANN: shelltestrunner 1.0
I'm pleased to announce the 1.0 release of shelltestrunner! Home page: http://joyful.com/repos/shelltestrunner Install: $ cabal install shelltestrunner shelltestrunner tests command-line programs or arbitrary shell commands. It reads simple declarative tests specifying a command, some input, and the expected output, error output and exit status. Tests can be run selectively, in parallel, with a timeout, in color, and/or with differences highlighted. Projects using it include hledger, yesod, and berp. shelltestrunner is free software released under GPLv3+. I started shelltestrunner two years ago, inspired by John Wiegley's ledger tests. John Macfarlane, Bernie Pope and Trygve Laugst?l have contributed code. The hackage page shows the libraries it relies on - most notably, Max Bolingbroke's test-framework. The site uses hakyll, pandoc hamlet. New in 1.0: * New home page/docs * The `=` field is now required; you may need to add it to your existing tests * Input and expected output can now contain lines beginning with `#` * Multiple tests in a file may now have whitespace between them * The `-i/--implicit` option has been dropped * New `-d/--diff` option shows test failures as a unified diff when possible, including line numbers to help locate the problem * New `-x/--exclude` option skips certain test files (eg platform-specific ones) * Passing arguments through to test-framework is now more robust * Fixed: parsing could fail when input contained left angle brackets * Fixed: some test files generated an extra blank test at the end ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] For class Monoid; better names than mempty mappend might have been: mid (mident) mbinop
On 24.07.2011 08:20, Ivan Lazar Miljenovic wrote: On 24 July 2011 04:41, KC kc1...@gmail.com wrote: It would be easier for beginners to grok. I quite like mempty/mappend; they (f)map onto the [] instance as a mnemonic. Similarly, MonadPlus (as a concept) maps to mzero/mplus quite well (and it's distinguishing the sets of empty/append and zero/plus that helps me remember which goes with what). mid and mbinop seem a bit more arbitrary, and don't 'look' as nice to me (though that's probably just because they're not as familiar as what we already have). ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Github support for cabal files
I think the haddock description field is a great barrior to documentation. I don't want to clutter my cabal file with lengthy documentation. Michael Snoyberg and I could not figure out how to document the Hamlet syntax because there is no way (as far as I know) to have literal unescaped, uninterpreted text. [1] When I go to a github repo, I expect that I can scroll down to the README and I will get a good overview. When I go to hackage, I expect nothing more than a synopsis, and I hope I can follow several links to find the information I am looking for. It is suggested that the description field should point to a top level module with all the documentation, but although haddock is good for documenting code, it is not an ideal overview style, and not all packages lend themselves well to having one top-level module. I would like a description field that just points to an external (README) file. Cabal could either use the pandoc library, or to avoid that dependency directly it could use the pandoc executable (that would have to be installed first by those of us that want this feature). Alternatively it could just allow an html file for the description and make me responsible for writing a script that runs pandoc and then invokes sdist. [1] http://hackage.haskell.org/package/hamlet ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe