[Haskell-cafe] Type-class conditional behavior

2011-05-07 Thread Nicholas Tung
Dear all, I'd like to write a function "maybeShow :: a -> Maybe String", which runs "show" if its argument is of class Show. The context and motivation for this are as follows. I have a GADT type which encapsulates abstract-value computation (or constants or error codes), a snippet of whi

Re: [Haskell-cafe] ANNOUNCE: iterIO-0.1 - iteratee-based IO with pipe operators

2011-05-07 Thread wren ng thornton
On 5/7/11 5:15 PM, dm-list-haskell-c...@scs.stanford.edu wrote: In general, I try to place as few requirements in the contexts of functions as possible. One counterargument to this philosophy is that there are many cases where fmap can be defined more efficiently than the liftM derived from r

Re: [Haskell-cafe] Those damned parentheses

2011-05-07 Thread wren ng thornton
On 5/7/11 4:29 PM, Eitan Goldshtrom wrote: I know about the $ symbol, that's why it's in there in the respective places. I see that I can use it to fix my problem, but I was trying to figure out function composition really. I guess that's just not the place for it. I'll check out Control.Applicat

Re: [Haskell-cafe] Those damned parentheses

2011-05-07 Thread Felipe Almeida Lessa
As another suggestion, you may try HLint [1]. It usually tells you if you put unnecessary parenthesis. Among other nice suggestions. [1] http://community.haskell.org/~ndm/hlint/ (or cabal-install hlint) Cheers, =) -- Felipe. ___ Haskell-Cafe maili

Re: [Haskell-cafe] ANNOUNCE: iterIO-0.1 - iteratee-based IO with pipe operators

2011-05-07 Thread dm-list-haskell-cafe
At Sat, 07 May 2011 21:50:13 +0100, Maciej Marcin Piechotka wrote: > > Sorry for third post but I wonder why the many instances are restricted > by Monad. It would be great if Functor were a superclass of Monad. However, since it isn't, and since I can't think of anything particularly useful to

Re: [Haskell-cafe] ANNOUNCE: iterIO-0.1 - iteratee-based IO with pipe operators

