Re: [Haskell-cafe] lambda case (was Re: A big hurray for lambda-case (and all the other good stuff))

2012-12-29 Thread Tom Ellis
On Thu, Nov 29, 2012 at 05:49:53PM +, Jon Fairbairn wrote: Ben Franksen ben.franksen at online.de writes: just wanted to drop by to say how much I like the new lambda case extension. I use it all the time and I just *love* how it relieves me from conjuring up dummy variables,

[Haskell-cafe] Thunks and GHC pessimisation

2013-02-24 Thread Tom Ellis
To avoid retaining a large lazy data structure in memory it is useful to hide it behind a function call. Below, many is used twice. It is hidden behind a function call so it can be garbage collected between uses. That's good. When compiling with -O it seems that GHC 7.4.1 decides to keep it in

Re: [Haskell-cafe] Thunks and GHC pessimisation

2013-02-24 Thread Tom Ellis
On Sun, Feb 24, 2013 at 07:12:24PM +0100, Joachim Breitner wrote: You should try: million :: () - Int million _ = 10 ^ (6 :: Int) many :: () - [Int] many x = [1..million x] Thanks Joachim, but that doesn't work either. Tom % cat thunkfail.hs {-# OPTIONS_GHC -fno-warn-unused-binds

Re: [Haskell-cafe] Thunks and GHC pessimisation

2013-02-24 Thread Tom Ellis
On Sun, Feb 24, 2013 at 06:25:56PM +, Don Stewart wrote: If you explicitly rely on this not happening, turn it off: $ ghc -O2 -fno-full-laziness --make A.hs -rtsopts -fforce-recomp [1 of 1] Compiling Main ( A.hs, A.o ) Linking A ... $ time ./A +RTS -M750k

Re: [Haskell-cafe] Thunks and GHC pessimisation

2013-02-26 Thread Tom Ellis
On Tue, Feb 26, 2013 at 10:00:32AM -, o...@okmij.org wrote: Tom Ellis wrote: To avoid retaining a large lazy data structure in memory it is useful to hide it behind a function call. Below, many is used twice. It is hidden behind a function call so it can be garbage collected between

Re: [Haskell-cafe] To seq or not to seq, that is the question

2013-03-09 Thread Tom Ellis
On Fri, Mar 08, 2013 at 08:53:15PM -0800, Edward Z. Yang wrote: Are these equivalent? If not, under what circumstances are they not equivalent? When should you use each? evaluate a return b [...] - Use 'evaluate' when you mean to say, Evaluate this thunk to HNF before doing

[Haskell-cafe] Where's the case? or The difference between simpl and prep

2013-03-14 Thread Tom Ellis
The -ddump-simpl output below doesn't contain a case corresponding to the seq in sum', but the -ddump-prep does. Isn't the output from simpl the input to prep? If so, where does the case reappear from? If not, how are simpl and prep related? It seems to have something to do with Str=DmdType SS

Re: [Haskell-cafe] Where's the case? or The difference between simpl and prep

2013-03-14 Thread Tom Ellis
On Thu, Mar 14, 2013 at 10:43:14PM +, Simon Peyton-Jones wrote: | -Original Message- | From: Tom Ellis | The -ddump-simpl output below doesn't contain a case corresponding to the | seq in sum', but the -ddump-prep does. Isn't the output from simpl the | input to prep? If so

Re: [Haskell-cafe] To seq or not to seq, that is the question

2013-03-22 Thread Tom Ellis
On Fri, Mar 08, 2013 at 08:53:15PM -0800, Edward Z. Yang wrote: Are these equivalent? If not, under what circumstances are they not equivalent? When should you use each? evaluate a return b a `seq` return b return (a `seq` b) Furthermore, consider: [...] - Does the

Re: [Haskell-cafe] Haskell is a declarative language? Let's see how easy it is to declare types of things.

2013-04-04 Thread Tom Ellis
On Thu, Apr 04, 2013 at 11:02:34AM +, Johannes Waldmann wrote: My feeling is that mathematicians use this principle of leaving out some of the quantifiers and putting some others in the wrong place as a cultural entry barrier to protect their field from newbies. Albert showed an example

Re: [Haskell-cafe] Haskell is a declarative language? Let's see how easy it is to declare types of things.

2013-04-04 Thread Tom Ellis
On Thu, Apr 04, 2013 at 01:15:27PM +, Johannes Waldmann wrote: Tom Ellis tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk writes: I didn't see an example of quantifiers in the wrong place. The example was: every x satisfies P(x,y) for some y Oh I see. I interpreted that as lack

Re: [Haskell-cafe] Haskell is a declarative language? Let's see how easy it is to declare types of things.

2013-04-05 Thread Tom Ellis
On Thu, Apr 04, 2013 at 06:29:51PM -0400, Albert Y. C. Lai wrote: You may think you know what's wrong, but you don't actually know until you know how to clarify to the beginners. Note: harping on the word any does not clarify, for the beginners exactly say this: Yeah, t can be *any* type,

Re: [Haskell-cafe] Haskell is a declarative language? Let's see how easy it is to declare types of things.

2013-04-06 Thread Tom Ellis
On Sat, Apr 06, 2013 at 05:14:48PM -0400, Albert Y. C. Lai wrote: On 13-04-05 04:56 AM, Tom Ellis wrote: any is very ambiguous. Doesn't the problem go away if you replace it with all? Yes, that is even better. The world would be simple and elegant if it did things your way, and would

Re: [Haskell-cafe] Numerics and Warnings

2013-04-10 Thread Tom Ellis
On Wed, Apr 10, 2013 at 03:38:35PM +0100, Barak A. Pearlmutter wrote: In fiddling around with some numeric code in Haskell, I noticed some issues. Basically, you get warnings if you write energy mass = mass * c^2 but not if you write energy mass = mass * c * c Numeric typeclasses

Re: [Haskell-cafe] Numerics and Warnings

2013-04-10 Thread Tom Ellis
On Wed, Apr 10, 2013 at 11:20:15PM +0400, Aleksey Khudyakov wrote: This IS rather annoying problem for numeric code. Raising value to positive power is quite common operation yet ^ operator generally couldn't be used because it leads to warning about type defaulting (rightfully) and one wants

Re: [Haskell-cafe] Numerics and Warnings

2013-04-10 Thread Tom Ellis
On Thu, Apr 11, 2013 at 12:56:05AM +0100, Barak A. Pearlmutter wrote: ... in most of the cases I do want this warnings. It's possible to get something default to Integer when it should be Int. There are only few cases when it's not appropriate. Only ^ and ^^ with literals I think There

Re: [Haskell-cafe] unsafeInterleaveST (and IO) is really unsafe [was: meaning of referential transparency]

2013-04-11 Thread Tom Ellis
On Thu, Apr 11, 2013 at 12:49:40PM +1200, Richard A. O'Keefe wrote: On 10/04/2013, at 2:45 PM, o...@okmij.org wrote: ... unsafeInterleaveST is really unsafe ... import Control.Monad.ST.Lazy (runST) import Control.Monad.ST.Lazy.Unsafe (unsafeInterleaveST) import Data.STRef.Lazy

Re: [Haskell-cafe] ANN: rematch, an library for composable assertions with human readable failure messages

2013-04-16 Thread Tom Ellis
On Tue, Apr 16, 2013 at 10:17:48AM +0100, Tom Crayford wrote: I kept on running into this thing where I was calling error in quickcheck to get good error messages about the things I was comparing. In Java land, this stuff is handled by Hamcrest: a library for composable assertions with good

Re: [Haskell-cafe] Monad fold

2013-04-16 Thread Tom Ellis
On Tue, Apr 16, 2013 at 01:53:19PM +0100, Oliver Charles wrote: On 04/16/2013 01:47 PM, Lyndon Maydwell wrote: You could do: runKleisli . mconcat . map Kleisli :: Monoid (Kleisli m a b) = [a - m b] - a - m b Would that work for you? I can't find an instance for Monoid (Kleisli m a b) in

Re: [Haskell-cafe] ANN: Groundhog 0.3 - mysql, schemas and enhanced queries

2013-04-19 Thread Tom Ellis
On Fri, Apr 19, 2013 at 11:42:14AM +0300, Boris Lykah wrote: The full description of the configuration options is available at http://hackage.haskell.org/packages/archive/groundhog-th/0.3.0/doc/html/Database-Groundhog-TH.html Hi Boris, the docs for 0.3.0 don't currently seem to exist. Tom

Re: [Haskell-cafe] Monad Transformer Space Leak

2013-04-23 Thread Tom Ellis
On Tue, Apr 23, 2013 at 09:36:04AM +0200, Petr Pudlák wrote: I tested it on GHC 6.12.1, which wasn't affected by the recent ackermann bug, but still it leaks memory. I tested it on GHC 7.4.1 and I don't see any space leak. ___ Haskell-Cafe mailing

Re: [Haskell-cafe] Backward compatibility

2013-05-02 Thread Tom Ellis
On Thu, May 02, 2013 at 09:26:15PM +0800, Adrian May wrote: How about the Haskell Platform? Is that ancient history? Certainly not: it doesn't compile on anything but the very newest GHC. Not 7.4.1 but 7.4.2. I'm uninformed in such matters, but from

Re: [Haskell-cafe] Backward compatibility

2013-05-02 Thread Tom Ellis
On Thu, May 02, 2013 at 10:36:18PM +0800, Adrian May wrote: Please would somebody explain to me what getPackageId did to incriminate itself? What's getPackageId? It does not appear in the WASH source. Tom ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Backward compatibility

2013-05-02 Thread Tom Ellis
On Thu, May 02, 2013 at 11:10:33PM +0800, Adrian May wrote: What's getPackageId? It does not appear in the WASH source. It's in Setup.lhs, in WashNGo. Which source of WashNGo are you using? It doesn't appear in either of these versions: http://hackage.haskell.org/package/WashNGo-2.12

Re: [Haskell-cafe] Backward compatibility

2013-05-02 Thread Tom Ellis
On Thu, May 02, 2013 at 11:23:12PM +0800, Adrian May wrote: Which source of WashNGo are you using? It doesn't appear in either of these versions: http://hackage.haskell.org/package/WashNGo-2.12 http://hackage.haskell.org/package/WashNGo-2.12.0.1

Re: [Haskell-cafe] Backward compatibility

2013-05-02 Thread Tom Ellis
On Thu, May 02, 2013 at 11:35:27PM +0800, Adrian May wrote: I get a 403 FORBIDDEN on that. How did you get it? I guess you just gotta know the right people ;-) I attached the tarball. Don't say you got it from me, OK. That tarball still doesn't contain the string getPackageId. You're

Re: [Haskell-cafe] Backward compatibility

2013-05-03 Thread Tom Ellis
On Fri, May 03, 2013 at 09:34:21PM +0800, Adrian May wrote: I never doubted that people add new stuff for valid reasons. What I'm interested in is whether or not it could have been done without breaking anything. But having thought about it for a while, I'm tending to think that version

Re: [Haskell-cafe] Fwd: Backward compatibility

2013-05-05 Thread Tom Ellis
On Sun, May 05, 2013 at 10:46:23PM +0200, Alberto G. Corona wrote: The case of WASH is a pity. Architecturally It was more advanced that many recent haskell web frameworks. The package would have been a success with little changes in the DSL syntax. Could you briefly summarise the difference

Re: [Haskell-cafe] fromIntegral not enough?

2013-05-13 Thread Tom Ellis
On Mon, May 13, 2013 at 02:08:26PM -0800, Christopher Howard wrote: instance Integral a = Coord2 (CircAppr a) where coords2 (CircAppr divns ang rad) = let dAng = 2 * pi / (fromIntegral divns) in let angles = map (* dAng) [0..divns] in undefined -- To be coded... Your

Re: [Haskell-cafe] fromIntegral not enough?

2013-05-13 Thread Tom Ellis
On Mon, May 13, 2013 at 11:43:41PM +0100, Tom Ellis wrote: On Mon, May 13, 2013 at 02:08:26PM -0800, Christopher Howard wrote: instance Integral a = Coord2 (CircAppr a) where coords2 (CircAppr divns ang rad) = let dAng = 2 * pi / (fromIntegral divns) in let angles = map

[Haskell-cafe] More general pattern matching

2013-05-19 Thread Tom Ellis
Suppose I have a Category C import Prelude hiding ((.), id) import Control.Category data C a b instance Category C where (.) = undefined id = undefined which has products in the sense that there exists a factors function with suitable properties factors :: C a (b, c) - (C

Re: [Haskell-cafe] HTML framework for web-ui

2013-05-21 Thread Tom Ellis
On Tue, May 21, 2013 at 06:18:16PM +0800, Adrian May wrote: * can I use postgres from Haskell? I've been successfully using http://hackage.haskell.org/package/postgresql-simple It's fine so far except it throws exceptions willy-nilly. (I find exceptions very un-Haskell but some people

Re: [Haskell-cafe] hackage update brigade (was Re: ANNOUNCE: new bridge! (prelude-prime))

2013-05-27 Thread Tom Ellis
On Mon, May 27, 2013 at 02:10:28PM -0400, Clark Gaebel wrote: I'd be down for helping update packages when the time comes. As am I, for what it's worth. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Type classes

2013-05-28 Thread Tom Ellis
On Tue, May 28, 2013 at 04:42:35PM +0200, Johannes Gerer wrote: By the same argument, could'nt I say, that any type class (call it AnyClass) can do everything a Monad can: instance AnyClass m = Monad (Cokleilsi m ()) That doesn't say that AnyClass can do anything a Monad can. AnyClass m =

Re: [Haskell-cafe] Type classes

2013-05-28 Thread Tom Ellis
On Tue, May 28, 2013 at 05:21:58PM +0200, Johannes Gerer wrote: That makes sense. But why does instance Monad m = ArrowApply (Kleisli m) show that a Monad can do anything an ArrowApply can (and the two are thus equivalent)? I've tried to chase around the equivalence between these two

Re: [Haskell-cafe] Type classes

2013-05-28 Thread Tom Ellis
On Tue, May 28, 2013 at 09:09:48PM +0200, Johannes Gerer wrote: What about these two very simple type classes. Are they equivalent? [...] class Pointed f where pure :: a - f a class Unit f where unit :: f a a newtype UnitPointed f a = UnitPointed f a a instance Unit f = Pointed

Re: [Haskell-cafe] Type classes

2013-05-28 Thread Tom Ellis
On Tue, May 28, 2013 at 11:22:22PM +0200, Johannes Gerer wrote: I have to ask, why was plausability and looking at the actual definition (not just the types) not important for the other examples. It would also be important to check the definitions in the other examples too, but it's hard enough

Re: [Haskell-cafe] Array, Vector, Bytestring

2013-06-04 Thread Tom Ellis
On Tue, Jun 04, 2013 at 04:01:37PM +0200, Peter Simons wrote: How is this a problem? If you're representing text, use 'text'. If you're representing a string of bytes, use 'bytestring'. If you want an array of values, think c++ and use 'vector'. the problem is that all those

Re: [Haskell-cafe] Array, Vector, Bytestring

2013-06-04 Thread Tom Ellis
On Tue, Jun 04, 2013 at 11:23:16PM +0200, Peter Simons wrote: On Tue, Jun 04, 2013 at 04:01:37PM +0200, Peter Simons wrote: If you're representing text, use 'text'. If you're representing a string of bytes, use 'bytestring'. If you want an array of values, think c++ and use

Re: [Haskell-cafe] Question about Newtype op() function arguments.

2013-06-07 Thread Tom Ellis
On Fri, Jun 07, 2013 at 07:08:19AM -0700, David Banas wrote: op :: Newtypehttp://hackage.haskell.org/packages/archive/newtype/0.2/doc/html/Control-Newtype.html#t:Newtype n o = (o - n) - n - oSourcehttp://hackage.haskell.org/packages/archive/newtype/0.2/doc/html/src/Control-Newtype.html#op

Re: [Haskell-cafe] Question about Newtype op() function arguments.

2013-06-07 Thread Tom Ellis
to use a type variable from the top level within the body of a function. If you use op and specify a particular constructor then you don't have a variable but a concrete instance of a type. But maybe I'm missing some more powerful way this can be used ... Tom On Jun 7, 2013 2:53 PM, Tom Ellis

Re: [Haskell-cafe] (no subject)

2013-06-10 Thread Tom Ellis
On Mon, Jun 10, 2013 at 05:41:05PM +0530, Zed Becker wrote: Haskell, is arguably the best example of a design-by-committee language. The syntax is clean and most importantly, consistent. The essence of a purely functional programming is maintained, without disturbing its real world capacity.

Re: [Haskell-cafe] Only vaporware needs promises

2013-06-10 Thread Tom Ellis
On Mon, Jun 10, 2013 at 03:21:28PM +0200, Ertugrul Söylemez wrote: Tom Ellis tom-lists-haskell-cafe-2...@jaguarpaw.co.uk wrote: Hear hear! Hopefully we, the Haskell community, will be able to support this endevour with our time and efforts. Every Haskell user does this in their own way

Re: [Haskell-cafe] (no subject)

2013-06-10 Thread Tom Ellis
On Mon, Jun 10, 2013 at 05:44:26PM +0400, MigMit wrote: It really sounds rude, to demand promises from somebody who just gave you a big present. Without wishing to preempt Zed Becker, I interpreted his email as an expression of delight at how well Haskell has been designed and of hope that it

Re: [Haskell-cafe] opengl type confusion

2013-06-16 Thread Tom Ellis
On Sun, Jun 16, 2013 at 01:03:48PM -0700, bri...@aracnet.com wrote: wireframe :: Double - Double - Double - IO () wireframe wx wy wz = do -- yz plane renderPrimitive LineLoop $ do vertex $ Vertex3 0.0 0.0 0.0 vertex $ Vertex3 0.0 wy 0.0

Re: [Haskell-cafe] opengl type confusion

2013-06-17 Thread Tom Ellis
On Sun, Jun 16, 2013 at 05:22:59PM -0700, bri...@aracnet.com wrote: Vertex3 takes three arguments, all of which must be of the same instance of VertexComponent. Specifying GLdoubles in the signature of wireframe specifies the types in the last three calls to Vertex3, but (0.0 :: GLdouble)

Re: [Haskell-cafe] data constructor names

2013-06-22 Thread Tom Ellis
On Sat, Jun 22, 2013 at 04:26:14AM -0500, Brian Lewis wrote: Say you write data Callback = Error ... | ... [...] Then, later, you write data Error = ... [...] They're both good names, but there's a conflict. What do you mean by a conflict? That's fine as far as the compiler is concerned

[Haskell-cafe] Best practices for Arrows?

2013-06-22 Thread Tom Ellis
I feel I may be doing a lot of programming with Arrows in the near future. Currently I'm delighted that Arrow notation[1] exists. It makes using Arrows much less painful. Are there any best-practices I should be aware of with Arrows? Or is it just a case of getting on with it? Tom 1.

Re: [Haskell-cafe] Best practices for Arrows?

2013-06-22 Thread Tom Ellis
Hi Ertugul. Thanks for taking the time to write me an in-depth reply! I have a few comments and a question. On Sat, Jun 22, 2013 at 03:36:15PM +0200, Ertugrul Söylemez wrote: Tom Ellis tom-lists-haskell-cafe-2...@jaguarpaw.co.uk wrote: Are there any best-practices I should be aware

Re: [Haskell-cafe] tangential request...

2013-06-24 Thread Tom Ellis
On Mon, Jun 24, 2013 at 08:02:17AM -0700, Mark Lentczner wrote: And yet, just four fonts make up over 75% of the sample - and two of those are essentially identical! Inconsolata and Consolas? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] question about indentation conventions

2013-07-01 Thread Tom Ellis
On Mon, Jul 01, 2013 at 05:18:39PM +1200, Richard A. O'Keefe wrote: On 1/07/2013, at 1:04 PM, Richard Cobbe wrote: I should have been clearer in my original question: I'm curious about what to do when a multi-argument function application gets split across lines. That wiki page dicsusses

Re: [Haskell-cafe] Casting newtype to base type?

2013-07-01 Thread Tom Ellis
On Mon, Jul 01, 2013 at 05:07:00PM +0200, Vlatko Basic wrote: Hello Cafe! I had a (simplified) record data P = P { a :: String, b :: String, c :: IO String } deriving (Show, Eq) but to get automatic deriving of 'Show' and 'Eq' for 'data P' I have created 'newtype

Re: [Haskell-cafe] Spam on list??

2013-07-01 Thread Tom Ellis
Yeah I'm getting stuff from j...@eukor.com every time I post. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Casting newtype to base type?

2013-07-02 Thread Tom Ellis
On Tue, Jul 02, 2013 at 03:03:08PM +0200, Vlatko Basic wrote: Is there a nicer way to extract the 'IO String' from 'IOS', without 'case' or without pattern matching the whole 'P'? newtype IOS = IOS (IO String) data P = P { getA :: String, getB :: String, getC :: IOS } deriving

Re: [Haskell-cafe] Linux users needed for OpenGL extensions survey

2013-07-09 Thread Tom Ellis
On Mon, Jul 08, 2013 at 09:55:08PM -0700, Kirill Zaborsky wrote: Brian, I think it would be better to provide your email in the thread. E.g. from http://www.haskell.org/pipermail/haskell-cafe/2013-July/109061.html I can only reply to the maillist. I'm answering now through Google Groups

Re: [Haskell-cafe] What have happened to haskell.org?

2013-07-15 Thread Tom Ellis
On Mon, Jul 15, 2013 at 07:19:12AM -0700, Kirill Zaborsky wrote: http://www.haskell.org/hoogle/ responds with some ELF file. After running strings on it, it does seem to be (at least part of) the hoogle binary. ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Wrapping all fields of a data type in e.g. Maybe

2013-07-16 Thread Tom Ellis
On Tue, Jul 16, 2013 at 04:57:59PM -0400, Michael Orlitzky wrote: This all works great, except that when there's 20 or so options, I duplicate a ton of code in the definition of OptionalCfg. Is there some pre-existing solution that will let me take a Cfg and create a new type with Cfg's fields

Re: [Haskell-cafe] memoization

2013-07-22 Thread Tom Ellis
On Mon, Jul 22, 2013 at 12:02:54AM -0800, Christopher Howard wrote: A binding is memoized if, ignoring everything after the equals sign, it looks like a constant. [...] Thanks. That's very helpful to know. Yet, it seems rather strange and arbitrary that f x = ... and f = \x - ... would be

Re: [Haskell-cafe] memoization

2013-07-22 Thread Tom Ellis
On Mon, Jul 22, 2013 at 07:52:06PM +1200, Chris Wong wrote: A binding is memoized if, ignoring everything after the equals sign, it looks like a constant. In other words, these are memoized: [...] f = \x - x + 1 [...] and these are not: f x = x + 1 In what sense is the former

Re: [Haskell-cafe] memoization

2013-07-22 Thread Tom Ellis
On Mon, Jul 22, 2013 at 04:16:19PM +0200, Andreas Abel wrote: In general, I would not trust such compiler magic, but just let-bind anything I want memoized myself: memoized_fib :: Int - Integer memoized_fib x = fibs !! x where fibs = map fib [0..] -- lazily computed infinite list

Re: [Haskell-cafe] memoization

2013-07-23 Thread Tom Ellis
On Mon, Jul 22, 2013 at 04:04:33PM -0700, wren ng thornton wrote: Consider rather, f1 = let y = blah blah in \x - x + y f2 x = let y = blah blah in x + y The former will memoize y and share it across all invocations of f1; whereas f2 will recompute y for each invocation.

Re: [Haskell-cafe] memoization

2013-07-24 Thread Tom Ellis
On Wed, Jul 24, 2013 at 10:06:59AM +0200, Andreas Abel wrote: For -O1 and greater, ghc seems to see that x is not mentioned in the where clauses and apparently lifts them out. Thus, for -O1.. memoized_fib is also memoizing. (I ran it, this time ;-) !) Right, I believe this is the full

Re: [Haskell-cafe] Proposal: Non-recursive let

2013-07-25 Thread Tom Ellis
On Thu, Jul 25, 2013 at 07:34:55PM +1200, Richard A. O'Keefe wrote: It's a queer thing, I always feel that the advice about keeping function bodies small is patronising nonsense for beginners and that *my* code is perfectly readable no matter how big it is, but end up wishing that *other*

Re: [Haskell-cafe] ANNOUNCE: hdbi-1.0.0 and hdbi-postgresql-1.0.0

2013-07-31 Thread Tom Ellis
On Wed, Jul 31, 2013 at 09:45:50AM +0600, Alexey Uimanov wrote: Hello, haskellers. This is the first release of HDBI (Haskell Database Independent interface). Hi, thanks for this Alexey. It's great that there is continued development of this really important infrustructure for Haskell. I have

Re: [Haskell-cafe] ANNOUNCE: hdbi-1.0.0 and hdbi-postgresql-1.0.0

2013-07-31 Thread Tom Ellis
On Wed, Jul 31, 2013 at 01:22:42PM +0600, Alexey Uimanov wrote: I also have the idea do not throw the exceptions in IO but return (Either SqlError a) from all the Connection and Statement methods for safe data processing. What do you think about ? I feel very strongly that you should use

Re: [Haskell-cafe] ANNOUNCE: hdbi-1.0.0 and hdbi-postgresql-1.0.0

2013-07-31 Thread Tom Ellis
On Wed, Jul 31, 2013 at 05:28:02PM +0600, Alexey Uimanov wrote: The rationale is that the low-level database interface accepts parameters directly instead of inserting them inside the query manually. [...] Low-level database interface knows better how to work with parameters, so the driver

Re: [Haskell-cafe] Hoogle problems?

2013-08-01 Thread Tom Ellis
On Thu, Aug 01, 2013 at 01:25:22PM +0100, Richard Evans wrote: It still doesn't work when I try it. What URL are you using? http://www.haskell.org/hoogle works fine for me. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Alternative name for return

2013-08-06 Thread Tom Ellis
On Tue, Aug 06, 2013 at 10:03:04AM +0200, J. Stutterheim wrote: `putStrLn Hi` is not a pure value... Why not? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Alternative name for return

2013-08-06 Thread Tom Ellis
On Tue, Aug 06, 2013 at 04:26:05PM +0200, Jerzy Karczmarczuk wrote: 1. First, it is not true that you can do with, say, (printStr Ho! ) whatever you want. In fact, you can do almost nothing with it. You can transport it as such, and you can use it as the argument of (=). I don't think this

Re: [Haskell-cafe] Alternative name for return

2013-08-08 Thread Tom Ellis
you run it. What do you mean by the same thing? You cannot compare 'them' in any reasonable sense. This, the impossibility to check putStr c == putStr c, is btw, a refutation of the claim by Tom Ellis that you can do even less with (). The void object is an instance of the Eq and Ord classes

Re: [Haskell-cafe] Identity of indiscernibles (Was: Alternative name for return)

2013-08-08 Thread Tom Ellis
On Thu, Aug 08, 2013 at 11:38:08AM +0200, Jerzy Karczmarczuk wrote: Tom Ellis: If I were writing a Haskell compiler I could certainly define 'IO' to be a datatype that would allow me to compare 'putStr c' to itself. The comparison could not be of operational equivalence, but it would still

Re: [Haskell-cafe] Identity of indiscernibles (Was: Alternative name for return)

2013-08-08 Thread Tom Ellis
On Thu, Aug 08, 2013 at 08:41:25AM -0400, Jake McArthur wrote: I don't know what the denotation for this would be, but I can't think of any reasonable ones for which I can write (==) to respect the denotation. For example, is set A, then set B equal to set B, then set A? [...] I'm a bit lost

Re: [Haskell-cafe] Identity of indiscernibles

2013-08-08 Thread Tom Ellis
On Thu, Aug 08, 2013 at 03:38:41PM +0200, Jerzy Karczmarczuk wrote: One could simply implement IO as a free monad Interesting. I wonder how. See [1] for an explanation of free monads in general. For IO in particular, define a functor data IOF a = GetChar (Char - a) | PutChar Char a | ...

Re: [Haskell-cafe] Identity of indiscernibles

2013-08-08 Thread Tom Ellis
On Thu, Aug 08, 2013 at 05:23:50PM +0100, Oliver Charles wrote: On 08/08/2013 05:05 PM, Tom Ellis wrote: On Thu, Aug 08, 2013 at 03:38:41PM +0200, Jerzy Karczmarczuk wrote: One could simply implement IO as a free monad Interesting. I wonder how. See [1] for an explanation of free

Re: [Haskell-cafe] Identity of indiscernibles

2013-08-08 Thread Tom Ellis
On Thu, Aug 08, 2013 at 06:25:12PM +0200, Daniel Trstenjak wrote: See [1] for an explanation of free monads in general. For IO in particular, define a functor data IOF a = GetChar (Char - a) | PutChar Char a | ... with constructors for all elementary IO operations. But how

Re: [Haskell-cafe] Identity of indiscernibles

2013-08-08 Thread Tom Ellis
On Thu, Aug 08, 2013 at 05:44:11PM +0100, Tom Ellis wrote: On Thu, Aug 08, 2013 at 06:25:12PM +0200, Daniel Trstenjak wrote: See [1] for an explanation of free monads in general. For IO in particular, define a functor data IOF a = GetChar (Char - a) | PutChar Char

Re: [Haskell-cafe] Identity of indiscernibles

2013-08-08 Thread Tom Ellis
On Fri, Aug 09, 2013 at 12:38:45AM +0700, Kim-Ee Yeoh wrote: On Thu, Aug 8, 2013 at 11:05 PM, Tom Ellis tom-lists-haskell-cafe-2...@jaguarpaw.co.uk wrote: On Thu, Aug 08, 2013 at 03:38:41PM +0200, Jerzy Karczmarczuk wrote: One could simply implement IO as a free monad Interesting. I

Re: [Haskell-cafe] ANN: hi2 -- a better indentation mode for Emacs' haskell-mode

2013-08-09 Thread Tom Ellis
On Fri, Aug 09, 2013 at 12:53:56PM +0200, Gergely Risko wrote: In the last 2-3 weeks I've been working on Haskell indentation inside Emacs. I had some annoyances for a long time and fixed some of them. The new mode is called hi2, it's heavily based on the current haskell-indentation (part

Re: [Haskell-cafe] Applicative is like an Arrow

2013-08-16 Thread Tom Ellis
On Fri, Aug 16, 2013 at 10:26:42AM -0400, Brandon Allbery wrote: My understanding is that there's a rework of Arrow in progress that may change this in the future, since *theoretical* Arrows are more distinct, flexible and useful than the current implementation. I'd like to know more about

Re: [Haskell-cafe] inv f g = f . g . f

2013-08-17 Thread Tom Ellis
On Sat, Aug 17, 2013 at 11:11:07AM +0200, Christopher Done wrote: Anyone ever needed this? Me and John Wiegley were discussing a decent name for it, John suggested inv as in involution. E.g. inv reverse (take 10) inv reverse (dropWhile isDigit) trim = inv reverse (dropWhile isSpace) .

Re: [Haskell-cafe] Database.postgreSQL.Simple - ambigious type

2013-08-17 Thread Tom Ellis
On Sat, Aug 17, 2013 at 11:59:24PM +0200, Hartmut Pfarr wrote: {-# LANGUAGE OverloadedStrings #-} import Database.PostgreSQL.Simple import Database.PostgreSQL.Simple.FromRow hello :: (FromRow a) = IO [a] hello = do conn - connect defaultConnectInfo query_ conn select 2 + 2 Either

Re: [Haskell-cafe] Database.postgreSQL.Simple - ambigious type

2013-08-18 Thread Tom Ellis
On Sun, Aug 18, 2013 at 10:16:06PM +0200, Hartmut Pfarr wrote: I played a bit with your suggestion, and it is running now :-) But instead of IO [Int] I think we need IO [Only Int] because of the 1-element-tupel problem? Yes you're right. I had forgotten that postgresql-simple dealt with

Re: [Haskell-cafe] Errors in non-monadic code

2013-08-19 Thread Tom Ellis
On Mon, Aug 19, 2013 at 02:20:23PM -0400, jabolo...@google.com wrote: Yeah, non-monadic is not the best term... The problem is that it's always so hard to communicate when you want to say a total function that is not in the context of the IO monad. There should be a simple, short name for

Re: [Haskell-cafe] Errors in non-monadic code

2013-08-19 Thread Tom Ellis
On Mon, Aug 19, 2013 at 05:15:39PM -0400, jabolo...@google.com wrote: But I would like to see more code move away from exceptions and into types like Maybe or Either or other types defined for the particular situation (as some people were suggesting in the beginning of the thread). And the

Re: [Haskell-cafe] Errors in non-monadic code

2013-08-19 Thread Tom Ellis
On Tue, Aug 20, 2013 at 12:25:44AM +0200, Jerzy Karczmarczuk wrote: Le 20/08/2013 00:19, jabolo...@google.com a écrit : If I understand correctly, by escaping continuations you mean that you can easily transfer control between the point where the exception is raised and the exception handler.

Re: [Haskell-cafe] Lifting strictness to types

2013-08-22 Thread Tom Ellis
On Thu, Aug 22, 2013 at 12:51:24PM -0300, Thiago Negri wrote: How hard would it be to lift strictness annotations to type-level? E.g. instead of f :: Int - Int f !x = x + 1 write f :: !Int - Int f x = x + 1 which would have the same effect. At least it would be transparent to the

Re: [Haskell-cafe] sequence causing stack overflow on pretty small lists

2013-08-27 Thread Tom Ellis
On Mon, Aug 26, 2013 at 12:05:14PM -0700, Bryan O'Sullivan wrote: On Mon, Aug 26, 2013 at 1:46 AM, Niklas Hambüchen m...@nh2.me wrote: This is because sequence is implemented as sequence (m:ms) = do x - m xs - sequence ms return

[Haskell-cafe] Strange IO sequence behaviour (Was: sequence causing stack overflow on pretty small lists)

2013-09-04 Thread Tom Ellis
As an addendum to the recent discussion, can anyone explain why main crashes quickly with a stack overflow, whereas main' is happy to print Hi for ages (eventually crashing due to an out of memory condition)? bignum = 100 * 1000 * 1000 main = replicateM bignum (return ()) main' =

Re: [Haskell-cafe] How to read a file and return a String?

2013-09-04 Thread Tom Ellis
On Wed, Sep 04, 2013 at 10:21:37PM +0800, yi lu wrote: I want to read a text file, and store it in a *String*. But readFile will get *IO String*. I search with google and they tell me it is not necessarily to do so. Can you explain to me why is this? Furthermore, How to read a file and store

Re: [Haskell-cafe] Unary functions and infix notation

2013-09-06 Thread Tom Ellis
On Fri, Sep 06, 2013 at 05:04:12PM +0200, Johannes Emerich wrote: Weirdly, however, infix notation can also be used for unary functions with polymorphic types, as the following ghci session shows: Prelude :t (`id` 1) (`id` 1) :: Num a = (a - t) - t Prelude (`id` 1) (\y - show y ++

Re: [Haskell-cafe] Strange IO sequence behaviour (Was: sequence causing stack overflow on pretty small lists)

2013-09-06 Thread Tom Ellis
On Wed, Sep 04, 2013 at 04:35:17PM +0100, Tom Ellis wrote: As an addendum to the recent discussion, can anyone explain why main crashes quickly with a stack overflow, whereas main' is happy to print Hi for ages (eventually crashing due to an out of memory condition)? bignum = 100 * 1000

Re: [Haskell-cafe] Bytestring map/zipWith rationale

2013-09-12 Thread Tom Ellis
On Thu, Sep 12, 2013 at 09:21:20AM -0400, Scott Lawrence wrote: Something's always bothered me about map and zipWith for ByteString. Why is it map :: (Word8 - Word8) - ByteString - ByteString but zipWith :: (Word8 - Word8 - a) - ByteString - ByteString - [a] Well, what if you

Re: [Haskell-cafe] Mystery of an Eq instance

2013-09-20 Thread Tom Ellis
On Fri, Sep 20, 2013 at 06:34:04PM +0200, Stijn van Drongelen wrote: Please find yourself a copy of What Every Computer Scientist Should Know About Floating-Point Arithmetic by David Goldberg, and read it. It should be very enlightening. It explains a bit about how IEEE754, pretty much the

Re: [Haskell-cafe] Mystery of an Eq instance

2013-09-20 Thread Tom Ellis
On Fri, Sep 20, 2013 at 09:47:24PM +0530, damodar kulkarni wrote: Ok, let's say it is the effect of truncation. But then how do you explain this? Prelude sqrt 10.0 == 3.1622776601683795 True Prelude sqrt 10.0 == 3.1622776601683796 True Here, the last digit **within the same precision

[Haskell-cafe] Product Profunctor and Contravariant

2013-09-29 Thread Tom Ellis
Does anyone recognise these typeclasses: import Data.Profunctor (Profunctor) import Data.Functor.Contravariant (Contravariant) class Profunctor p = ProductProfunctor p where empty :: p () () (***!) :: p a b - p a' b' - p (a, a') (b, b') class Contravariant f =

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

2013-10-01 Thread Tom Ellis
On Tue, Oct 01, 2013 at 09:29:00AM +0200, Niklas Haas wrote: On Tue, 1 Oct 2013 02:21:13 -0500, John Lato jwl...@gmail.com wrote: It's not a solution per se, but it seems to me that there's no need for the Monad superclass constraint on MonadIO. If that were removed, we could just have

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

2013-10-01 Thread Tom Ellis
On Tue, Oct 01, 2013 at 12:11:23PM +0300, Roman Cheplyaka 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

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

2013-10-01 Thread Tom Ellis
On Tue, Oct 01, 2013 at 03:17:40PM +0300, Yitzchak Gale wrote: 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

Re: [Haskell-cafe] Any precedent or plan for guaranteed-safe Eq and Ord instances?

2013-10-02 Thread Tom Ellis
On Wed, Oct 02, 2013 at 11:24:39AM +0200, Heinrich Apfelmus wrote: I'm not sure whether the Eq instance you mention is actually incorrect. I had always understood that Eq denotes an equivalence relation, not necessarily equality on the constructor level. There's a difference between

Re: [Haskell-cafe] Any precedent or plan for guaranteed-safe Eq and Ord instances?

2013-10-02 Thread Tom Ellis
On Wed, Oct 02, 2013 at 03:46:42PM +0200, Stijn van Drongelen wrote: * Operators in Eq and Ord diverge iff any of their parameters are bottom. What's the benefit of this requirement, as opposed to, for example False = _ = True ... Tom ___

  1   2   >