Re: [Haskell-cafe] Alternate instance Show (Maybe a)?

2007-02-03 Thread Yitzchak Gale
Hi Sergey, You wrote: Suppose I want show Nothing to return "", and show (Just foo) return show foo. I don't seem to be able to. Looks like I either have to use some other function name, like `mShow' That is correct. Show instances are supposed to follow the convention that "show x" is a Hask

Re: [Haskell-cafe] List operation question

2007-02-04 Thread Yitzchak Gale
Nicolas Frisby wrote: I've always thought that when certain operations are of particular interest, it's time to use more appropriate data structures, right? Lists are great and simple and intuitive, but if you need such operations as shifts, something like a deque is the way to go. This sounds

Re: [Haskell-cafe] Re: nested maybes

2007-02-05 Thread Yitzchak Gale
J. Garrett Morris wrote: This is where my favorite part of the mtl steps in: monad transformers. I agree, the Error monad is very helpful here. First, we'll create a transformed version of the IO monad, Why go to the trouble of creating a new monad? The existing ones are fine. (While writi

Re: [Haskell-cafe] Generalizing three programs

2007-02-05 Thread Yitzchak Gale
Andrew Wagner wrote: I've got several problems which seem to have a very similar structure. I want to find a way to abstract them to solve other problems which can be thought about in the same way. Here they are: http://hpaste.org/307 http://hpaste.org/308 http://hpaste.org/309 Note that these a

Re: [Haskell-cafe] Re: nested maybes

2007-02-05 Thread Yitzchak Gale
I wrote: Why go to the trouble of creating a new monad? The existing ones are fine. J. Garrett Morris wrote: Mainly to keep the type error messages simpler. There are two ways to get around that problem: 1. Make your functions polymorphic, using MonadState, MonadError, etc. Each function me

[Haskell-cafe] Re: Importance of MonadRandom

2007-02-06 Thread Yitzchak Gale
I wrote: Cale Gibbard's MonadRandom... I would like to suggest a change to the interface... class (Monad m) => MonadRandom m where nextR :: m Int splitR :: m (m ()) rangeR :: m (Int, Int) getR :: (forall g . RandomGen g => g -> a) -> m a I see that I have inadvertently done two things d

Re: [Haskell-cafe] Re: Generalizing three programs

2007-02-06 Thread Yitzchak Gale
apfelmus wrote: I'm unsure whether it's a good idea to simulate the situations, I'd prefer a more denotational approach... Queuing theory is a very large and mature area of research, with many important applications in industry. It is not a coincidence that a certain telephone company named a

Re: [Haskell-cafe] Re: nested maybes

2007-02-06 Thread Yitzchak Gale
J. Garrett Morris wrote: Again, from the earlier example, I'm not sure how typing: apply :: (MonadCont m, MonadState Blargh m, MonadError Fzzt m, MonadIO m) => Handle -> Attribute a -> m a is simpler than apply :: Handle -> Attribute a -> m a Well, no, but it is at least no worse than app

Re: [Haskell-cafe] Newbie: generating a truth table

2007-02-06 Thread Yitzchak Gale
Philippe de Rochambeau wrote: I have tried map (putStrLn) pImpliesQAndRLoopShow but that results in the following error message: Try mapM_ putStrLn pImpliesQAndRLoopShow or putStrLn $ unlines pImpliesQAndRLoopShow Regards, Yitz ___ Haskell-Cafe ma

Re: [Haskell-cafe] IO is not a monad

2007-02-07 Thread Yitzchak Gale
Aaron McDaid wrote: Apologies for referring to this old thread... At least for me, this is not old. It is still very much on my mind. Simply, 'undefined >> undefined' is a bit more defined than simply 'undefined'. Just like 'undefined:undefined' is at least a non-empty list; which can be matc

Re: [Haskell-cafe] IO is not a monad

2007-02-07 Thread Yitzchak Gale
Just for the record, I think this completes the requirements of my challenge. Please comment! Is this correct? Thanks. 1. Find a way to model strictness/laziness properties of Haskell functions in a category in a way that is reasonably rich. We use HaskL, the category of Haskell types, Haskell

Re: [Haskell-cafe] Re: Re: nested maybes

2007-02-07 Thread Yitzchak Gale
Mikael Johansson wrote: A way to categorify elements of objects in a cartesian closed category (such as that that sufficiently restricted Haskell takes place in) are to view entities of type A as maps () -> A. Dan Weston wrote: This rather inconveniently clashes with the fact that A and () -

[Haskell-cafe] Re: Importance of MonadRandom

2007-02-07 Thread Yitzchak Gale
OK, thanks! Regards, Yitz Cale Gibbard wrote: The splittable idea isn't mine, it looks like perhaps Remi Turk did it. One thing which I'd recommend is including getRandom, getRandomR as implemented in terms of getR and the ordinary random operations, simply because they're the two most common

