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 wrote: The author seemed to be subtly mocking the idea. It seemed to be suggesting that a Num i

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 Has

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 next

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 o

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 } > deriv

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 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 no reason. T

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

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 fr

[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 in

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" 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 > a1 :: Bool

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 > Prelude>foo bar > which actually I mean > Prelude>foo "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

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, a

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

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 a

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

2013-09-01 Thread Anders Persson
For expanding/inlining type synonyms, there is also th-expand-syns ( http://hackage.haskell.org/package/th-expand-syns). /Anders On Mon, Sep 2, 2013 at 3:25 AM, Richard Eisenberg wrote: > No, but I agree that this behavior is useful and in the spirit of > th-desugar. I can add this to the next