Re: [Haskell-cafe] Why is it so different between 6.12.1 and 6.10.4_1 ?

2010-03-27 Thread Yusaku Hashimoto
se. In fact, i really donot > know `Monad ((->) a) ` . Would you mind expplain it ? > > > Yusaku Hashimoto wrote: >> >> Did you import the module includes the instance of Monad ((->) e) >> somewhere in your code loaded in ghci? >> >> I tried this on a

Re: [Haskell-cafe] Why is it so different between 6.12.1 and 6.10.4_1 ?

2010-03-26 Thread Yusaku Hashimoto
>> fac n = let {  f = foldr (*) 1 [1..n] } in f > > Why do you bother with the interior definition of f in there? > > fac = product . enumFromTo 1 let fac = do is_zero <- (==0); if is_zero then return 1 else liftM2 (*) id (fac . pred) -nwn On Sat, Mar 27, 2010 at 9:59 AM, Ivan Lazar Miljenovic

Re: [Haskell-cafe] Why is it so different between 6.12.1 and 6.10.4_1 ?

2010-03-26 Thread Yusaku Hashimoto
Did you import the module includes the instance of Monad ((->) e) somewhere in your code loaded in ghci? I tried this on a fresh ghci 6.12, but I got "No instance" error. -nwn On Sat, Mar 27, 2010 at 9:20 AM, zaxis wrote: > > In 6.12.1 under archlinux >>let f x y z = x + y + z >> :t f > f :: (N

Re: [Haskell-cafe] Re: Books for "advanced" Haskell

2010-03-08 Thread Yusaku Hashimoto
On Sun, Mar 7, 2010 at 10:53 PM, Stephen Tetley wrote: > Hi All > > What is the state-of-the-practice in type-level programming? > > I know Günther started this thread about monads, but I seem to > remember him having a long running problem with "typeful" database > programming, and I wonder if so

Re: [Haskell-cafe] Two GET HTTP requests

2010-02-08 Thread Yusaku Hashimoto
ustrates me is that > it's quite hard to debug. I guess I'll upgrade my GHC to 6.12, hopefully > that'll solve it. > > -chris > > On 7 feb 2010, at 16:07, Yusaku Hashimoto wrote: > >> Hello, >> >> On Sat, Feb 6, 2010 at 2:51 AM, Chris Eidhof

Re: [Haskell-cafe] Two GET HTTP requests

2010-02-07 Thread Yusaku Hashimoto
Hello, On Sat, Feb 6, 2010 at 2:51 AM, Chris Eidhof wrote: > Approach 3: I used the simpleHTTP function from the HTTP package. This > crashed, after I dug a little deeper into the code, it threw an error on > calling the parseURI function (openFile: no such file exists). I installed > the late

Re: [Haskell-cafe] poor perfomance of indexU in uvector package

2009-11-15 Thread Yusaku Hashimoto
>> Also, I would recomend using criterion. > > I tried to do so.. But it depends on gtk2hs and it is too difficult > to install You can install with the flag to skip gtk2hs installation. i.e. Try `cabal install criterion -f-chart` -~nwn ___ Haskell-Cafe

Re: [Haskell-cafe] Applicative but not Monad

2009-10-30 Thread Yusaku Hashimoto
> Some parsers are not monads, allowing for optimizations. Could you elaborate on them or give me some pointers? I think I heard about it two or three times, but I couldn't find any resource of them. -~nwn On Sat, Oct 31, 2009 at 5:35 AM, Martijn van Steenbergen wrote: > Yusaku Hash

Re: [Haskell-cafe] Applicative but not Monad

2009-10-30 Thread Yusaku Hashimoto
Thank you for your correction. I tried your (>>=) and replaced return's definition with return = ZipList . repeat then as you said this works fine for infinite lists. Cheers, -~nwn On Sat, Oct 31, 2009 at 2:39 AM, David Menendez wrote: > On Fri, Oct 30, 2009 at 1:33 PM, Yu

Re: [Haskell-cafe] Applicative but not Monad

2009-10-30 Thread Yusaku Hashimoto
Thanks for fast replies! Examples you gave explain why all Applicatives are not Monads to me. And I tried to rewrite Bob's Monad instance for ZipList with (>>=). import Control.Applicative instance Monad ZipList where return = ZipList . return (ZipList []) >>= _ = ZipList [] (ZipList (a:as

[Haskell-cafe] Applicative but not Monad

2009-10-30 Thread Yusaku Hashimoto
Hello cafe, Do you know any data-type which is Applicative but not Monad? Cheers, -~nwn ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] How do I uninstall GHC on a Mac running Snow Leopard?