Re: [Haskell-cafe] IO is not a monad

2007-02-07 Thread Yitzchak Gale
Aaron McDaid wrote: Could seq be changed so that it will not give an error if it finds undefined? The definition of seq is that seq _|_ x = _|_. That is what it is supposed to do. Actually, the behavior of seq on undefined is very tame - it raises an exception which can be caught. Sometimes se

Re: [Haskell-cafe] IO is not a monad

2007-02-08 Thread Yitzchak Gale
Lennart Augustsson wrote: I think seq is funny because it is not lambda definable. Does the set of computable functions on the natural numbers defined by the lambda calculus augmented with seq have higher Turing degree than the set of classical computable functions? -Yitz _

Re: [Haskell-cafe] Beginner Question

2007-02-09 Thread Yitzchak Gale
Hi Vishy, You wrote: I have just started on my journey in learning Haskell. Welcome aboard! We all wish you an enjoyable and (type)safe trip. I have started off reading wikibook, then will read yet another tutorial on haskell. Please guide me if I am on right track Those are both great tut

Re: [Haskell-cafe] IO is not a monad

2007-02-09 Thread Yitzchak Gale
Lennart Augustsson wrote: I think seq is funny because it is not lambda definable. I wrote: Does the set of computable functions on the natural numbers defined by the lambda calculus augmented with seq have higher Turing degree than the set of classical computable functions? I guess I was no

[Haskell-cafe] FFI basics

2007-02-09 Thread Yitzchak Gale
Hi, I would like to use FFI for the first time. Can someone give me a really, really simple complete example? I want to be able to take a simple C program and access a function from it in Haskell. A simple example of the other way around would be nice, too, but I don't happen to need that just n

Re: [Haskell-cafe] FFI basics

2007-02-10 Thread Yitzchak Gale
Thanks to everyone for all the help! Everything is working for me now. It turns out that the main detail I was missing was exactly what commands to type to compile it, and how to use it in GHCI. Pretty important detail, actually. Alistair - yes, there are a few simpler pages about FFI on the old

Re: Re[2]: [Haskell-cafe] FFI basics

2007-02-12 Thread Yitzchak Gale
Bulat Ziganshin wrote: examples of lifting C functions into Haskell world: mysin :: Double -> Double mysin = realToFrac . c_mysin . realToFrac -- c_mysin :: CDouble -> CDouble rnd :: Int -> IO Int rnd x = do r <- c_rnd (fromIntegral x) return (fromIntegral r) -- c_rnd :: CInt -> IO

Re: [Haskell-cafe] Genuine Eratosthenes sieve [Was: Optimization fun]

2007-02-12 Thread Yitzchak Gale
[EMAIL PROTECTED] wrote: Still, in the interest of purity, here it is, in Haskell. As the original Eratosthenes sieve, this algorithm uses only successor and predecessor operations. I don't think the Greeks had too much trouble with addition. If that is the case, then Rafael's definition is st

Re: [Haskell-cafe] IO is not a monad

2007-02-12 Thread Yitzchak Gale
Lennart Augustsson wrote: I'm not sure what you're asking. The (untyped) lambda calculus is Turing complete. How could seq improve that? Obviously, it can't. But how can it hurt? Classical lambda calculus does not model the semantics of laziness, so seq is equivalent to flip const there, just

Re: [Haskell-cafe] speeding up fibonacci with memoizing

2007-02-18 Thread Yitzchak Gale
Besides memoizing, you might want to use the fact that: fib (2*k) == (fib (k+1))^2 - (fib (k-1))^2 fib (2*k-1) == (fib k)^2 + (fib (k-1))^2 Regards, Yitz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/has

Re: Re[2]: [Haskell-cafe] Why do I have to specify (Monad m) here again?

2007-02-18 Thread Yitzchak Gale
Hi Marc, Marc Weber wrote: class (Monad m) => GetMV m a where ... instance GetMV m c where (2) ...it would be save to assume that the programmer doesn't want a failure but success. Thus ghc could infer (3) automatically but doesn't The Monad m on the class declaration

Re: Re[2]: [Haskell-cafe] Why do I have to specify (Monad m) here again?

2007-02-18 Thread Yitzchak Gale
I wrote: The other way is if the type is not fully specified - it is a variable - then you can "pass the buck" and say that whoever uses this instance must first make sure that the value of the type variable is a type that already has a Monad instance. In this case, you are creating an obligati

Re: Re[2]: [Haskell-cafe] Why do I have to specify (Monad m) here again?

2007-02-18 Thread Yitzchak Gale
David Tolpin wrote: could you please point me to a reference (paper/note/something else) that explains that class constraint in a class definition is a guarantee with regard to a type declaration but a requirement with regard to an instance declaration? Sebastian Sylvan wrote: Well, I guess th

Re: [Haskell-cafe] FFI basics

