Re: [Haskell-cafe] Haskell-Cafe Digest, Vol 99, Issue 9
Thank you so much Ivan!!! main :: IO ( ) main = let a = 8 b = 3 c = 15 in print(b / a * c) This code works!!! :) Julita On Fri, Nov 4, 2011 at 12:53 AM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: On 4 November 2011 16:21, yrazes yra...@gmail.com wrote: Hi This is a very simple basic case, but I have a little trouble with this... I hope somebody can help me First of all, it would help if you said what your actual trouble is. main :: IO() main = return :: f The return :: f bit here doesn't make any sense: * :: is used in type signatures, not as an operator in code; you shouldn't need it (assuming your definition of f below is meant to be there). tipos :: Int - Int - Int - Float tipos a b c f = b / a * c where (a,b,c) = (8,3,15) Your definition of tipos isn't complete... what you've actually defined is a new top-level value `f' (which is of type Fractional a = a). You need to actually have tipos a b c _equal_ something. Now, if you want to calculate b/a*c for inputs a, b and c, try something like this: import System.Environment(getArgs) main :: IO () main = do [a,b,c] - getArgs print $ tipos (read a) (read b) (read c) tipos :: Int - Int - Int - Double tipos a b c = fromIntegral b / fromIntegral b * fromIntegral c -- 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: websockets 0.4.0.0
Hello all, I'm pleased to announce the release of websockets [1] 0.4.0.0 today. You can grab it on Hackage [2]. This update brings an (almost completely rewritten) library which has support for multiple versions of the protocol, meaning you can choose to write backwards-compatible applications, or use the latest and greatest, all using a common API. All feedback is obviously welcome, I'd be glad to hear what you guys think. For the next version, client-side support is planned, so the library user can write clients in addition to servers. If there's any other feature you would like to see, feel free to let me know. [1]: http://jaspervdj.be/websockets/ [2]: http://hackage.haskell.org/package/websockets Cheers, Jasper ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is generic information dumpable?
Hi, Now, for the following datatype: data X a = X { myX :: a } deriving Generic You get the following -ddump-deriv output: Derived instances Derived instances: instance GHC.Generics.Generic (Temp.X a_adY) where GHC.Generics.from (Temp.X g1_aeG) = GHC.Generics.M1 (GHC.Generics.M1 (GHC.Generics.M1 (GHC.Generics.K1 g1_aeG))) GHC.Generics.to (GHC.Generics.M1 (GHC.Generics.M1 (GHC.Generics.M1 (GHC.Generics.K1 g1_aeH = Temp.X g1_aeH instance GHC.Generics.Datatype Temp.D1X where GHC.Generics.datatypeName _ = X GHC.Generics.moduleName _ = Temp instance GHC.Generics.Constructor Temp.C1_0X where GHC.Generics.conName _ = X GHC.Generics.conIsRecord _ = GHC.Types.True instance GHC.Generics.Selector Temp.S1_0_0X where GHC.Generics.selName _ = myX Generic representation: Generated datatypes for meta-information: Temp.D1X Temp.C1_0X Temp.S1_0_0X Representation types: Temp.Rep_X = GHC.Generics.D1 Temp.D1X (GHC.Generics.C1 Temp.C1_0X (GHC.Generics.S1 Temp.S1_0_0X (GHC.Generics.Par0 a_adY))) Still not perfect, in that the representation type should really appear as a type instance inside the Generic instance, but at least all the important information is printed. Cheers, Pedro 2011/11/3 Bas van Dijk v.dijk@gmail.com 2011/11/3 José Pedro Magalhães j...@cs.uu.nl: -ddump-deriv will print (most of) it. But it doesn't print the most useful piece of information: the definition of Rep. It would be great if this could be added. Currently when I have a type that I want to know the Rep of, say: data Foo = Bar Int | Boo {hello :: String} deriving Generic I just convert it to a Rep and show it: err = show $ from $ Boo World However Reps don't have Show instances so GHC complains: No instance for (Show (D1 D1Foo ( C1 C1_0Foo (S1 NoSelector (Rec0 Int)) :+: C1 C1_1Foo (S1 S1_1_0Foo (Rec0 String)) ) x0 ) ) arising from a use of `show' And there you go. This is the only time when I'm happy to see an error message :-) Bas ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is generic information dumpable?
Thanks José! Will this make it into ghc-7.4? Bas 2011/11/4 José Pedro Magalhães j...@cs.uu.nl: Hi, Now, for the following datatype: data X a = X { myX :: a } deriving Generic You get the following -ddump-deriv output: Derived instances Derived instances: instance GHC.Generics.Generic (Temp.X a_adY) where GHC.Generics.from (Temp.X g1_aeG) = GHC.Generics.M1 (GHC.Generics.M1 (GHC.Generics.M1 (GHC.Generics.K1 g1_aeG))) GHC.Generics.to (GHC.Generics.M1 (GHC.Generics.M1 (GHC.Generics.M1 (GHC.Generics.K1 g1_aeH = Temp.X g1_aeH instance GHC.Generics.Datatype Temp.D1X where GHC.Generics.datatypeName _ = X GHC.Generics.moduleName _ = Temp instance GHC.Generics.Constructor Temp.C1_0X where GHC.Generics.conName _ = X GHC.Generics.conIsRecord _ = GHC.Types.True instance GHC.Generics.Selector Temp.S1_0_0X where GHC.Generics.selName _ = myX Generic representation: Generated datatypes for meta-information: Temp.D1X Temp.C1_0X Temp.S1_0_0X Representation types: Temp.Rep_X = GHC.Generics.D1 Temp.D1X (GHC.Generics.C1 Temp.C1_0X (GHC.Generics.S1 Temp.S1_0_0X (GHC.Generics.Par0 a_adY))) Still not perfect, in that the representation type should really appear as a type instance inside the Generic instance, but at least all the important information is printed. Cheers, Pedro 2011/11/3 Bas van Dijk v.dijk@gmail.com 2011/11/3 José Pedro Magalhães j...@cs.uu.nl: -ddump-deriv will print (most of) it. But it doesn't print the most useful piece of information: the definition of Rep. It would be great if this could be added. Currently when I have a type that I want to know the Rep of, say: data Foo = Bar Int | Boo {hello :: String} deriving Generic I just convert it to a Rep and show it: err = show $ from $ Boo World However Reps don't have Show instances so GHC complains: No instance for (Show (D1 D1Foo ( C1 C1_0Foo (S1 NoSelector (Rec0 Int)) :+: C1 C1_1Foo (S1 S1_1_0Foo (Rec0 String)) ) x0 ) ) arising from a use of `show' And there you go. This is the only time when I'm happy to see an error message :-) Bas ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is generic information dumpable?
2011/11/4 Bas van Dijk v.dijk@gmail.com Thanks José! Will this make it into ghc-7.4? Yes, I think so. Cheers, Pedro Bas 2011/11/4 José Pedro Magalhães j...@cs.uu.nl: Hi, Now, for the following datatype: data X a = X { myX :: a } deriving Generic You get the following -ddump-deriv output: Derived instances Derived instances: instance GHC.Generics.Generic (Temp.X a_adY) where GHC.Generics.from (Temp.X g1_aeG) = GHC.Generics.M1 (GHC.Generics.M1 (GHC.Generics.M1 (GHC.Generics.K1 g1_aeG))) GHC.Generics.to (GHC.Generics.M1 (GHC.Generics.M1 (GHC.Generics.M1 (GHC.Generics.K1 g1_aeH = Temp.X g1_aeH instance GHC.Generics.Datatype Temp.D1X where GHC.Generics.datatypeName _ = X GHC.Generics.moduleName _ = Temp instance GHC.Generics.Constructor Temp.C1_0X where GHC.Generics.conName _ = X GHC.Generics.conIsRecord _ = GHC.Types.True instance GHC.Generics.Selector Temp.S1_0_0X where GHC.Generics.selName _ = myX Generic representation: Generated datatypes for meta-information: Temp.D1X Temp.C1_0X Temp.S1_0_0X Representation types: Temp.Rep_X = GHC.Generics.D1 Temp.D1X (GHC.Generics.C1 Temp.C1_0X (GHC.Generics.S1 Temp.S1_0_0X (GHC.Generics.Par0 a_adY))) Still not perfect, in that the representation type should really appear as a type instance inside the Generic instance, but at least all the important information is printed. Cheers, Pedro 2011/11/3 Bas van Dijk v.dijk@gmail.com 2011/11/3 José Pedro Magalhães j...@cs.uu.nl: -ddump-deriv will print (most of) it. But it doesn't print the most useful piece of information: the definition of Rep. It would be great if this could be added. Currently when I have a type that I want to know the Rep of, say: data Foo = Bar Int | Boo {hello :: String} deriving Generic I just convert it to a Rep and show it: err = show $ from $ Boo World However Reps don't have Show instances so GHC complains: No instance for (Show (D1 D1Foo ( C1 C1_0Foo (S1 NoSelector (Rec0 Int)) :+: C1 C1_1Foo (S1 S1_1_0Foo (Rec0 String)) ) x0 ) ) arising from a use of `show' And there you go. This is the only time when I'm happy to see an error message :-) Bas ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [ANNOUNCE] cereal-0.3.4.0
On 3 November 2011 16:27, Trevor Elliott tre...@galois.com wrote: I'm happy to announce version 0.3.4.0 of the cereal serialization library. Thanks! Is your repository public? If so, where can I find it and could it be listed in the cabal file using something like: source-repository head type: git location: http://github.com/.../cereal Regards, Bas ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] howto best use emacs + tiling WM (Xmonad,DWM)
Hello, I'm using dwm which I really love (ev. consider switching to xmonad). However when I'm working with emacs (programming haskell) und dwm I feel, I'm not as effecient as I eventually could be. -- I can have the shell in one window (to execute the compiled program), but most work happens in emacs (in one screen only). And I have up to buffers in emacs which I find hard to switch between. Even on Xinerama this doesn't really change. When I create new frames for emacs with strg-x 5-2 then I'm sort getting closer to where I would like to be, but then I find myself having to windows on which I switch buffers and I get confused again. What I would like is to tab through the buffers, as I walk through the screens in dwm/xmonad and see the list of buffers as id do so. -- And can directly jump to a specific buffer via e.g. mod-4. I'm thinking that each buffer in emacs gets one frame and occupies one screen and xmonad than gets dynamically 20 or more screens (like tabs). If there is an good solution within emacs and the emacs mode than I'm of course also more than open for it. (my experience with emacs so far: -- only 10 buffers are listed in menue -- speedbar is very nice but works for files not for buffers -- using list all buffers is sort of cluncy as it uses half the screen (my screen splits horizontally Thanks, Phil -- View this message in context: http://haskell.1045720.n5.nabble.com/howto-best-use-emacs-tiling-WM-Xmonad-DWM-tp4964482p4964482.html Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Message
On Thu, Nov 3, 2011 at 9:09 PM, Ryan Newton rrnew...@gmail.com wrote: I have interfaced Erlang and Haskell... And delivered it as a product. I just came up with a dead-simple text based communication syntax from Erlang to Haskell that was very easily testable. It allowed for complete isolation Interesting. I can't imagine there are too many people who have done this. So I must ask -- given the explicit attempt to imitate Erlang in recent CloudHaskell work, does that come close to giving you everything you would have wanted in this app? I don't know, as I've not looked at all at CloudHaskell at all. My current job doesn't really give me a lot of time for it. There's definite advantages to polyglot programming approaches. The difficulty is in the glue, and that doesn't have to really be that difficult. I just picked a text based protocol that was really easy to implement and understand as well as test externally. No XML, no JSON, nothing standardized, just tiny and really obvious. With a sufficiently simple protocol getting C++, haskell and erlang on the same page was pretty trivial, and the separation of concerns for each piece was really well drawn. It felt like what was meant by the unix philosophy of one good tool for each job coordinated over pipes because well that's exactly what I did. Dave (Hot code update being the big missing piece.) Cheers, -Ryan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] howto best use emacs + tiling WM (Xmonad,DWM)
On Fri, Nov 4, 2011 at 8:55 AM, kaffeepause73 kaffeepaus...@yahoo.de wrote: Hello, I'm using dwm which I really love (ev. consider switching to xmonad). However when I'm working with emacs (programming haskell) und dwm I feel, I'm not as effecient as I eventually could be. -- I can have the shell in one window (to execute the compiled program), but most work happens in emacs (in one screen only). And I have up to buffers in emacs which I find hard to switch between. Even on Xinerama this doesn't really change. When I create new frames for emacs with strg-x 5-2 then I'm sort getting closer to where I would like to be, but then I find myself having to windows on which I switch buffers and I get confused again. What I would like is to tab through the buffers, as I walk through the screens in dwm/xmonad and see the list of buffers as id do so. -- And can directly jump to a specific buffer via e.g. mod-4. I'm thinking that each buffer in emacs gets one frame and occupies one screen and xmonad than gets dynamically 20 or more screens (like tabs). If there is an good solution within emacs and the emacs mode than I'm of course also more than open for it. (my experience with emacs so far: -- only 10 buffers are listed in menue -- speedbar is very nice but works for files not for buffers -- using list all buffers is sort of cluncy as it uses half the screen (my screen splits horizontally I think you'll get xmonad specific advice on this list: http://www.haskell.org/mailman/listinfo/xmonad I'm currently using vim + screen to do my hacking and I love it, but I do wish vim had more IDE smarts at times. Emacs + screen would work equally well. tmux instead of screen is another valid option (tmux is better maintained but screen is more ubiquitous). The default buffer manipulation in emacs is not great. Take a look at things like ido mode: http://www.emacswiki.org/emacs/InteractivelyDoThings It's approximately 3 orders of magnitude better than the default way :) Good luck! Jason ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] howto best use emacs + tiling WM (Xmonad,DWM)
On Fri, 4 Nov 2011 11:24:37 -0700, Jason Dagit dag...@gmail.com wrote: The default buffer manipulation in emacs is not great. Take a look at things like ido mode: http://www.emacswiki.org/emacs/InteractivelyDoThings It's approximately 3 orders of magnitude better than the default way :) And anything is even better than that in my opinion: http://www.emacswiki.org/emacs/Anything `anything-buffers+' from anything-config.el makes switching between buffers a breeze. Cheers, Daniel pgpkgiMradBZk.pgp Description: PGP signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe