Re: [Haskell-cafe] function arithmetic?

2013-09-01 Thread Eric Rasmussen
Might not be exactly what you're looking for, but Control.Arrow has a rich set of operators that can be used to combine functions. For instance, there's an example on http://en.wikibooks.org/wiki/Haskell/Understanding_arrows showing an addA function that can be used to apply two functions to the

[Haskell-cafe] Can I use String without in ghci?

2013-09-01 Thread yi lu
I want to know if it is possible that I use strings without . If I type *Preludefoo bar* which actually I mean *Preludefoo bar* However I don't want to type s. I have noticed if *bar* is predefined or it is a number, it can be used as arguments. But can other strings be used this way? Like in

Re: [Haskell-cafe] function arithmetic?

2013-09-01 Thread Bob Ippolito
Yes, you can do that, but you probably shouldn't. See also: http://www.haskell.org/haskellwiki/Num_instance_for_functions http://hackage.haskell.org/package/applicative-numbers On Sat, Aug 31, 2013 at 10:01 PM, Christopher Howard christopher.how...@frigidcode.com wrote: Hi. I was just

Re: [Haskell-cafe] Can I use String without in ghci?

2013-09-01 Thread Mateusz Kowalczyk
On 01/09/13 07:02, yi lu wrote: I want to know if it is possible that I use strings without . If I type *Preludefoo bar* which actually I mean *Preludefoo bar* However I don't want to type s. I have noticed if *bar* is predefined or it is a number, it can be used as arguments. But can

Re: [Haskell-cafe] function arithmetic?

2013-09-01 Thread Roman Cheplyaka
* Christopher Howard christopher.how...@frigidcode.com [2013-08-31 21:01:38-0800] Hi. I was just curious about something. In one of my math textbooks I see expressions like this f + g or (f + g)(a) where f and g are functions. What is meant is f(a) + g(a) Is there a way in

Re: [Haskell-cafe] function arithmetic?

2013-09-01 Thread Carter Schonwald
To clarify in Bobs remark : while you're still learning Haskell and the type system , things like lifted Num on functions can lead to some potentially confusing type errors. That said, it's absolutely doable, and can be a very nice / powerful tool when used appropriately. On Sunday, September 1,

Re: [Haskell-cafe] function arithmetic?

2013-09-01 Thread Christopher Howard
On 08/31/2013 09:27 PM, Charlie Paul wrote: I believe that this is what you want: http://www.haskell.org/haskellwiki/Num_instance_for_functions On Sat, Aug 31, 2013 at 10:01 PM, Christopher Howard christopher.how...@frigidcode.com wrote: The author seemed to be subtly mocking the idea. It

Re: [Haskell-cafe] On Markdown in Haddock and why it's not going to happen

2013-09-01 Thread Niklas Hambüchen
On 01/09/13 04:27, Mateusz Kowalczyk wrote: It doesn't have to be 1-to-1 but the features have to be expressible in both: it's useless if we have different features with one syntax but not the other. I don't find that useless. Markdown does not have definition lists, but we use a normal list

Re: [Haskell-cafe] Can I use String without in ghci?

2013-09-01 Thread Albert Y. C. Lai
On 13-09-01 02:02 AM, yi lu wrote: I have noticed if *bar* is predefined or it is a number, it can be used as arguments. But can other strings be used this way? Like in bash, we can use *ping 127.0.0.1* where *127.0.0.1* is an argument. Does Bash have a rich type system, like Haskell? Does

Re: [Haskell-cafe] Can I use String without in ghci?

2013-09-01 Thread Albert Y. C. Lai
On 13-09-01 02:41 AM, Mateusz Kowalczyk wrote: It's a bit like asking whether you can do addition everywhere by just typing the numbers to each other (no cheating and defining number literals as functions ;) ). To your horror, common math language does some of that. When 3 and ½ are typed

Re: [Haskell-cafe] Can I use String without in ghci?

2013-09-01 Thread Michael Sloan
Not that I really want to encourage such a stringly typed practice, but it wouldn't really be that much of a stretch. * Use haskell-src-exts[0] and haskell-src-meta[1] to make a quasiquoter that can parse Haskell syntax * Use syb[2] or some other generics to find VarE and ConE expressions. In

Re: [Haskell-cafe] Hoogle vs Hayoo

2013-09-01 Thread Neil Mitchell
Hi, Hoogle is definitely not deprecated. The reason you can't yet search all packages simultaneously is that it consumes too many resources - the number of Haskell packages exploded at a time when I wasn't able to spend enough time to allow Hoogle to keep up. It's definitely something on the todo