2007-02-19 Thread Yitzchak Gale
Simon Peyton-Jones wrote: Yitz, Please do make time to do this! This is the moment, while it is still fresh in your mind. Of course, you are correct. Thanks for the push. I am a bit busy with work, but the information is not lost. I'll have it up soon. Regards, Yitz ___

Re: [Haskell-cafe] Re: Genuine Eratosthenes sieve [Was: Optimization fun]

2007-02-19 Thread Yitzchak Gale
Hi Melissa, I enjoyed your article. I especially like your trick of starting with p*p. You wrote: Which seems reasonable, until you realize that every prime p we come up with is still "considered" by k deleteOrd filters, where k is the number of primes that preceeded it. It is true that I hav

Re: [Haskell-cafe] Re: Genuine Eratosthenes sieve [Was: Optimization fun]

2007-02-20 Thread Yitzchak Gale
Hi Melissa, You wrote: - Eratosthenes's sieve never says the equivalent of, "Hmm, I wonder if 19 is a multiple of 17" -- but both the basic "sieve" we began with and the deleteOrd version do So then maybe I taught my daughter the wrong thing. When she does 17, she moves ahead one number at

Re: [Haskell-cafe] Multiparameter class error

2007-02-21 Thread Yitzchak Gale
Hi Alfonso, You wrote: Could not deduce (Synchronous s f11) from the context (Synchronous s f1) \begin{code} class Synchronous s f1 where mapSY :: f1 a b -> s a -> s b delaySY :: a-> s a -> s a sourceSY :: f1 a a -> a-> s a sourceSY f s0 = o

Re: [Haskell-cafe] Leaves of a Tree

2007-02-22 Thread Yitzchak Gale
Tom Hawkins wrote: Any recommendations for speeding up extracting the set of leaves from a tree? Tom, The standard library already has this, in Data.Tree and Data.Foldable.toList. I'm interested to know how well that performs compared to the roll-your-own solutions proposed so far in this thr

Re: [Haskell-cafe] Hi can u explain me how drop works in Haskell

2007-02-25 Thread Yitzchak Gale
Hi Iliali, You wrote: Hi I am trying to implement the function drop in haskell Chris Eidhof wrote: you're almost there... In case this is homework, you may also want to look at: http://www.haskell.org/haskellwiki/Homework_help Regards, Yitz ___

Re: [Haskell-cafe] wanted: haskell one-liners (in the perl sense of one-liners)

2007-03-04 Thread Yitzchak Gale
Thomas Hartman wrote: Is there a way to do as a shell command that idiomatically uses haskell? I used to do those in Perl, too, years ago. I switched to the readable step-by-step style of the Python shell when I moved from Perl to Python. It is a whole different mentality about how to wor

Re: [Haskell-cafe] k-minima in Haskell