2009-10-24 Thread Yusaku Hashimoto
Invoke uninstaller with sudo from Terminal as: sudo Library/Frameworks/GHC.framework/Tools/Uninstaller HTH -nwn 2009/10/24 R J : > What's the cleanest way to fully uninstall GHC on a Mac running Snow > Leopard? > Running Library/Frameworks/GHC.framework/Tools/Uninstaller from an account > wi

Re: [Haskell-cafe] Real World Haskell Chapter 19 and GHC 6.10

2009-10-21 Thread Yusaku Hashimoto
To deal with "amigous type variable 'e'", I often write the codes like: handle (\...@someexception{} -> print e) (5 `div` 0) and IIRC, the base-4.0 initially released with GHC 6.10.1, introduced this exceptions. It enables us to specify which exception should be caught and define types of exc

Re: [Haskell-cafe] QuickCheck Questions

2009-09-28 Thread Yusaku Hashimoto
After a few more investigations, I can say QuickCheck does: - make easy to finding couter-cases and refactoring codes - make easy to test some functions if they have good mathematical properties - generate random test cases But QuickCheck does *not*: - help us to find good properties So what I w

Re: [Haskell-cafe] QuickCheck Questions

2009-09-27 Thread Yusaku Hashimoto
On Mon, Sep 28, 2009 at 4:42 AM, Gwern Branwen wrote: > On Sun, Sep 27, 2009 at 3:19 PM, Yusaku Hashimoto > wrote: > ... >> >> Do you think I wasted times? Have you ever tried PDD? And has it >> worked? If you have experience with TDD, how do you think about PDD? >&

[Haskell-cafe] QuickCheck Questions

2009-09-27 Thread Yusaku Hashimoto
Hello, I recently worked with QuickCheck for a while, But I still can't handle it well, And a few questions come to my mind. 1. How to find properties In QuickCheck examples on the codes or the papers, they find good properties easily. How did they find these properties? What property can make u

Re: [Haskell-cafe] Averting QuickCheck Madness

2009-09-06 Thread Yusaku Hashimoto
I think using the runTests hook and the test flag make sense, described at http://www.haskell.org/pipermail/haskell-cafe/2008-September/047223.html. I released some libraries in this way, AFAIK it works well. On Sun, Sep 6, 2009 at 4:57 PM, Christopher Lane Hinson wrote: > > There are some librar

[Haskell-cafe] ANN: tkhs-0.1.* Presentation Utility

2009-07-31 Thread Yusaku Hashimoto
Hi, I'm pleased to announce the release of tkhs-0.1.*, Simple presentation utility. If you are thinking PowerPoint is overkill for your presentation, Tkhs may fit the purpose. See screenshot of running tkhs in my terminal: http://nonowarn.tumblr.com/post/152324109 When you invoke tkhs with s

Re: [Haskell-cafe] Convert IO Int to Int

2009-06-09 Thread Yusaku Hashimoto
On 2009/06/09, at 19:33, Tobias Olausson wrote: You can not convert an IO Int to Int, or at least, you shouldn't. However, you can do as follows: test :: IO () test = do int <- randomRIO -- or whatever it is called print $ useInt int useInt :: Int -> Int useInt x = x+10 Or, you can li

Re: [Haskell-cafe] No VerboseCheck in QuickCheck 2?

2009-05-26 Thread Yusaku Hashimoto
Hi, I don't think I am familiar enough with QuickCheck 2. But there seems to be no verboseCheck like function, and sample and sample' is useful to printing test cases. ghci> sample (arbitrary :: Gen Int) 1 0 1 -2 -2 -5 -16 -9 -57 -115 -94 ghci>

Re: [Haskell-cafe] How to define a common return and bind?

2009-04-10 Thread Yusaku Hashimoto
On 2009/04/10, at 20:32, Bas van Dijk wrote: So I rewrote it using type families which I find much easier to understand: Cool. Type family version is easier to read and understand for me. This seems useful. Does this exists somewhere on hackage? I glanced at Monad category in package list

Re: [Haskell-cafe] How to define a common return and bind?

2009-04-10 Thread Yusaku Hashimoto
Now I'm wondering if the derive_* functions can be overloaded using something like this. Note that the following doesn't typecheck: {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE F

Re: [Haskell-cafe] Generating arbitrary function in QuickCheck

2009-04-07 Thread Yusaku Hashimoto
ts own type. Reference: - [Theorem for free!](http://citeseerx.ist.psu.edu/viewdoc/summary? doi=10.1.1.38.9875) - [ftshell](http://hackage.haskell.org/cgi-bin/hackage-scripts/ package/ftshell-0.3) Thanks, Yusaku Hashimoto On 2009/04/07, at 15:19, Janis Voigtlaender wrote: Jason Dagit wrote: On

[Haskell-cafe] Generating arbitrary function in QuickCheck

2009-04-06 Thread Yusaku Hashimoto
. arb_compare 0 1 = GT arb_compare 1 0 = GT arb_compare _ _ = EQ Then, I want to ask two questions. 1. Is my guessing in function generated by arbitrary right? 2. If so, How do I generate right function? Thanks, Yusaku Hashimoto ___ Haskell-Cafe m

[Haskell-cafe] ANN: io-capture-0.2 capturing std(out|err) in IO action

2009-03-26 Thread Yusaku Hashimoto
f you find it, feel free to report it and any feedbacks are welcome. Thanks for reading, Yusaku Hashimoto ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] What unsafeInterleaveIO is unsafe

2009-03-16 Thread Yusaku Hashimoto
Hi, On 2009/03/16, at 10:04, wren ng thornton wrote: > next r = do n <- readIORef r > writeIORef r (n+1) > return n Now, if I use unsafeInterleaveIO: > main = do r <- newIORef 0 > x <- do a <- unsafeInterleaveIO (next r) >b <- unsafeInter

[Haskell-cafe] What unsafeInterleaveIO is unsafe

2009-03-15 Thread Yusaku Hashimoto
Hello, I was studying about what unsafeInterleaveIO is.I understood unsafeInterleaveIO takes an IO action, and delays it. But I couldn't find any reason why unsafeInterleaveIO is unsafe. I have already read an example in http://www.haskell.org/pipermail/haskell-cafe/2009-March/057101.html says la

[Haskell-cafe] Re: ANNOUNCE: torch-0.1

2009-03-10 Thread Yusaku Hashimoto
On Wed, Mar 11, 2009 at 1:06 AM, Yusaku Hashimoto wrote: >> import Test.Torch >> >> main = run $ do >>   ok (odd 1) "assertion" >>   is 42 (7*6) "equality assertion" >>   isBottom (error undefined) "check whether value is bottom"

[Haskell-cafe] ANNOUNCE: torch-0.1

2009-03-10 Thread Yusaku Hashimoto
Hello, I have wrote and uploaded my unit test library (or framework) torch-0.1 on Hackage. With torch, We can write simple unit test and run like this: > import Test.Torch > > main = run $ do > ok (odd 1) "assertion" > is 42 (7*6) "equality assertion" > isBottom (error undefined) "chec