Re: [Haskell-cafe] Learn You a Haskell for Great Good - a few doubts

2011-03-10 Thread Ben Moseley

On 7 Mar 2011, at 23:38, Alexander Solla wrote:
_|_ /= (_|_,_|_)
 
  (undefined, undefined)
 (*** Exception: Prelude.undefined
 
 That is as close to Haskell-equality as you can get for a proto-value that 
 does not have an Eq instance.  As a consequence of referential transparency, 
 evaluation induces an equivalence relation.  This implies that (_|_, _|_) = 
 _|_ = (_|_, _|_).

Surely the key thing is the '(' character which is produced immediately before 
the exception is encountered.

I'd say that demonstrates that in GHC  _|_ /= (_|_,_|_).

--Ben

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


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

2010-08-12 Thread Ben Moseley


 it's clear that FP ideas are becoming mainstream
_without_ any need of help from the financial community


This is far from clear - unless you want to deny that the financial community 
has had any impact on FP...

 due to Objective C with its Smalltalk influence

...and it's interesting to note that, had it not been for the financial 
community there's a strong chance that NeXT / Objective-C would have died years 
ago (finance were one of their main markets).

--Ben

On 12 Aug 2010, at 03:03, Richard O'Keefe wrote:

 
 On Aug 11, 2010, at 7:30 PM, Ketil Malde wrote:
 Sure, if the premise is that investment banks (or the military) are evil,
 then it is morally questionable to support them.  If these are the
 major consumers of functional programming, one might question the ethics
 of working on FP in general as well.
 
 But as I interpreted this thread, the premise was not about the morality
 of specific sectors, but rather that finance takes away too much of
 the FP talent.
 
 One (but only one, and I do not say the major one)
 of the aspects of the global financial crisis is that
 bankers created a number of advanced financial instruments
 which nobody really knew how to value.
 Advanced computational models were developed for the purpose.
 People were warning about this 10 years ago or more; I bought a
 couple of books about it from a remainder shop.
 
 If functional programming gets associated in the profession's
 eyes with *that* kind of programming, it will not do FP any good.
 
 In any case, what with lambda expressions already in Apple's C
 (of all languages!), it's clear that FP ideas are becoming mainstream
 _without_ any need of help from the financial community.  (Actually,
 that particular one is probably due to Objective C with its Smalltalk
 influence, so the functional origin here is ultimately Lisp.)
 
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


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

2010-08-11 Thread Ben Moseley
 Investment banking isn't likely to lead to improvements in zygohistomorphic 
 prepromorphisms. 

Given that an investment bank could (purely hypothetically of course ;-) 
use - say - paramorphisms as their fundamental approach to processing a 
deeply-embedded DSEL, I wouldn't be too quick to rule them out of improvements 
to recursion combinators...

And, more generally, Investment Banking has interesting problems to solve, 
smart people working there, and a willingness to use (and improve) cutting-edge 
technology.

IMHO, all of these are good things.

--Ben

On 10 Aug 2010, at 19:56, wren ng thornton wrote:

 Henning Thielemann wrote:
 about functional programming jobs in investment banking ...
 Ketil Malde schrieb:
 Tom Hawkins tomahawk...@gmail.com writes:
 (Yes, I realize that's were the money is [...])
 Exactly.
 
 I don't think this is bad: having talented people recruited to work
 on functional programming will improve the technology for all of us.
 I'm not sure I follow this opinion in general. Analogously I could say:
 Supporting military is a good idea, since they invest in new
 technologies. That's not my opinion. Maybe the next financial crisis
 leads us into the next world war.
 
 But that analogy is a bit disingenuous. If investment bankers care so much 
 about performance (because a few milliseconds delay in transactions can cost 
 a lot) then getting a lot of talented functional programmers in finance means 
 there will be a good deal of work in figuring out how to improve performance. 
 Thus, anyone who wants performance will benefit directly; regardless of 
 attendant outcomes.
 
 While the military invests in technology, they invest mainly in technology 
 that advances a particular goal. Thus, it's good for them to have smart 
 people if you would like improvements to that particular kind of technology. 
 (Which includes the Internet and natural language processing ---for very 
 militaristic reasons, both of them---, as well as the obvious.) Investment 
 banking isn't likely to lead to improvements in zygohistomorphic 
 prepromorphisms. If that's where you think we need to be improving our 
 technology, then having smart people in investment banking doesn't help. But 
 that's a different claim than the claim that they'd improve performance or 
 overall acceptance in the job market.
 
 -- 
 Live well,
 ~wren
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Is this Parsec code idiomatic?

2009-09-04 Thread Ben Moseley

Or for a bit of variety:

selectPlus s = [cs | ('+':cs) - lines s]

--Ben

On 4 Sep 2009, at 20:40, Martijn van Steenbergen wrote:


Hi Serge,

Serge LE HUITOUZE wrote:

I'm asking some advice on a small piece of code representing a
simplified version of a treatment I need to perform.
I have a line-oriented string/file, from which I want to extract
only a substring of those lines starting with char '+' (the detail
of the extraction is irrelevant here, I'll just return what follows
the '+').


This isn't really answering your question, but I thought I'd share  
anyway: why use Parsec to retrieve those lines? It seems a simple  
function is a lot easier:


selectPlus :: String - [String]
selectPlus = map tail . filter ((== '+') . head) . lines

I hope this helps you.

Martijn.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] type and data constructors in CT

2009-02-01 Thread Ben Moseley


On 31 Jan 2009, at 20:54, Gregg Reynolds wrote:

On Sat, Jan 31, 2009 at 1:02 PM, Ben Moseley ben_mose...@mac.com  
wrote:
You can view a polymorphic unary type constructor of type :: a -  
T as a

polymorphic function.


Shouldn't that be * :: a - T a  ?


Yes, you're right. And when I say polymorphic unary type constructor  
I really mean polymorphic unary /data/ constructor ...



In general, polymorphic functions correspond roughly to natural
transformations (in this case from the identity functor to T).



Are you saying a type constructor is a nat trans and not a functor
(component)?


Nope ... what I was trying to say is that the data constructor bit is  
like a nat trans. (You're right that a unary type constructor often  
does correspond to a functor - providing there's a corresponding arrow/ 
function component).



 Seems much more like a plain ol' functor mapping of
object to object to me - the objects being types.  Can you clarify
what you mean about the correspondence with natural transformations?


So, the idea is that any polymorphic Haskell function (including Data  
constructors) can be seen as a natural transformation - so a  
function from any object (ie type) to an arrow (ie function). So,  
take listToMaybe :: [a] - Maybe a ... this can be seen as a natural  
transformation from the List functor ([] type constructor) to the  
Maybe functor (Maybe type constructor) which is a function from any  
type a (eg 'Int') to an arrow (ie Haskell function) eg  
listToMaybe :: [Int] - Maybe Int.


Hope that makes somewhat more sense.

Cheers,

--Ben


I admit I haven't thought through polymorphic function, mainly
because there doesn't seem to be any such beast in category theory,
and to be honest I've always thought the metaphor is misleading.
After all, a function by definition cannot be polymorphic.  It seems
like fancy name for a syntactic convenience to me - a way to express
/intensionally/ a set of equations without writing them all out
explicitly.

Thanks,

gregg



--Ben

On 31 Jan 2009, at 17:00, Gregg Reynolds wrote:


Hi,

I think I've finally figured out what a monad is, but there's one
thing I  haven't seen addressed in category theory stuff I've found
online.  That is the relation between type constructors and data
constructors.

As I understand it, a type constructor Tcon a is basically the  
object

component of a functor T that maps one Haskell type to another.
Haskell types are construed as the objects of category  
HaskellType.

I think that's a pretty straightforward interpretation of the CT
definition of functor.

But a data constructor Dcon a is an /element/ mapping taking  
elements

(values) of one type to elements of another type.  So it too can be
construed as a functor, if each type itself is construed as a
category.

So this gives us two functors, but they operate on different things,
and I don't see how to get from one to the other in CT terms.  Or
rather, they're obviously related, but I don't see how to express  
that

relation formally.

If somebody could point me in the right direction I'd be grateful.
Might even write a tutorial.  Can't have too many of those.

Thanks,

Gregg
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe





___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] type and data constructors in CT

2009-01-31 Thread Ben Moseley
You can view a polymorphic unary type constructor of type :: a - T  
as a polymorphic function.


In general, polymorphic functions correspond roughly to natural  
transformations (in this case from the identity functor to T).


--Ben

On 31 Jan 2009, at 17:00, Gregg Reynolds wrote:


Hi,

I think I've finally figured out what a monad is, but there's one
thing I  haven't seen addressed in category theory stuff I've found
online.  That is the relation between type constructors and data
constructors.

As I understand it, a type constructor Tcon a is basically the object
component of a functor T that maps one Haskell type to another.
Haskell types are construed as the objects of category HaskellType.
I think that's a pretty straightforward interpretation of the CT
definition of functor.

But a data constructor Dcon a is an /element/ mapping taking elements
(values) of one type to elements of another type.  So it too can be
construed as a functor, if each type itself is construed as a
category.

So this gives us two functors, but they operate on different things,
and I don't see how to get from one to the other in CT terms.  Or
rather, they're obviously related, but I don't see how to express that
relation formally.

If somebody could point me in the right direction I'd be grateful.
Might even write a tutorial.  Can't have too many of those.

Thanks,

Gregg
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Editor

2007-05-21 Thread Ben Moseley

You mentioned a dream 

Have you looked at Yi? might be worth a peek if you're prepared  
to work towards your dream.


http://www.haskell.org/haskellwiki/Yi

...a long way to go - but it certainly nails #7!

--Ben