2007-04-12 Thread Yitzchak Gale
\begin{code} kmin :: Ord a => Int -> [a] -> [Int] kmin k x = map snd $ Set.toList $ foldl' insertIfSmall (Set.fromList h) t where (h, t) = splitAt k $ zip x [0..] insertIfSmall :: Ord a => Set.Set a -> a -> Set.Set a insertIfSmall s e | e < mx= Set.insert e s' | otherwise = s where (mx

Re: [Haskell-cafe] k-minima in Haskell

2007-04-12 Thread Yitzchak Gale
\begin{code} kmin :: Ord a => Int -> [a] -> [Int] kmin k x = map snd $ Set.toList $ foldl' insertIfSmall (Set.fromList h) t where (h, t) = splitAt k $ zip x [0..] insertIfSmall :: Ord a => Set.Set a -> a -> Set.Set a insertIfSmall s e | e < mx= Set.insert e s' | otherwise = s where (mx

Re: [Haskell-cafe] Weaving fun

2007-04-15 Thread Yitzchak Gale
Back to the original problem for a moment. \begin{code} import qualified Data.Sequence as Seq import Data.Sequence ((|>), ViewL((:<))) weave :: [[a]] -> [a] weave = weaveSeqL . Seq.viewl . Seq.fromList where weaveSeqL ((x:xs) :< s) = x : weaveSeqL (Seq.viewl $ s |> xs) weaveSeqL _

Re: [Haskell-cafe] darcs error

2007-04-15 Thread Yitzchak Gale
Ruben Zilibowitz wrote: What does it mean if I'm trying to check out a darcs repository and I get the following error? darcs: ./.DS_Store: openBinaryFile: does not exist (No such file or directory) If you are doing "darcs get" from a partial repo and you did not use --partial, then this sounds

Re: [Haskell-cafe] Re: 'Proper' use of the State monad

2007-05-01 Thread Yitzchak Gale
DavidA wrote: What I mean is, it seems like good design would mean that you could write and test the game logic totally independently of any IO. Game functions such as "makeMove" ought to have type signatures that don't involve any IO. Can this be achieved in option 2? Here is one way: For fun

[Haskell-cafe] Haskell Library on CNN

2007-05-26 Thread Yitzchak Gale
Border conditions in the Haskell Library have finally made the mainstream media: http://www.cnn.com/2007/US/05/26/border.quirk.ap/index.html -Yitz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-ca

Re: [Haskell-cafe] Lifting IO actions into Applicatives

2013-10-01 Thread Yitzchak Gale
Tom Ellis wrote: > Shouldn't it be an *Applicative* constraint? > > class Applicative t => ApplicativeIO t where > liftIO :: IO a -> t a > > and require that > > liftIO (pure x) = pure x > liftIO (f <*> x) = liftIO f <*> liftIO x > > Seems like ApplicativeIO makes more sense tha

Re: [Haskell-cafe] Lifting IO actions into Applicatives

2013-10-01 Thread Yitzchak Gale
Dan Burton wrote: > From what you've said, it sounds like you can already write: > > serverSide :: IO a -> Form a > > This seems elegant enough to me for your needs. Just encourage it as an > idiom specific to Forms. > > myBlogForm = Blog <$> titleForm <*> serverSide getCurrentTime <*> > co

Re: [Haskell-cafe] haskellwiki and Project Euler

2008-02-24 Thread Yitzchak Gale
Project Euler is excellent, lots of fun, and rewarding. Thanks to Daniel and all the other members of the team. Project Euler problems, by their nature, also happen to be excellent material for teaching and learning Haskell. Having various solutions to them on the wiki is a valuable resource for t

Re: [Haskell-cafe] QuickCheck

2008-03-17 Thread Yitzchak Gale
Sebastian Sylvan: >> featureGenNormal = do >> id <- stringGen >> name <- stringGen >> featuretype <- arbitrary >> grouptype <- arbitrary >> children <- arbitrary >> properties <- listGen stringGen >> return (Feature id name featuretype grouptype children properties) Rya

Re: [Haskell-cafe] hoisting as well as lifting and returning

2008-03-23 Thread Yitzchak Gale
Matthew Pocock wrote: > I've been using monad transformers for the first time in anger this week. I hope your enjoyment in using monads has helped your anger to subside. :) > ...there's an operation that I keep defining over > and over again... > hoistList :: (Monad m) => [a] -> ListT m a >

Re: [Haskell-cafe] Unescaping with HaXmL (or anything else!)

2008-04-01 Thread Yitzchak Gale
On Fri, Mar 28, 2008 at 4:26 AM, Anton van Straaten wrote: > I want to unescape an encoded XML or HTML string, e.g. converting " > to the quote character, etc. > Since I'm using HaXml anyway, I tried using xmlUnEscapeContent with no > luck Hi Anton, I only noticed your post today, sorry for th

Re: [Haskell-cafe] Memory allocation in extractor function (newbie question)

2008-04-07 Thread Yitzchak Gale
Alexander Kireyev wrote: > While trying to write a program for the countPaths Code Jam problem I > ran into what seems to me as a weird behaviour in terms of memory > allocation... > The profiling log (./paths +RTS -P) shows the following time/space > behaviour for them... Hi Alexander, I'm

Re: [Haskell-cafe] [GSoC] WWW::Mechanize-like package for Haskell

2008-04-07 Thread Yitzchak Gale
Max Desyatov wrote: >> I'm interested in working on a library for a stateful web browsing in >> Haskell during Google Summer of Code. Thomas Schilling wrote: > Also, for a GSoC proposal you should try to convince the mentors, why your > project is useful for Haskell in general. So maybe you have

Re: [Haskell-cafe] [help] Program immplementing an alarm

2008-04-28 Thread Yitzchak Gale
Antonio Regidor García wrote: > I'm trying to implement an alarm in Haskell and wrote the following code: > http://hpaste.org/7201 > But it doesn't work as expected. Hi, The getLine function ties up stdin. So the system function isn't able to proceed until getLine completes, even when it is in

Re: [Haskell-cafe] GHC predictability

2008-05-12 Thread Yitzchak Gale
Andrew Coppin wrote: > I offer up the following example: > > mean xs = sum xs / length xs > > Now try, say, "mean [1.. 1e9]", and watch GHC eat several GB of RAM. (!!) > > If we now rearrange this to > > mean = (\(s,n) -> s / n) . foldr (\x (s,n) -> let s' = s+x; n' = n+1 in s' > `seq` n' `s

Re: [Haskell-cafe] Richer (than ascii) notation for haskell source?

2008-05-15 Thread Yitzchak Gale
Brandon S. Allbery KF8NH wrote: > Adjacent different scripts in general is probably a reasonable token > discriminator. A "token" combining LTR and RTL, for example, is just > confusing. So you would like to ban identifiers that contain both letters and digits for those who happen to speak langua

Re: [Haskell-cafe] Richer (than ascii) notation for haskell source?

2008-05-15 Thread Yitzchak Gale
Brandon S. Allbery KF8NH wrote: > Come to think of it, if you're after math notation, enough Greek letters are > used as symbols that it might be necessary to just exclude them from use as > letters. While I have not yet noticed anyone from Greece on this list, I don't think it would be appropriat

Re: [Haskell-cafe] Re: Richer (than ascii) notation for haskell source?

2008-05-15 Thread Yitzchak Gale
Brandon S. Allbery KF8NH wrote: >>> Come to think of it, if you're after math notation, enough Greek >>> letters are used as symbols that it might be necessary to just >>> exclude them from use as letters. Yitz Gale wrote: >> While I have not yet noticed anyone from Greece on this list, >> I don't

Re: [Haskell-cafe] Two-iteration optimisation (was: GHC Predictability)

2008-05-15 Thread Yitzchak Gale
Don Stewart wrote: > You'd want a general fusion framework for this... > Stream fusion... at least does this for zips... > but for an arbitrary 'f' instead of zip, > seems harder. And of course, you wouldn't want that: f xs = xs : map expensiveCalculation xs Please don't fuse those two loops int

Re: [Haskell-cafe] Std lib equivalent for liftM concat . sequence

2008-05-18 Thread Yitzchak Gale
Alistair Bayley wrote: >> A couple of days ago I had need for: >> concatM :: Monad m => [m [a]] -> m [a] >> concatM = liftM concat . sequence >> but found no such thing in the std libs It used to be in an older version of Haskell, but it was removed in Haskell 98. Bulat Ziganshin wrote: > 2. it's

Re: [Haskell-cafe] Std lib equivalent for liftM concat . sequence

2008-05-18 Thread Yitzchak Gale
Alistair Bayley wrote: >> concatM :: Monad m => [m [a]] -> m [a] >> concatM = liftM concat . sequence Miguel Mitrofanov wrote: > Seems to be close to > sequence :: [ListT m a] -> ListT m a > Hmm? Yes. It is close to something like that for the old broken ListT - but let's not talk about that one.

Re: [Haskell-cafe] My experience setting up Haskell up for GUI development

2008-05-18 Thread Yitzchak Gale
Hi Bulat, Bulat Ziganshin wrote: > if main part of your program is GUI - it's better to stick with C# and > all its visual bells and whistles. the only good thing with gtk2hs is > that you got Linux portability for free. actually, people will think > that you have developed it on linux and ported

Re: [Haskell-cafe] Newbie: State monad example questions

2008-05-21 Thread Yitzchak Gale
Thomas Hartman wrote: > I would be interested in seeing good motivating examples for use of > the state monad... > Okay, it's good for randomness. What else? > ...I saw an example about > using state to uniquely label elements of a tree > So, are there any other simple motivating examples that show

Re: [Haskell-cafe] Implementing ParseChart with Data.Map

2008-06-03 Thread Yitzchak Gale
Krasimir Angelov wrote: >> but notice that the set is still traversed twice. Neil Mitchell wrote: > I don't see any way of reducing that Yeah, it looks like the Data.Set (and Data.IntSet) library is missing the functions insertMember :: Ord a => a -> Set a -> (Bool, Set a) deleteMember :: Ord a

Re: [Haskell-cafe] A simple beginner question

2008-06-04 Thread Yitzchak Gale
Adam Smyczek wrote: > data SampleType = A | B Int | C String | D -- etc. > sampleTypes = [A, B 5, C "test"] :: [SampleType] > How do I find for example element A in the sampleTypes list? There have been many useful replies. But since Adam originally announced that this is a "beginner question

Re: [Haskell-cafe] Re: Interesting feature

2008-07-09 Thread Yitzchak Gale
David Overton wrote: > Also, see my recent attempts at (constraint) logic programming in Haskell: > http://overtond.blogspot.com/2008/07/pre.html > http://overtond.blogspot.com/2008/07/haskell-sudoku-solver-using-finite.html See the Sudoku page on the wiki: http://www.haskell.org/haskellwiki/Sudo

[Haskell-cafe] Re: ``Orphan instances'' should be avoided anyway.

2008-08-13 Thread Yitzchak Gale
I wrote: >> ...there must be some >> way to control the import and export of instances, just as we can >> now control the import and export of every other kind of symbol >> binding. Henning Thielemann wrote: > For me it's most often the case that an instance is missing. > If there is no way to c

Re: [Haskell-cafe] permutations and performance

2008-08-17 Thread Yitzchak Gale
John D. Ramsdell <[EMAIL PROTECTED]> wrote: > I tried to replace a permutation generator with one that generates > each permutation from the previous one, in a stream-like fashion. I > had hoped the stream-based algorithm would be more efficient because I > use only one permutation at a time, so o

Re: [Haskell-cafe] Why doesn't this work?

2008-08-24 Thread Yitzchak Gale
Alfonso Acosta wrote: > I haven't tried to run the code, but my first bet is that, due to the > rank-2 polymorphism of ST, you should use parenthesis instead of $ in > the case of runST. Perhaps if Andrew is using an old compiler. That is no longer a problem in recent versions of GHC. A more basi

Re: [Haskell-cafe] Why doesn't this work?

2008-08-24 Thread Yitzchak Gale
I wrote: >> A more basic issue is that fn is in the IO monad, >> but its use inside the mapM will need it to be in the ST >> monad. Daniel Fischer wrote: > No, > return (fn particle) :: ST s (IO ()) > , so that's fine. Ah, true. But I doubt that Andrew really meant to do the calculation in ST s (

Re: [Haskell-cafe] ANN: hs-dotnet, version 0.3.0

2009-01-15 Thread Yitzchak Gale
Sigbjorn Finne wrote: > the first public release of hs-dotnet is now available Fantastic accomplishment! I can only repeat dons' comment - this could be game-changing. Some obvious questions that come to mind: We see that it is already possible to expose a Haskell function to .NET as a callback.

Re: [Haskell-cafe] Haskell and C++ program

2009-01-15 Thread Yitzchak Gale
Sukit Tretriluxana: > I was looking around Stroustrup's website and found > a simple program... I wondered how a Haskell > program equivalent to it looks like... > main = E.catch (interact reverseDouble) (\_ -> print "format error") > toDoubles = map (read::String->Double) For a "safe" p

Re: [Haskell-cafe] real haskell difficulties (at least for me)

2009-01-15 Thread Yitzchak Gale
Duncan Coutts wrote: > We want to let random users on random > platforms submit simple anonymous build reports (no logs)... > The only downside compared to a more centralised system is that we do > not get to centrally monitor the status of the dedicated build clients. And that we open ourselves u

Re: [Haskell-cafe] real haskell difficulties (at least for me)

2009-01-15 Thread Yitzchak Gale
Duncan Coutts wrote: >>> let random users... submit... build reports... I wrote: >> ...we open ourselves up to... hostile build reports and DOS. Manlio Perillo wrote: > DOS is always a problem, for every application open to the Internet. Yes. But I didn't mean just generic flooding. I meant abus

Re: [Haskell-cafe] real haskell difficulties (at least for me)

2009-01-15 Thread Yitzchak Gale
Duncan Coutts wrote: > Detailed build reports with logs are not anonymous, clients will need an > account on hackage (ie username and password). Right. If we experience problems with that in the future, we just have to make sure that it won't be too hard to set up captcha. > they'll either be obv

Re: [Haskell-cafe] OS X build failure of Gtk2Hs from MacPorts

2009-01-17 Thread Yitzchak Gale
Jeff, I'm not sure if this is causing the problem you're referring to, but MacPorts is at GHC 6.10 while Gtk2Hs doesn't support that yet. Regards, Yitz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskel

[Haskell-cafe] Re: list choices

2009-01-25 Thread Yitzchak Gale
Both of the points raised by Malcolm are a matter of personal preference, in my opinion. In fact, my own preference is the opposite of Malcolm's in both cases. Both of Malcolm's suggestions would rob me of filtering capability. Malcolm Wallace wrote: > I would suggest that posting announcements *o

Re: [Haskell-cafe] MySQL and HDBC?

2009-01-25 Thread Yitzchak Gale
Duncan Coutts wrote: >> This was uploaded to hackage yesterday: >> http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HDBC-mysql-0.1 This is wonderful news! Whatever we might say about MySQL, it is so ubiquitous that this driver is really important for Haskell. Chris, please keep us up-to-

Re: [Haskell-cafe] MySQL and HDBC?

2009-01-26 Thread Yitzchak Gale
Chris Waterson wrote: >> You probably already know this, but... you can >> mix tables from different storage engines in a >> single *statement*. Oh, no, I thought it was per database. Horrors! >> ...when a ROLLBACK has been issued >> against a non-transactional table... I could raise an >> error.

Re: [Haskell-cafe] ANN: HDBC v2.0 now available

2009-02-02 Thread Yitzchak Gale
Duncan Coutts wrote: >>> So in the next cabal-install release (which should be pretty soon now) >>> configure will do the same thing and pick base 3 unless you specify >>> build-depends base >= 4. Niklas Broberg wrote: >> I really really think this is the wrong way to go. Occasional >> destruction

Re: [Haskell-cafe] Haskeline, pcre-light, iconv and Cabal on OSX

2009-02-02 Thread Yitzchak Gale
Thomas Davie wrote: >>> This is caused by OS X's libiconv being entirely CPP >>> macros, the FFI has nothing to get hold of. >>> IIRC there's a ghc bug report open for it. Judah Jacobson wrote: > The OS X system libiconv is actually OK; it's the MacPorts libiconv > that has the CPP macros... > Tha

Re: [Haskell-cafe] about integer and float operations

2009-02-04 Thread Yitzchak Gale
Manlio Perillo wrote: > The first difference is about a `mod` b, when a and b are Float types. > Python use the fmod function, and it also implement divmod; Haskell seems to > lack support for this operation. Yes, Haskell does not implement the full IEEE. There are differing opinions about that: s

Re: [Haskell-cafe] about integer and float operations

2009-02-04 Thread Yitzchak Gale
Manlio Perillo wrote: >> The first difference is about a `mod` b, when a and b are Float types. >> Python use the fmod function, and it also implement divmod; Haskell seems to >> lack support for this operation. I wrote: > Yes, Haskell does not implement the full IEEE. I spoke too soon. Data.Fixe

Re: [Haskell-cafe] about integer and float operations

2009-02-04 Thread Yitzchak Gale
Manlio Perillo wrote: >> fac(777) / fac(777) >>> 1.0 >>> Here CPython does not convert the two integers to float before to divide >>> them, but make use of a special algorithm. >>> GHC, instead, returns NaN I wrote: >> No, actually here Haskell shines. Perhaps this GHCi session >> will illumin

Re: [Haskell-cafe] about integer and float operations

2009-02-04 Thread Yitzchak Gale
Manlio Perillo wrote: > No. > I'm looking for... Manlio - can you describe exactly what you want? Do you know exactly what you want? You have said that you want division like in Python - but that even that is not well defined: Python 2.6.1 >>> 3/5 0 Python 3.1 >>> 3/5 0.59998 Pleas

Re: [Haskell-cafe] about integer and float operations

2009-02-04 Thread Yitzchak Gale
Manlio Perillo wrote: > However there is still a *big* problem: it is inefficient. > > Here is a Python version of the Chudnovsky algorithm [1] for computing Pi: > http://paste.pocoo.org/show/102800/ > On my system it takes 10 seconds. > Here is an Haskell version: > http://paste.pocoo.org/show/102

Re: [Haskell-cafe] about integer and float operations

2009-02-05 Thread Yitzchak Gale
Manlio Perillo wrote: >> I'm looking for an exact integer division that avoids overflows, if >> possible. Richard O'Keefe wrote: > What this sounds like to me is a request that the Prelude > function 'fromRational' should work well... > If you cannot divide two Integers n, d accurately using > (

Re: [Haskell-cafe] about integer and float operations

2009-02-05 Thread Yitzchak Gale
Manlio Perillo wrote: > By the way, in GHC.Float there is a (private): > integerLogBase :: Integer -> Integer -> Int Yes, I have needed this function many times. Too bad it is not exposed. In this case, though, we only need base 2. For that, it would be nice if we could just read it directly from

Re: [Haskell-cafe] Just how unsafe is unsafe

2009-02-07 Thread Yitzchak Gale
Peter Verswyvelen wrote: > I do have asked myself the question whether a "really random generating" > function could be regarded as "pure" somehow Not really. Somewhere in your program you are likely to make the assumption that a value you obtained, however indirectly, from this function will be t

Re: [Haskell-cafe] Just how unsafe is unsafe

2009-02-08 Thread Yitzchak Gale
Peter Verswyvelen wrote: >>> I do have asked myself the question whether >>> a "really random generating" >>> function could be regarded as "pure" somehow I wrote: >> Not really... Alberto G. Corona wrote: > What is pure randomness? .When the algorithmic complexity of the list of > random number

Re: [Haskell-cafe] random shuffle and random list partition

2009-03-17 Thread Yitzchak Gale
Hi Manlio, Manlio Perillo wrote: > For my Netflix Prize project I have implemented two reusable modules. > The first module implements a random shuffle on immutable lists... > The second module implements a function used to partition a list into n > sublists of random length. Very nice! > If som

[Haskell-cafe] Need an overview of FP-related research topics

2009-03-17 Thread Yitzchak Gale
I spoke to a faculty member in a decent Computer Science department in which no one has ever done anything related to FP. (You may say that is an inherent contradiction, but what can I do, the department does have a good reputation. I am withholding names to protect the innocent.) This faculty mem

Re: [Haskell-cafe] Re: Query on list comprehension

2009-03-18 Thread Yitzchak Gale
Melanie_Green writes: >> I want to use listcomprehension to output the pattern below... Jón Fairbairn wrote: > Why do you want to use list comprehensions? > What if they aren't the best way of getting the > result you want? unlines . tail . inits . repeat $ 'a' > concat [replicate n 'a' ++ "\n"

Re: [Haskell-cafe] Need an overview of FP-related research topics

2009-03-18 Thread Yitzchak Gale
I wrote: >> I would like some links that would give such a person >> a nice overview of the various active areas of >> FP-related research these days... Bernie Pope wrote: > Some ideas off the top of my head... Thanks, that's exactly what I was looking for. Also, thanks to Sean for suggesting the

Re: [Haskell-cafe] about Haskell code written to be "too smart"

2009-03-24 Thread Yitzchak Gale
Manlio Perillo complained about: >> buildPartitions xs ns = zipWith take ns . init . scanl (flip drop) xs $ ns Miguel Mitrofanov wrote: > takeList = evalState . mapM (State . splitAt) Ha! Bravo! As the author of the offending zipWith/scanl version, I can say that love those State monad one-liner

Re: [Haskell-cafe] about Haskell code written to be "too smart"

2009-03-24 Thread Yitzchak Gale
Miguel Mitrofanov wrote: >>> takeList = evalState . mapM (State . splitAt) I wrote: >> However, ironically, I stopped using them for pretty >> much the same reason that Manlio is saying. Dan Piponi wrote: > Are you saying there's a problem with this implementation? It's the > only one I could jus

Re: [Haskell-cafe] OpenAL bindings?

2012-01-07 Thread Yitzchak Gale
Jason Dagit wrote: > Looks like the repo [1] for the OpenAL bindings that Sven Panne > created [2] is no longer available. I assume this is a result of The > Great Server Outage of 2011 [3]. > [1] http://darcs.haskell.org/packages/OpenAL/ > [2] http://hackage.haskell.org/cgi-bin/hackage-scripts/pac

Re: [Haskell-cafe] Serializing UTCTimes

2012-01-21 Thread Yitzchak Gale
Bas van Dijk wrote: > What's the recommended way for serializing (with the cereal package) an > UTCTime? Serialize the Day part as an Integer using toModifiedJulianDay/ModifiedJulianDay, (Note that Day is not a constructor, it's just the name of the type.) Serialize the DiffTime as a Rational, a

Re: [Haskell-cafe] Data & newtype differences. Today: strictness

2012-01-22 Thread Yitzchak Gale
Yves Parès wrote: >> Is there some litterature expliciting in a less empiric way than I did the >> differences like this between data and newtype? I've never come against >> such documentation through all my learning of Haskell, yet I think it's an >> important point. Roman Cheplyaka wrote: > See

Re: [Haskell-cafe] Problems installing Data.Encoding package

2012-03-04 Thread Yitzchak Gale
Pēteris Paikens wrote: >  I'm stuck at trying to get Data.Encoding package functional. Cabal > gives the following error message: This is caused by a problem with the cabal file in the encoding package. Often it causes the entire GHC package system to get confused, as pointed out by Brandon. The

Re: [Haskell-cafe] Is protocol-buffers package maintainer reachable?

2012-04-24 Thread Yitzchak Gale
Johan Tibell wrote: > If Chris is indeed out of the loop we should find a new maintainer. > Mark and I are also interested in the future of protocol buffers in > Haskell. Also, Chris is the maintainer of some regex packages that are in the Haskell Platform. -Yitz

Re: [Haskell-cafe] Platform Versioning Policy: upper bounds are not our friends

2012-08-16 Thread Yitzchak Gale
Bryan O'Sullivan wrote: > A substantial number of the difficulties I am encountering are related to > packages specifying upper bounds on their dependencies. This is a recurrent > problem, and its source lies in the recommendations of the PVP itself I think the PVP recommendation is good, though a

Re: [Haskell-cafe] Adding to / subtracting from a LocalTime?

2012-08-19 Thread Yitzchak Gale
Adde Nilsson wrote: >>> Ok, do you know of any way to add/subtract without converting to UTC and >>> back? Brandon Allbery wrote: >> I'm not sure I'd do that in any environment, since usually libraries don't >> deal with the result crossing a daylight/summer time change (and those that >> do, surp

Re: [Haskell-cafe] Recursive timezone-loading function

2012-11-29 Thread Yitzchak Gale
Hi David, David Thomas wrote: > https://github.com/dlthomas/tzcache > A small bit of code, but seems likely to be useful enough that I figured I > should share. > Thanks for sharing this! > 1) Does this already exist somewhere I missed? > I haven't seen it anywhere. > 2) It seems silly to m

Re: [Haskell-cafe] GSoC Project Proposal: Markdown support for Haddock

2013-04-09 Thread Yitzchak Gale
Johan Tibell wrote: > I suggest that we implement an alternative haddock syntax that's a > superset of Markdown. Here is a previous thread on this exact topic, from five years ago: http://www.haskell.org/pipermail/haskell-cafe/2008-February/039846.html It mentions a few additional shades of bike

Re: [Haskell-cafe] Problem with mailman at projects.haskell.org

2013-05-13 Thread Yitzchak Gale
The mailman daemon process on the server apparently exited for some reason. I restarted it, and now mail traffic seems to be going through normally again. -Yitz On Sun, May 12, 2013 at 9:21 PM, Carter Schonwald wrote: > I've had this problem too. Was trying to sign up for the llvm HS lib list >

<    1   2   3   4   5   6   >