Re: [Haskell-cafe] Suggestions For An Intro To Monads Talk.

2010-08-06 Thread Jonathan Geddes
On Fri, Aug 6, 2010 at 9:17 AM, aditya siram aditya.si...@gmail.com wrote: Upon further reflection I realized that my audience is more pragmatic than theoretical. Instead of emphasizing how monads are constructed and the monad laws I think I want to dive right into the most common and useful

[Haskell-cafe] Socket not released

2010-08-07 Thread Jonathan Geddes
Cafe, I'm writing a network application that uses static configuration a la xmonad and yi. When the app receives a certain command it recompiles its source, closes the socket it is using and runs its newly compiled predecessor as a new process. The problem I'm having is that the port that the

Re: [Haskell-cafe] Socket not released

2010-08-07 Thread Jonathan Geddes
Thank you for your response Are you certain of this part?  The usual problem with this kind of program is that the system holds the socket open for a minute or so in case there are any packets in flight for the connection (the lower level network protocols not being 100% reliable). I'm not

Re: [Haskell-cafe] Socket not released

2010-08-09 Thread Jonathan Geddes
You need to close the parent's socket in the child fork, as well as the parent - if it's inherited by the child, it's held open there, even if the parent closes it. Thanks! That did the trick. I did so by adding close_fds = True to the CreateProcess record. However the documentation of

Re: [Haskell-cafe] Socket not released

2010-08-09 Thread Jonathan Geddes
Only a guess, but I predict that it will work for your purposes, since you're not concerned about what happens to std_in et al. I actually am concerned about what happens to std_in. The parent process serializes a bit of state and passes it to the child via the child's std_in. There's probably

Re: [Haskell-cafe] Re: Haskell in Industry

2010-08-09 Thread Jonathan Geddes
people reject FP when it's obviously (to my and my FP-wired brain) superior. --Jonathan Geddes ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] record update

2010-09-11 Thread Jonathan Geddes
I know that record updates is a topic that has become a bit of a dead horse, but here I go anyway: I find that most of the record updates I read and write take the form someUpdate :: MyRecord - MyRecord someUpdate myRecord = myRecord { field1 = f $ field1 myRecord , field2 = g $ field2

Re: [Haskell-cafe] record update

2010-09-11 Thread Jonathan Geddes
On Sat, Sep 11, 2010 at 11:53 AM, Henning Thielemann schlepp...@henning-thielemann.de wrote: Jonathan Geddes schrieb: I know that record updates is a topic that has become a bit of a dead horse, but here I go anyway: I find that most of the record updates I read and write take the form

Re: [Haskell-cafe] record update

2010-09-14 Thread Jonathan Geddes
Wow, I had no idea there were so many record packages! This indicates a couple things to me: a) Haskell is very flexible. b) I'm not the only one who things the built-in record system isn't perfect. Digging a bit deeper, it looks like some of the record-related ghc extensions might also be

[Haskell-cafe] Inverse of HaskellDB

2010-09-25 Thread Jonathan Geddes
Cafe, HaskellDB takes a database schema and produces Haskell data structures (plus some other query-related stuff for its EDSL query language). What I'm looking for is the inverse of this functionality. I want to create tables based on a Haskell data structure with a few simple rules. These

Re: [Haskell-cafe] Inverse of HaskellDB

2010-09-25 Thread Jonathan Geddes
and how to version schemas. Antoine On Sep 25, 2010 2:31 PM, Jonathan Geddes geddes.jonat...@gmail.com wrote: Cafe, HaskellDB takes a database schema and produces Haskell data structures (plus some other query-related stuff for its EDSL query language). What I'm looking for is the inverse

Re: [Haskell-cafe] Inverse of HaskellDB

2010-09-25 Thread Jonathan Geddes
/DatabaseSchemaVersioning.aspx --Jonathan On Sat, Sep 25, 2010 at 3:45 PM, Rogan Creswick cresw...@gmail.com wrote: On Sat, Sep 25, 2010 at 12:31 PM, Jonathan Geddes geddes.jonat...@gmail.com wrote: Does such a thing exist? If not, would you find it useful? I may take this up as a side project if it does

Re: [Haskell-cafe] Question on monad transformers stack

2010-09-28 Thread Jonathan Geddes
Arnaud, You might also consider writing monad-agnostic code: code that doesn't know which monad it is executing in. For example: class (Monad g) = MonadGit g where gitOp1 :: gitOp2 :: instance MonadGit Git where gitOp1 = ... gitOp2 = ... ... intance MonadGit

Re: [Haskell-cafe] Re: Re: Lambda-case / lambda-if

2010-10-08 Thread Jonathan Geddes
I can honestly say that I haven't felt much pain from the status quo regarding this. Most of the time my code is structured so that case statements don't appear in do blocks. When they do, I don't see it as a big issue. The special case for operator - is a bigger wart on haskell syntax than this,

[Haskell-cafe] Haskell is a scripting language inspired by Python.

2010-11-03 Thread Jonathan Geddes
This is off topic (almost regardless of the topic), but It gave me a laugh. Hope you all enjoy it, too. I was telling a friend about the power and elegance of Haskell. When I mentioned that it has influenced many other programming languages, including his favorite language (Python) he retorted by

Re: [Haskell-cafe] Re: Haskell is a scripting language inspired by Python.

2010-11-04 Thread Jonathan Geddes
. Haskell: [f x | x - xs, x = 15] Python: [f(x) for x in xs if x = 15] The Python version reads the way I would speak the Haskell one if I were reading code aloud, though I might say such that rather than for --Jonathan Geddes On Thu, Nov 4, 2010 at 6:05 AM, Stephen Tetley stephen.tet...@gmail.com

Re: Better Records was Re: [Haskell-cafe] Type Directed Name Resolution

2010-11-12 Thread Jonathan Geddes
awkward updates. I submit that it's a different and somewhat unrelated issue, though I'd love to see something that addresses both (all?) of the issues! --Jonathan Geddes [1] http://www.mail-archive.com/haskell-cafe@haskell.org/msg81509.html On Fri, Nov 12, 2010 at 1:29 PM, Andrew Coppin andrewcop

[Haskell-cafe] typeclass namespace rational?

2010-11-15 Thread Jonathan Geddes
cafe, Data Constructors and Type Constructors don't share the same namespace. You see code like the following all the time: data MyRecord = MyRecord {...} This is possible because Data Constructors are used in different parts of the code than Type Constructors so there's never any ambiguity.

[Haskell-cafe] Re: typeclass namespace rational?

2010-11-15 Thread Jonathan Geddes
share a namespace. I would much prefer Module String where (class String(..), data String(..), someOtherFunction) which I think is easier for the reader anyway. --Jonathan On Mon, Nov 15, 2010 at 8:31 PM, Jonathan Geddes geddes.jonat...@gmail.com wrote: cafe, Data Constructors and Type

Re: [Haskell-cafe] [Haskell] Functor = Applicative = Monad

2010-12-14 Thread Jonathan Geddes
Fail can't just be removed. That would just break too much code. For example, I find myself writing code like the following: [a,b,c] - Just someList in place of let [a,b,c] = someList so that pattern match failure is lifted into the maybe monad (as long as I'm already in the maybe monad). I

[Haskell-cafe] $ do?

2010-12-14 Thread Jonathan Geddes
Quick question: Why do I need the $ in the following bits of code? main = withSocketsDo $ do --do something with sockets foo = fromMaybe 0 $ do --do something in the maybe monad I don't see (after admittedly only a minute or so thinking about it) where any grammar ambiguities would

Re: [Haskell-cafe] Haskell, Step by Step, Tutorial, Developing a Whole Application

2010-12-18 Thread Jonathan Geddes
I agree with the feeling that Haskell tutorials feel like they are bottom-up. But I think there's a reason for this: In my experience, at least, Haskell applications are built bottom-up. Functional programming languages strive for composability. In Haskell you have very clean, clear ways of

Re: [Haskell-cafe] Do we need Monad fail (or MonadFail)?

2010-12-21 Thread Jonathan Geddes
I'd love for the compiler to give an error (or maybe just a warning) in the case that I have a pattern match in a monad that just blows up (throws an exception) on a pattern match failure. Currently there's no way to know the behavior of failed pattern match failures without looking at the

Re: [Haskell-cafe] Do we need Monad fail (or MonadFail)?

2010-12-21 Thread Jonathan Geddes
I'd be really interested in learning the rationale behind those changes. I'm sure it wasn't done for capricious or arbitrary reasons, but I can't help but see it as a step back. --Jonathan Geddes (sent from android mobile) On Dec 21, 2010 8:47 AM, Lauri Alanko l...@iki.fi wrote: On Tue, Dec 21

[Haskell-cafe] Template Haskell a Permanent solution?

2010-12-26 Thread Jonathan Geddes
Cafe, First let me say that Template Haskell is very powerful and a lot of great work has been done in this area. It fills in a number of holes in Haskell's feature set. But TH gives me the same feeling as other language features that have been described as bolted on. Also, TH is both library