Re: [Haskell-cafe] Performance of delete-and-return-last-element

2013-09-01 Thread Harald Bögeholz
Am 31.08.13 14:35, schrieb Petr Pudlák: One solution would be to fold over a specific semigroup instead of a recursive function: |import Data.Semigroup import Data.Foldable(foldMap) import Data.Maybe(maybeToList) data Darle a =Darle {getInit :: [a],getLast ::a } deriving

Re: [Haskell-cafe] Compiler stops at SpecConstr optimization

2013-09-01 Thread Daniel Díaz Casanueva
Yes, that GHC ticket shows that this problem is well known. Thank you. On Fri, Aug 30, 2013 at 2:19 AM, Ben Lippmeier b...@ouroborus.net wrote: On 30/08/2013, at 2:38 AM, Daniel Díaz Casanueva wrote: While hacking in one of my projects, one of my modules stopped to compile for apparently

Re: [Haskell-cafe] On Markdown in Haddock and why it's not going to happen

2013-09-01 Thread Mateusz Kowalczyk
On 01/09/13 13:59, Niklas Hambüchen wrote: On 01/09/13 04:27, Mateusz Kowalczyk wrote: It doesn't have to be 1-to-1 but the features have to be expressible in both: it's useless if we have different features with one syntax but not the other. I don't find that useless. Markdown does not have

Re: [Haskell-cafe] Proposal: Polymorphic typeclass and Records

2013-09-01 Thread Wvv
Thanks! You do a great job! Adam Gundry wrote Haskell doesn't allow classes to be polymorphic in the names of their methods Yes, still not (( -- View this message in context: http://haskell.1045720.n5.nabble.com/Proposal-Polymorphic-typeclass-and-Records-tp5735096p5735365.html Sent from

[Haskell-cafe] Proposal: Generic conditions for 'if' and 'case'

2013-09-01 Thread Wvv
I think it is an old idea, but nevertheless. Now we have next functions: if (a :: Bool) then x else y case b of a1 :: Bool - x1 a2 :: Bool - x2 ... Let we have generic conditions for 'if' and 'case': class Boolean a where toBool :: a - Bool instance Boolean Bool where toBool = id

Re: [Haskell-cafe] Proposal: Generic conditions for 'if' and 'case'

2013-09-01 Thread Nicolas Trangez
I didn't test it, but you might want to look into the 'rebindable syntax' extension and its 'ifThenElse' feature. Nicolas On Sep 2, 2013 12:51 AM, Wvv vite...@rambler.ru wrote: I think it is an old idea, but nevertheless. Now we have next functions: if (a :: Bool) then x else y case b of

Re: [Haskell-cafe] function arithmetic?

2013-09-01 Thread Richard A. O'Keefe
On 1/09/2013, at 7:06 PM, Christopher Howard wrote: It seemed to be suggesting that a Num instance for functions would imply the need for constant number functions, which leads to difficulties. But I don't see why one would have to take it that far. You *cannot* make a type an instance of

Re: [Haskell-cafe] Can I use String without in ghci?

2013-09-01 Thread Richard A. O'Keefe
On 1/09/2013, at 6:02 PM, yi lu wrote: I want to know if it is possible that I use strings without . If I type Preludefoo bar which actually I mean Preludefoo bar However I don't want to type s. I have noticed if bar is predefined or it is a number, it can be used as arguments. But

Re: [Haskell-cafe] ANN: th-desugar simplifies Template Haskell processing

2013-09-01 Thread Richard Eisenberg
No, but I agree that this behavior is useful and in the spirit of th-desugar. I can add this to the next version, which should come out in a few days (tomorrow?), because I've noticed a bug with the scoping of as-patterns in let statements. Thanks for the suggestion! Richard On Aug 31, 2013,

Re: [Haskell-cafe] Can I use String without in ghci?

2013-09-01 Thread Rustom Mody
On Mon, Sep 2, 2013 at 5:43 AM, Richard A. O'Keefe wrote: A slogan I have programmed by since I first met C and recognised how vastly superior to PL/I it was for text manipulation _because_ it didn't have a proper string type is Strings are Wrong!. I wonder if you notice the irony in your

Re: [Haskell-cafe] Can I use String without in ghci?

2013-09-01 Thread Richard A. O'Keefe
On 2/09/2013, at 3:55 PM, Rustom Mody wrote: On Mon, Sep 2, 2013 at 5:43 AM, Richard A. O'Keefe wrote: A slogan I have programmed by since I first met C and recognised how vastly superior to PL/I it was for text manipulation _because_ it didn't have a proper string type is Strings are