2011-05-07 Thread Maciej Marcin Piechotka
Sorry for third post but I wonder why the many instances are restricted by Monad. Both Functor and Applicative can by constructed without Monad: > instance (Functor m) => Functor (CtlArg t m) where > fmap f (CtlArg arg g c) = CtlArg arg (fmap f . g) c > > instance (Functor m) => Functor (Ite

Re: [Haskell-cafe] For Project Euler #1 isn't it more efficient to generate just the numbers you need?

2011-05-07 Thread KC
Got it. You mean use the formula for summing an arithmetic progression twice and take account of duplicates. Sheer genius! On Sat, May 7, 2011 at 11:56 AM, Eugene Kirpichov wrote: > One doesn't have to touch them to compute their sum. > > 2011/5/7 KC : >> Do you mean O(1) complexity? >> >> Don

Re: [Haskell-cafe] Those damned parentheses

2011-05-07 Thread Eitan Goldshtrom
I know about the $ symbol, that's why it's in there in the respective places. I see that I can use it to fix my problem, but I was trying to figure out function composition really. I guess that's just not the place for it. I'll check out Control.Applicative. Also thanks for the clarification on

Re: [Haskell-cafe] Those damned parentheses

2011-05-07 Thread Antoine Latter
On Sat, May 7, 2011 at 2:10 PM, Eitan Goldshtrom wrote: > Hi. I am kind of tired of all of the parentheses I have to put in places and > I'm trying to figure out what is the correct way to write code such that I > can leave out parentheses. For example, I have the following: > > data Message = ...

Re: [Haskell-cafe] Those damned parentheses

2011-05-07 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 5/7/11 15:10 , Eitan Goldshtrom wrote: > I get the error "Couldn't match expected type `[Char]' with actual type `a0 > -> c0'". The only way it seems to work is > f p = putStrLn $ (show (Main.id p)) ++ " - message received" Interestingly enough, yo

[Haskell-cafe] Those damned parentheses

2011-05-07 Thread Eitan Goldshtrom
Hi. I am kind of tired of all of the parentheses I have to put in places and I'm trying to figure out what is the correct way to write code such that I can leave out parentheses. For example, I have the following: data Message = ... --leaving this out because it's not important data Plane = Pla

Re: [Haskell-cafe] For Project Euler #1 isn't it more efficient to generate just the numbers you need?

2011-05-07 Thread Eugene Kirpichov
One doesn't have to touch them to compute their sum. 2011/5/7 KC : > Do you mean O(1) complexity? > > Don't you have to touch at least the multiples of 3 & 5 making it O(k) > where is the number of multiples of 3 and the number of multiples of > 5? > > > On Fri, May 6, 2011 at 10:10 PM, Lyndon May

Re: [Haskell-cafe] For Project Euler #1 isn't it more efficient to generate just the numbers you need?

2011-05-07 Thread KC
Do you mean O(1) complexity? Don't you have to touch at least the multiples of 3 & 5 making it O(k) where is the number of multiples of 3 and the number of multiples of 5? On Fri, May 6, 2011 at 10:10 PM, Lyndon Maydwell wrote: > If you're looking for efficiency, I believe you can actually do #

Re: [Haskell-cafe] Server hosting

2011-05-07 Thread Gregory Collins
On Sat, May 7, 2011 at 12:38 PM, Andrew Coppin wrote: > On 07/05/2011 09:10 AM, Gregory Collins wrote: >> >> Linode. Can't recommend them highly enough. > > If Linode is really the cheapest that the Internet has to offer, I'm going > to need to find a job that pays /significantly/ more money... I

Re: [Haskell-cafe] lambdabot install error

2011-05-07 Thread Sönke Hahn
Sönke Hahn wrote: > There is a related bug report in ghc's trac: [1]. According to that, you > could try to remove the "-fvia-C" flag to prevent ghc from using the C > backend. (I had no luck with that, so I guess there is still another bug > lurking.) Just FYI: I tried again and realised, why I

Re: [Haskell-cafe] Server hosting

2011-05-07 Thread Ralph Hodgson
I am considering hetzner online in Germany - http://www.hetzner.de/en/hosting/produkte_rootserver/eq4 Ralph Hodgson @ralphtq On May 7, 2011, at 6:27 AM, Charles-Pierre Astolfi wrote: > I'm using tilaa.nl. It starts at ~10€/month and they are quite > friendly and competent. > -- > Cp > > > >

Re: [Haskell-cafe] Server hosting

2011-05-07 Thread Daniel Patterson
I've had good experiences with prgmr VPSes; I currently have a 1024MB VPS that I'm paying $16 a month for (the month by month rate is $20, but I'm paying for it yearly). You can also grab a 256MB VPS for $8 month by month or $6.40 yearly, if that'd be enough. In the last year I think there was

Re: [Haskell-cafe] Server hosting

2011-05-07 Thread Charles-Pierre Astolfi
I'm using tilaa.nl. It starts at ~10€/month and they are quite friendly and competent. -- Cp On Sat, May 7, 2011 at 13:53, Nicolas Wu wrote: > On 7 May 2011 13:52, Nicolas Wu wrote: >>> Then again, >>> I haven't found many companies that list prices in GBP.) >> >> I use rackhost.co.uk > > Oops

Re: [Haskell-cafe] Server hosting

2011-05-07 Thread Nicolas Wu
On 7 May 2011 13:52, Nicolas Wu wrote: >> Then again, >> I haven't found many companies that list prices in GBP.) > > I use rackhost.co.uk Oops, I mean rackspace.co.uk, who I believe are the people behind slicehost.com which comes highly recommended. Nick ___

Re: [Haskell-cafe] Server hosting

2011-05-07 Thread Nicolas Wu
> Then again, > I haven't found many companies that list prices in GBP.) I use rackhost.co.uk I've had no problems with them at all, and they charge in GBP. A cheaper alternative is CheapVPS, I moved away from them since they're not terribly reliable, but probably good enough for personal websites

[Haskell-cafe] Manatee-0.2.1 release!

2011-05-07 Thread Lazycat Manatee
Hi all, Manatee-0.2.1 release! (Detail see: http://goo.gl/MkVw http://goo.gl/PnPbq http://goo.gl/OSpz8) New features in new version: * Show welcome page when you first time use Manatee, make manatee easier to use. * Keymap helper, you just need hit Ctrl+/ or Ctrl+? if you don't know keymap. * Wi

Re: [Haskell-cafe] Server hosting

2011-05-07 Thread Erik Hesselink
On Sat, May 7, 2011 at 12:38, Andrew Coppin wrote: > On 07/05/2011 09:10 AM, Gregory Collins wrote: >> >> Linode. Can't recommend them highly enough. > > If Linode is really the cheapest that the Internet has to offer, I'm going > to need to find a job that pays /significantly/ more money... > > (

Re: [Haskell-cafe] Server hosting

2011-05-07 Thread Andrew Coppin
On 06/05/2011 07:16 PM, JP Moresmau wrote: I use Amazon EC2 Free Tier. You can install Yesod/Warp easily enough and it's fine for small traffic. My understanding is that EC2 is only free for 1 year, after which you pay full price. ($0.02/hour = $15/month if it's running full-time.) _

Re: [Haskell-cafe] Server hosting

2011-05-07 Thread Andrew Coppin
On 07/05/2011 09:10 AM, Gregory Collins wrote: Linode. Can't recommend them highly enough. If Linode is really the cheapest that the Internet has to offer, I'm going to need to find a job that pays /significantly/ more money... (I'm also not sure whether being billed in USD is possibly a bad

Re: [Haskell-cafe] Server hosting

2011-05-07 Thread Gregory Collins
Linode. Can't recommend them highly enough. G On Fri, May 6, 2011 at 8:07 PM, Andrew Coppin wrote: > OK, so strictly this is unrelated to Haskell as such. However, there's > enough people doing webby stuff with Haskell that some of you must have > wanted to run your code on a real, Internet-acce

Re: [Haskell-cafe] trying to cabal install lambdabot, failure on 'random' package

2011-05-07 Thread Stephen Tetley
"show" is the failing package A look on Hackage suggests that "show" had problems with its cabal file at versions 0.4 & 0.4.1 and was fixed at 0.4.1.1. Can you try installing "show" individually at 0.4.1.1 the try installing the rest of lambdabot. ___

Re: [Haskell-cafe] Server hosting

2011-05-07 Thread Heinrich Apfelmus
Andrew Coppin wrote: OK, so strictly this is unrelated to Haskell as such. However, there's enough people doing webby stuff with Haskell that some of you must have wanted to run your code on a real, Internet-accessible web server. So does anybody have any suggestions on which companies offer th