Re: [Haskell-cafe] Template Haskell a Permanent solution?

2010-12-27 Thread Jonathan Geddes
On Mon, Dec 27, 2010 at 12:44 AM, Henning Thielemann lemm...@henning-thielemann.de wrote: I think it would be enough, if the compiler could be told to unfold an expression like  parse text in a domain specific language  at compile time. I'm afraid I have to disagree with you here. Being able

Re: [Haskell-cafe] Template Haskell a Permanent solution?

2010-12-27 Thread Jonathan Geddes
On Mon, Dec 27, 2010 at 1:14 AM, Stephen Tetley stephen.tet...@gmail.com wrote: By this are you meaning to add quasiquoting to the language Haskell or the Glasgow Haskell, taking it out of the domain of Template Haskell? I believe that all new features should start as extensions and as an

Re: [Haskell-cafe] Template Haskell a Permanent solution?

2010-12-27 Thread Jonathan Geddes
Thanks, everyone, for the responses. I don't understand why the library/extension duality is a problem. I don't think it is a _problem_ it just feels strange to me. Maybe I'm misunderstanding, is it possible to use TH without using the library components? Shouldn't specialized features be

Re: [Haskell-cafe] Template Haskell a Permanent solution?

2010-12-28 Thread Jonathan Geddes
On Tue, Dec 28, 2010 at 8:17 AM, Tillmann Rendel ren...@mathematik.uni-marburg.de wrote: This seems simple enough to me, so it looks as if your use case is already supported as a library on top of the more general API. This is exactly what I was looking for, and much simpler than my previous

[Haskell-cafe] Type System vs Test Driven Development

2011-01-05 Thread Jonathan Geddes
Cafe, In every language I program in, I try to be as disciplined as possible and use Test-Driven Development. That is, every language except Haskell. There are a few great benefits that come from having a comprehensive test suite with your application: 1. Refactoring is safer/easier 2. You have

Re: [Haskell-cafe] Type System vs Test Driven Development

2011-01-05 Thread Jonathan Geddes
The Haskell type system is simply not rich enough to guarantee everything you might need. That's true, and after giving this a bit more thought, I realized it's not JUST the type system that I'm talking about here. There are a few other features that make it hard for me to want to use

[Haskell-cafe] Get a variable's type in quasiquote

2012-01-05 Thread Jonathan Geddes
Cafe, I'm playing around with Template Haskell, specifically QuasiQuotes and I've run into something that I hope is not an inherent limitation in TH. Specifically I want to get the type of a variable whose name is used in a QuasiQuote. The code generated by the QQ should depend on the type of

Re: [Haskell-cafe] Get a variable's type in quasiquote

2012-01-05 Thread Jonathan Geddes
Oops I didn't get to finish... accidentally sent. Here's the completed version: I'm playing around with Template Haskell, specifically QuasiQuotes and I've run into something that I hope is not an inherent limitation in TH.Specifically I want to get the type of a variable whose name is used in a

Re: [Haskell-cafe] Some thoughts on Type-Directed Name Resolution

2012-02-09 Thread Jonathan Geddes
modifyConfig :: (Config - a) - (a - a) - Config - Config modifyConfig fr fv a = a { fr = fv (fr a) I like this Idea. The only problem I see is this: if I'm trying to write code that is very generic and abstract, how does the compiler know if the update a { fr = 5 } is targeting a field

[Haskell-cafe] Requesting Feedback: I Love Haskell, but can't find a place to use it

2012-05-30 Thread Jonathan Geddes
I love Haskell. It is my absolute favorite language. But I have a very hard time finding places where I can actually use it! I had hoped that compiling Haskell to C with -fvia-C (or would it be just -C?) would allow Haskell to run in new, uncharted territory such as Android (with NDK), IOS,

Re: [Haskell-cafe] Requesting Feedback: I Love Haskell, but can't find a place to use it

2012-05-31 Thread Jonathan Geddes
...@gmail.comwrote: On 31 May 2012 01:30, Jonathan Geddes geddes.jonat...@gmail.com wrote: I love Haskell. It is my absolute favorite language. But I have a very hard time finding places where I can actually use it! This has been bugging me for years and, like you, I think we ought to lean towards web

[Haskell-cafe] Most Important GHC extensions to learn/use?

2012-05-31 Thread Jonathan Geddes
Haskell Hackers, I'm pretty comfortable with all of Haskell 98 (and 2010, really). But I've always sort of avoided extensions. I realize that this is a bit silly and if I want to continue learning, it probably means delving into the extensions. Which ones are the most important to know from a

Re: [Haskell-cafe] Most Important GHC extensions to learn/use?

2012-05-31 Thread Jonathan Geddes
not terribly interesting? --J Arthur On Thu, May 31, 2012 at 10:29 PM, wren ng thornton w...@freegeek.orgwrote: On 5/31/12 7:15 PM, Jonathan Geddes wrote: Haskell Hackers, I'm pretty comfortable with all of Haskell 98 (and 2010, really). But I've always sort of avoided extensions. I realize

Re: [Haskell-cafe] How do people still not understand what FP is about? What are we doing wrong?

2012-06-18 Thread Jonathan Geddes
I believe you are observing and commiserating over what Paul Graham famously refers to as the blub paradox[0]. Here is the problem from my perspective. It is a bootstrapping problem: you have to think FP is good to invest the time to learn it, but you have to invest a lot of time to learn it

[Haskell-cafe] Martin Odersky on What's wrong with Monads

2012-06-23 Thread Jonathan Geddes
Cafe, I was watching a panel on languages[0] recently and Martin Odersky (the creator of Scala) said something about Monads: What's wrong with Monads is that if you go into a Monad you have to change your whole syntax from scratch. Every single line of your program changes if you get it in or

[Haskell-cafe] ghci session slows down over time.

2012-06-24 Thread Jonathan Geddes
Haskell Cafe, I'm seeing crazy amounts of slowdown in a ghci session after just a few executions of :r (reload). Using :set +r (revert top-level bindings) doesn't seem to help. Is it possible that the dynamically-loaded object code is not being garbage collected? Is this a known issue? More

Re: [Haskell-cafe] ghci session slows down over time.

2012-06-25 Thread Jonathan Geddes
Thanks for the responses. I am using GHC 7.4.1 an Ubuntu. Shutting down and restarting ghci is my current workaround. I was hoping for something a bit less disruptive. :kickoffGC or something like that. --J Arthur On Mon, Jun 25, 2012 at 6:54 AM, Ketil Malde ke...@malde.org wrote: Jonathan

[Haskell-cafe] Best way to build a GHC backend?

2012-07-07 Thread Jonathan Geddes
Venerable Haskell Hackers, I love Haskell and think it should run everywhere. Now supposing I would like to build another backend for GHC, perhaps for Java Bytecode, .Net CIL, or JavaScript, What would be the best way to approach that? I can think of a few options: 1. Produce External Core with

Re: [Haskell-cafe] Best way to build a GHC backend?

2012-07-08 Thread Jonathan Geddes
I agree that the Raison d'être for a .NET or JVM backend is interop. Perhaps that's not worth the effort of an entirely new backend. JavaScript is a different beast, however. I said before: From my point of view, languages that cannot run on one of the 3 aforementioned platforms will become

Re: [Haskell-cafe] Best way to build a GHC backend?

2012-07-09 Thread Jonathan Geddes
to contribute to (and use). -J Arthur On Mon, Jul 9, 2012 at 8:38 AM, Brent Yorgey byor...@seas.upenn.edu wrote: On Sun, Jul 08, 2012 at 09:21:08AM -0600, Jonathan Geddes wrote: I agree that the Raison d'être for a .NET or JVM backend is interop. Perhaps that's not worth the effort of an entirely new

[Haskell-cafe] What Haskell Records Need

2012-08-01 Thread Jonathan Geddes
Greetings, tl;dr - What Haskell Records need are semantic editor combinators for free. I know this is yet another Record proposal among many, but none of them out there strike me as being exactly what I want in Haskell. Take the following types from a contrived example. type Salary = Integer

Re: [Haskell-cafe] What Haskell Records Need

2012-08-02 Thread Jonathan Geddes
Richard O'Keefe Said: Ouch! And that's not even very deeply nested. Imagine 4 or 5 levels deep. It really makes Haskell feel clunky next to `a.b.c.d = val` that you see in other languages. I was taught that this kind of thing violates the Law of Demeter and that an object should not be

Re: [Haskell-cafe] What Haskell Records Need

2012-08-03 Thread Jonathan Geddes
Evan Laforge wrote: I consider that a strength of the lens approach. If I say 'set (a.b.c.d) 42 record', 'a', 'b' etc. don't have to be record fields, I can swap them out for other lenses later on. I can also easily precompose, e.g. 'setThis = a . b; setThat = b . c' and encourage people to use