On 21 May 2007, at 15:44, Leif Frenzel wrote:


Bayley, Alistair wrote:

1.  A real GUI
2.	Good quality syntax highlighting for Haskell..., plus: 	3.	raw  
Haskell both forms of Literate Haskell; 	4.	properly highlight  
Haddock comments; 	5.	highlight functions and types from  
libraries differently

from local

3.  Line folding to hide and show blocks of code.
4.  Code completion
5.	Easy, quick access to online documentation 6.	access to  
external utilities for compilation, debugging,

profiling, type inference,

project management, etc. 7. A good plug-in system

Having dismissed Visual Haskell for being Windows-only, have you
considered EclipseFP? It doesn't tick all of your boxes, but maybe it
goes far enough in the right direction. AFAICT it fulfills 1, 2.3,  
2.5

(but I'm not sure about this), 3, 6, and 7 (ish - plugins would be
written in Java).
There is also some experimentation under way to implement plugins  
in Haskell: http://leiffrenzel.de/eclipse/cohatoe/ The Haskell code  
is plugged into Eclipse via hs-plugins. However, the ultimate entry  
point to the IDE is still Eclipse's, so there will be some Java/XML  
boilerplate necessary for getting a plugin hooked.


Thanks  ciao,
Leif


Alistair
*
Confidentiality Note: The information contained in this message,
and any attachments, may contain confidential and/or privileged
material. It is intended solely for the person(s) or entity to
which it is addressed. Any review, retransmission, dissemination,
or taking of any action in reliance upon this information by
persons or entities other than the intended recipient(s) is
prohibited. If you received this in error, please contact the
sender and delete the material from any computer.
*
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] what GUI library should i select?

2006-11-13 Thread Ben Moseley

Has anyone succeeded in getting it running on OSX/intel at all?

...I had a brief go a few weeks back, managed to get the Cairo Clock  
running, but anything that used GTK seemed to blow up instantly. (OSX/ 
ppc was fine).


--Ben

On 13 Nov 2006, at 19:03, Duncan Coutts wrote:


On Mon, 2006-11-13 at 18:00 +, Tim Docker wrote:
afaik, there are just two good enough libs - wxHaskell and GtkHs.  
can

anyone point (or write) detailed comparison of their features?


One point in wxHaskell's favour is that it supports Mac OS X  
directly. At
present, to the best of my knowledge, you can only run GtkHs  
applications
on OS X using the X Windows server. Whilst this works, it's a  
_long_ way

from native look and feel.


This is quite true. Fortunately the Gtk+ folk are well underway with a
project to make it all more native looking. The latest released  
version

of Gtk+ 2.10.x has 'experimental' support for running on OSX without
using X11. The next step (apart from general bug fixing) is to use the
right native theme.

So yes, at the moment it doesn't look native on OSX but hopefully  
in the

future it will. You can read more about that here:

http://developer.imendio.com/projects/gtk-macosx

Duncan

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] what GUI library should i select?

2006-11-13 Thread Ben Moseley

gtk-demo seemed to run fine.

--Ben

On 13 Nov 2006, at 21:01, Duncan Coutts wrote:


On Mon, 2006-11-13 at 20:49 +, Ben Moseley wrote:

Has anyone succeeded in getting it running on OSX/intel at all?


I'm not sure actually. I seem to recall someone trying it but I can't
remember who now.

cc-ing to gtk2hs-users in case anyone knows: has anyone on OSX  
tried the

new Gtk+ 2.10.x that doesn't use X11?


...I had a brief go a few weeks back, managed to get the Cairo Clock
running, but anything that used GTK seemed to blow up instantly.  
(OSX/

ppc was fine).


Did you try any of the C examples, like gtk-demo? I'm afraid I don't
have access to OSX.

We're actually looking for someone to help with maintaining Gtk2Hs on
OSX (and someone for windows too). So if you're interested or know
anyone who is interested then do get in touch.

Duncan


On 13 Nov 2006, at 19:03, Duncan Coutts wrote:



One point in wxHaskell's favour is that it supports Mac OS X
directly. At present, to the best of my knowledge, you can only run
GtkHs applications on OS X using the X Windows server. Whilst this
works, it's a _long_ way from native look and feel.


This is quite true. Fortunately the Gtk+ folk are well underway with
a project to make it all more native looking. The latest released
version of Gtk+ 2.10.x has 'experimental' support for running on OSX
without using X11. The next step (apart from general bug fixing) is
to use the right native theme.

So yes, at the moment it doesn't look native on OSX but hopefully
in the future it will. You can read more about that here:

http://developer.imendio.com/projects/gtk-macosx





___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Haskellers in London (UK)?

2006-10-15 Thread Ben Moseley

Hi,

Just thought I'd send out a quick mail to see if there are any other  
Haskellers based in London who might be interested in getting  
together occasionally.


Anyway, if you're interested please reply to this.

Cheers,

--Ben
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe