Re: [Haskell-cafe] Are there any gay haskelleres?

2010-03-28 Thread Fraser Wilson
I'm sure there's some theory about fags being unable to use tools and stuff.
 It certainly cannot be anything to do with cultural pressure.  Perhaps it
is easy to mistake a male-dominated field for one that males are
intrinsically good at, but really, have a look at the Y chromosome, it does
nobody any favours.  Gender is hormonal.

Me too, by the way.

cheers,
Fraser.

2010/3/28 Keith Sheppard keiths...@gmail.com

 Hello,

 I am one.

 Best
 Keith

 2010/3/28 Günther Schmidt gue.schm...@web.de:
  Hi guys,
 
  are there any gay haskellers?
 
  ... Since the first one was so much fun ;)
 
 
  Günther
 
 
  ___
  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




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


Re: [Haskell-cafe] Re: Are there any gay haskelleres?

2010-03-28 Thread Fraser Wilson
I suppose it's easy to miss the underlying sexism when you aren't affected
by it.

2010/3/28 Günther Schmidt gue.schm...@web.de

 Hi guys,

 judging by the responses so far it seems that the gay haskellers have more
 balls than the female haskellers to come out of the closet.

 Uhm.


 Günther



 Am 28.03.10 19:15, schrieb Günther Schmidt:

  Hi guys,

 are there any gay haskellers?

 ... Since the first one was so much fun ;)


 Günther




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




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


Re: [Haskell-cafe] Language simplicity

2010-01-13 Thread Fraser Wilson
On Tue, Jan 12, 2010 at 11:26 PM, Daniel Fischer
daniel.is.fisc...@web.dewrote:

 Okay, 'as' is easy. But can you find a situation where 'qualified' or
 'hiding' would be natural choices for an identifier? I'd love to see those
 in some code :)


module LordsOfMidnight.Character(Character) where

data Character = C { name :: String,
 location :: (Int,Int),
 facing   :: Direction,
 hour :: Int,
 energy   :: Int,
 fear :: Int,
 riders   :: Int,
 soldiers :: Int,
 hiding   :: Bool
   }
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: grapefruit Grapefruit infrastructure

2009-02-26 Thread Fraser Wilson
I'm Switzerland on open source licenses -- I use GPL3 on everything I write,
because I like the default position, but I'm always happy to relicense on
request (except maybe to companies like Fluffy Bunny Killer, Inc).  My
sister tells me I'm a control freak, and maybe I am :-)

So BSD is just great for me.

cheers,
Fraser.

On Thu, Feb 26, 2009 at 11:46 AM, Wolfgang Jeltsch 
g9ks1...@acme.softbase.org wrote:

 Hello,

 I just want to mention that the Grapefruit FRP library now has a mailing
 list
 and a Trac instance which contains a bug tracker. See:

http://www.haskell.org/haskellwiki/Grapefruit#Community

 Please also note that the Grapefruit repositories have moved to
 code.haskell.org.

 Best wishes,
 Wolfgang

 ___
 Grapefruit mailing list
 grapefr...@projects.haskell.org
 http://projects.haskell.org/cgi-bin/mailman/listinfo/grapefruit




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


Re: [Haskell-cafe] Functional GUIs again

2009-02-17 Thread Fraser Wilson
The current darcs version now mentions the 0.9.13 dependency.  I don't see a
nice way of supporting both 0.9.13 and 0.10.0, so I'll take the plunge and
do a destructive upgrade.  As you say, the new model/view is much nicer (and
of course I shall be stealing liberally from it).

cheers,
Fraser.

On Tue, Feb 17, 2009 at 11:16 AM, Peter Verswyvelen bugf...@gmail.comwrote:

 Okay, you used 0.9.13, that explains the errors yes, the model/view thing
 is different in 0.10.0 (better IMHO)
 Yes it would be nice if it worked with GTK2HS 0.10.0, but it might be
 tricky to support both version, I don't know.

 On Tue, Feb 17, 2009 at 12:51 AM, Fraser Wilson blancoli...@gmail.comwrote:

 Hi Peter,

 Thanks!

 I haven't tried to compile with 0.10.0 but I can guess that the errors
 arise from the use of ListStore. I'm not sure what the best approach is
 here. Is 0.9.13 over now?  If so, then I'll upgrade and fix it.

 For now it would certainly make sense to put the dependency into the cabal
 file, which I'm ashamed to say never occorred to me.

 cheers,
 Fraser

 On 17 feb 2009, at 00:29, Peter Verswyvelen bugf...@gmail.com wrote:



 That's some great hacking you did :-)

 What version of GTK2HS did you use? I get various compiler errors when
 using the latest GTK2HS 0.10.0.

 Cheers,
 Peter



 2009/2/16 Fraser Wilson  blancoli...@gmail.comblancoli...@gmail.com

 Now that I re-read my email, it looks like I'm saying Username
 requested in the sense of OK, Cafe people, treat this as a user name
 request and step to it.  What I meant was that I have requested a username
 (via the email), and once I have an account I'll put it on hackage.

 Sorry for the confusion.

 Also, a patch that derives the Monoid instance for Style has been
 pushed.  Let me explain why I love this mailing list.  I hadn't really
 looked at Monoids, but then their utility fell out of the recent discussion
 about whether they should be called Monoids or ... whatever the other name
 was.  And now I see them all over the place, and I'm a better person for it.

 Surely this is too much to be considered actual programming!

 cheers,
 Fraser.


 On Mon, Feb 16, 2009 at 10:40 PM, Duncan Coutts 
 duncan.cou...@worc.ox.ac.uk
 duncan.cou...@worc.ox.ac.uk wrote:

 On Mon, 2009-02-16 at 20:30 +0100, Fraser Wilson wrote:
  You must have missed the bit about congenitally lazy :-)
 
  Username requested ...

 See http://hackage.haskell.org/packages/accounts.html
 http://hackage.haskell.org/packages/accounts.html

 All you need to do is email Ross and ask.

 Duncan




 --
 http://thewhitelion.org/mysisterhttp://thewhitelion.org/mysister

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






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


Re: [Haskell-cafe] Re: Low-level high-level languages?

2009-02-16 Thread Fraser Wilson
What was that stripped-down low-level version of C I saw coming out of ...
was it Microsoft Research?  C-- or something.  Unfortunately, the name
appears to be immune to Googling.

2009/2/16 Alberto G. Corona agocor...@gmail.com

 http://www.ats-lang.org/

 2009/2/16 Jon Fairbairn jon.fairba...@cl.cam.ac.uk

 Maurí­cio briqueabra...@yahoo.com writes:

  Hi,
 
  I've checked this 'BitC' language (www.bitc-lang.org). It
  uses some ideas we see in Haskell, although with different
  realization, and target mainly reliable low level code,
  like micro-kernels (although I think it could be used
  anywhere C is also used, including writing libraries Haskell
  could call with FFI).
 
  Do you guys know of other languages like that that I could
  check?

 Hume http://www-fp.cs.st-andrews.ac.uk/hume/index.shtml
 might be worth a look. I've never tried it, and since one of
 the top chaps associated with it said to me that he loathes
 Haskell, I'm not sure I should mention it here :-)

 --
 Jón Fairbairn jon.fairba...@cl.cam.ac.uk
 http://www.chaos.org.uk/~jf/Stuff-I-dont-want.htmlhttp://www.chaos.org.uk/%7Ejf/Stuff-I-dont-want.html
  (updated 2009-01-31)

 ___
 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




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


Re: [Haskell-cafe] ANN: The Typeclassopedia, and request for feedback

2009-02-16 Thread Fraser Wilson
Super!  Also, best definition of bottom I've yet seen -- ignoring _|_,
which is a party pooper.  Like good code, it's short, to the point, and
obviously correct.

Thanks for this.  It's great to have it all in one place, and so
entertainingly presented.

cheers,
Fraser.

On Mon, Feb 16, 2009 at 10:29 AM, Brent Yorgey byor...@seas.upenn.eduwrote:

 Hi all,

 If you've noticed the lack of a HWN this week, that's because I've
 been doggedly finishing my article entitled 'The Typeclassopedia',
 which I have just submitted for publication in the Monad.Reader.
 Here's the abstract:

The standard Haskell libraries feature a number of type classes
with algebraic or categorical underpinnings. Becoming a fluent
Haskell hacker requires intimate familiarity with them all, yet
acquiring this familiarity often involves combing through a
mountain of tutorials, blog posts, mailing list archives, and IRC
logs.

The goal of this article is to serve as a starting point for the
student of Haskell wishing to gain a firm grasp of its standard
type classes. The essentials of each type class are introduced,
with examples, commentary, and extensive references for further
reading.

 My hope is that this will be a valuable resource to the Haskell
 community, especially those who are learning.  Any feedback would be
 greatly appreciated, especially if it helps improve the article before
 publication.  A draft can be found here:


 http://www.cis.upenn.edu/~byorgey/papers/typeclassopedia-draft-090216.pdfhttp://www.cis.upenn.edu/%7Ebyorgey/papers/typeclassopedia-draft-090216.pdf

 Also see my blog post for a bit more info:


 http://byorgey.wordpress.com/2009/02/16/the-typeclassopedia-request-for-feedback/

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




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


Re: [Haskell-cafe] Re: [Haskell] ANNOUNCE: first Grapefruit release

2009-02-16 Thread Fraser Wilson
Yeah, I lack some darcs fu unfortunately. I understood it was just a  
matter of copying a repository.  I'll have a look, and by have a look  
I mean bother #haskell :-)


Cheers,
Fraser

Sent from my iPhone

On 16 feb 2009, at 18:51, Wolfgang Jeltsch  
g9ks1...@acme.softbase.org wrote:



Am Montag, 16. Februar 2009 18:05 schrieb Fraser Wilson:

I'd love to hack on Grapefruit.


That’s great!

I'll do some study (and take a break from my own world-changing  
functional

GUI :-)


I tried to check out your repository at

   http://thewhitelion.org/darcs/barrie/

but darcs get failed with some complaint about cached patches or  
so. :-(  I

use darcs 2.2.1.

Best wishes,
Wolfgang
___
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] Functional GUIs again

2009-02-16 Thread Fraser Wilson
Since I'm congenitally lazy, and writing a GUI by hand in the IO monad is
... not what I expect from a beautiful program, and because what I often
need is a GUI that manipulates a state, and because I don't understand
arrows, and having been intrigued by a recent cafe thread, I threw together
a prototype GUI library with the following features:

  - the GUI is defined on three levels: gadgets, widgets and styles
  - gadgets are functions on a state
  - widgets are data structures which define the layout
  - styles are ways to modify the appearance of widgets

The following quick example shows a text box and a button.  Clicking on the
button reverses the text in the text box.

 module Main where

 import Barrie

 demoWidget :: Widget
 demoWidget = vbox [ui demo entry textBox,
ui demo command (labelButton click me)]

 type DemoState = String

 type DemoGadget = Gadget DemoState

 demoGUI :: DemoGadget
 demoGUI = localG demo gui [editorG demo entry id const,
  commandG demo command reverse]

 main = gtkMain demoGUI demoWidget Hello, world

Two gadgets are used:

editorG :: String - (a - b) - (b - a - a) - Gadget a
commandG :: String - (a - a) - Gadget a

The editor gadget can show a value from a state, and update a state with a
value.  The command gadget can transform a state to a new state.  gtkMain
connects the gadgets to a widget, which specifies layout using the vbox,
attaching the editor gadget to a text box, and the command gadget to a
button.

Well, that's all pretty trivial.  The key thing for me was that I can easily
slap a GUI onto the the front of a class of applications, which happen to be
the sort of applications I've been writing lately.  Also, arbitrary parts of
the GUI can respond to things that happen miles away, without really having
to worry about it too much.  In barrie-0.1 and 0.2, which used stream-based
approaches, the problem of getting state from one end of the application to
the other was non-trivial.

I'll sketch another quick example:

 data BridgeGame = ...

And a bunch of things you can do with the state:

 makeBid :: Bid - BridgeGame - BridgeGame
 playCard :: Card - BridgeGame - BridgeGame

For bidding, each bid is represented by a gadget:

 bidG :: Bid - Gadget BridgeGame
 bidG bid = enabled (bidOK bid) $ CommandG (show bid) (makeBid bid)

'enabled' switches the gadget on if its first argument returns true when
applied to the current state.  However, the decision about what to do with a
disabled gadget is made by its corresponding widget.

We get one button for each bid:

 biddingG :: Gadget BridgeGame
 biddingG = localG bidding (map bidG allBids)

And they can be displayed in any old order using a widget:

 biddingW :: Widget
 biddingW = vbox (map suitBids [Club, Diamond, Heart, Spade] ++ [ntBids])
where suitBids suit = hbox $ map (bidButton . flip Bid suit) [1 .. 7]
  ntBids = hbox $ map (bidButton . NT) [1 .. 7]
  bidButton bid = ui (show bid) $ labelButton (show bid)

(You're right, double, redouble and pass are not represented.  They make the
lines too long).

Screenshot here: http://thewhitelion.org/images/4D.png

I've just bid four diamonds, so everything lower than that is automatically
disabled.

Currently, Barrie implements buttons, text boxes, labels,
vertical/horizontal layout, single-column lists and drop lists.  It current
uses Gtk2hs for rendering, but it's GUI-agnostic (in fact, the first
renderer was putStrLn/getLine).

You can have a look by using darcs:
   darcs get http://thewhitelion.org/darcs/barrie

Or get the tarball at
http://thewhitelion.org/haskell/barrie-0.3.0-src.tar.gz

One note: this is not intended to be a theoretically sound approach, merely
a way of getting something done quickly.  I would expect it to be most
useful in putting a GUI front-end onto an existing application, in
particular, an application that is driven by user actions which update a
state; e.g. a calculator, a bridge game, a 4th edition DD character creator
(but that leads to a critical mass of nerdiness, so it's off the table for
now)

cheers,
Fraser.

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


Re: [Haskell-cafe] Functional GUIs again

2009-02-16 Thread Fraser Wilson
You must have missed the bit about congenitally lazy :-)

Username requested ...

cheers,
Fraser.


On Mon, Feb 16, 2009 at 8:10 PM, Lennart Augustsson
lenn...@augustsson.netwrote:

 Put it on hackage!

 2009/2/16 Fraser Wilson blancoli...@gmail.com:
  Since I'm congenitally lazy, and writing a GUI by hand in the IO monad is
  ... not what I expect from a beautiful program, and because what I often
  need is a GUI that manipulates a state, and because I don't understand
  arrows, and having been intrigued by a recent cafe thread, I threw
 together
  a prototype GUI library with the following features:
 
- the GUI is defined on three levels: gadgets, widgets and styles
- gadgets are functions on a state
- widgets are data structures which define the layout
- styles are ways to modify the appearance of widgets
 
  The following quick example shows a text box and a button.  Clicking on
 the
  button reverses the text in the text box.
 
  module Main where
 
  import Barrie
 
  demoWidget :: Widget
  demoWidget = vbox [ui demo entry textBox,
 ui demo command (labelButton click me)]
 
  type DemoState = String
 
  type DemoGadget = Gadget DemoState
 
  demoGUI :: DemoGadget
  demoGUI = localG demo gui [editorG demo entry id const,
   commandG demo command reverse]
 
  main = gtkMain demoGUI demoWidget Hello, world
 
  Two gadgets are used:
 
  editorG :: String - (a - b) - (b - a - a) - Gadget a
  commandG :: String - (a - a) - Gadget a
 
  The editor gadget can show a value from a state, and update a state with
 a
  value.  The command gadget can transform a state to a new state.  gtkMain
  connects the gadgets to a widget, which specifies layout using the vbox,
  attaching the editor gadget to a text box, and the command gadget to a
  button.
 
  Well, that's all pretty trivial.  The key thing for me was that I can
 easily
  slap a GUI onto the the front of a class of applications, which happen to
 be
  the sort of applications I've been writing lately.  Also, arbitrary parts
 of
  the GUI can respond to things that happen miles away, without really
 having
  to worry about it too much.  In barrie-0.1 and 0.2, which used
 stream-based
  approaches, the problem of getting state from one end of the application
 to
  the other was non-trivial.
 
  I'll sketch another quick example:
 
  data BridgeGame = ...
 
  And a bunch of things you can do with the state:
 
  makeBid :: Bid - BridgeGame - BridgeGame
  playCard :: Card - BridgeGame - BridgeGame
 
  For bidding, each bid is represented by a gadget:
 
  bidG :: Bid - Gadget BridgeGame
  bidG bid = enabled (bidOK bid) $ CommandG (show bid) (makeBid bid)
 
  'enabled' switches the gadget on if its first argument returns true when
  applied to the current state.  However, the decision about what to do
 with a
  disabled gadget is made by its corresponding widget.
 
  We get one button for each bid:
 
  biddingG :: Gadget BridgeGame
  biddingG = localG bidding (map bidG allBids)
 
  And they can be displayed in any old order using a widget:
 
  biddingW :: Widget
  biddingW = vbox (map suitBids [Club, Diamond, Heart, Spade] ++ [ntBids])
 where suitBids suit = hbox $ map (bidButton . flip Bid suit) [1 .. 7]
   ntBids = hbox $ map (bidButton . NT) [1 .. 7]
   bidButton bid = ui (show bid) $ labelButton (show bid)
 
  (You're right, double, redouble and pass are not represented.  They make
 the
  lines too long).
 
  Screenshot here: http://thewhitelion.org/images/4D.png
 
  I've just bid four diamonds, so everything lower than that is
 automatically
  disabled.
 
  Currently, Barrie implements buttons, text boxes, labels,
  vertical/horizontal layout, single-column lists and drop lists.  It
 current
  uses Gtk2hs for rendering, but it's GUI-agnostic (in fact, the first
  renderer was putStrLn/getLine).
 
  You can have a look by using darcs:
 darcs get http://thewhitelion.org/darcs/barrie
 
  Or get the tarball at
  http://thewhitelion.org/haskell/barrie-0.3.0-src.tar.gz
 
  One note: this is not intended to be a theoretically sound approach,
 merely
  a way of getting something done quickly.  I would expect it to be most
  useful in putting a GUI front-end onto an existing application, in
  particular, an application that is driven by user actions which update a
  state; e.g. a calculator, a bridge game, a 4th edition DD character
 creator
  (but that leads to a critical mass of nerdiness, so it's off the table
 for
  now)
 
  cheers,
  Fraser.
 
  --
  http://thewhitelion.org/mysister
 
  ___
  Haskell-Cafe mailing list
  Haskell-Cafe@haskell.org
  http://www.haskell.org/mailman/listinfo/haskell-cafe
 
 




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


Re: [Haskell-cafe] Functional GUIs again

2009-02-16 Thread Fraser Wilson
Oh, cheers!  Newtype deriving is more general than I expected.  Thanks for
the comment.

I've requested a hackage account, so I expect it to be there shortly :-)

cheers,
Fraser.

On Mon, Feb 16, 2009 at 9:12 PM, Ryan Ingram ryani.s...@gmail.com wrote:

 Tiny code-review comment:

  data Style = Style [(String, StyleValue)]
 deriving (Read, Show)

  instance Monoid Style where
 mempty = Style []
 mappend (Style xs) (Style ys) = Style (xs ++ ys)

 =

  {-# LANGUAGE GeneralizedNewtypeDeriving #-}
 
  newtype Style = Style [(String, StyleValue)]
 deriving (Read, Show, Monoid)

 Also, put it on hackage! :)  It looks pretty cool.

  -- ryan

 2009/2/16 Fraser Wilson blancoli...@gmail.com:
  Since I'm congenitally lazy, and writing a GUI by hand in the IO monad is
  ... not what I expect from a beautiful program, and because what I often
  need is a GUI that manipulates a state, and because I don't understand
  arrows, and having been intrigued by a recent cafe thread, I threw
 together
  a prototype GUI library with the following features:
 
- the GUI is defined on three levels: gadgets, widgets and styles
- gadgets are functions on a state
- widgets are data structures which define the layout
- styles are ways to modify the appearance of widgets
 
  The following quick example shows a text box and a button.  Clicking on
 the
  button reverses the text in the text box.
 
  module Main where
 
  import Barrie
 
  demoWidget :: Widget
  demoWidget = vbox [ui demo entry textBox,
 ui demo command (labelButton click me)]
 
  type DemoState = String
 
  type DemoGadget = Gadget DemoState
 
  demoGUI :: DemoGadget
  demoGUI = localG demo gui [editorG demo entry id const,
   commandG demo command reverse]
 
  main = gtkMain demoGUI demoWidget Hello, world
 
  Two gadgets are used:
 
  editorG :: String - (a - b) - (b - a - a) - Gadget a
  commandG :: String - (a - a) - Gadget a
 
  The editor gadget can show a value from a state, and update a state with
 a
  value.  The command gadget can transform a state to a new state.  gtkMain
  connects the gadgets to a widget, which specifies layout using the vbox,
  attaching the editor gadget to a text box, and the command gadget to a
  button.
 
  Well, that's all pretty trivial.  The key thing for me was that I can
 easily
  slap a GUI onto the the front of a class of applications, which happen to
 be
  the sort of applications I've been writing lately.  Also, arbitrary parts
 of
  the GUI can respond to things that happen miles away, without really
 having
  to worry about it too much.  In barrie-0.1 and 0.2, which used
 stream-based
  approaches, the problem of getting state from one end of the application
 to
  the other was non-trivial.
 
  I'll sketch another quick example:
 
  data BridgeGame = ...
 
  And a bunch of things you can do with the state:
 
  makeBid :: Bid - BridgeGame - BridgeGame
  playCard :: Card - BridgeGame - BridgeGame
 
  For bidding, each bid is represented by a gadget:
 
  bidG :: Bid - Gadget BridgeGame
  bidG bid = enabled (bidOK bid) $ CommandG (show bid) (makeBid bid)
 
  'enabled' switches the gadget on if its first argument returns true when
  applied to the current state.  However, the decision about what to do
 with a
  disabled gadget is made by its corresponding widget.
 
  We get one button for each bid:
 
  biddingG :: Gadget BridgeGame
  biddingG = localG bidding (map bidG allBids)
 
  And they can be displayed in any old order using a widget:
 
  biddingW :: Widget
  biddingW = vbox (map suitBids [Club, Diamond, Heart, Spade] ++ [ntBids])
 where suitBids suit = hbox $ map (bidButton . flip Bid suit) [1 .. 7]
   ntBids = hbox $ map (bidButton . NT) [1 .. 7]
   bidButton bid = ui (show bid) $ labelButton (show bid)
 
  (You're right, double, redouble and pass are not represented.  They make
 the
  lines too long).
 
  Screenshot here: http://thewhitelion.org/images/4D.png
 
  I've just bid four diamonds, so everything lower than that is
 automatically
  disabled.
 
  Currently, Barrie implements buttons, text boxes, labels,
  vertical/horizontal layout, single-column lists and drop lists.  It
 current
  uses Gtk2hs for rendering, but it's GUI-agnostic (in fact, the first
  renderer was putStrLn/getLine).
 
  You can have a look by using darcs:
 darcs get http://thewhitelion.org/darcs/barrie
 
  Or get the tarball at
  http://thewhitelion.org/haskell/barrie-0.3.0-src.tar.gz
 
  One note: this is not intended to be a theoretically sound approach,
 merely
  a way of getting something done quickly.  I would expect it to be most
  useful in putting a GUI front-end onto an existing application, in
  particular, an application that is driven by user actions which update a
  state; e.g. a calculator, a bridge game, a 4th edition DD character
 creator
  (but that leads to a critical mass of nerdiness, so it's off the table

Re: [Haskell-cafe] Functional GUIs again

2009-02-16 Thread Fraser Wilson
Now that I re-read my email, it looks like I'm saying Username requested
in the sense of OK, Cafe people, treat this as a user name request and step
to it.  What I meant was that I have requested a username (via the email),
and once I have an account I'll put it on hackage.

Sorry for the confusion.

Also, a patch that derives the Monoid instance for Style has been pushed.
Let me explain why I love this mailing list.  I hadn't really looked at
Monoids, but then their utility fell out of the recent discussion about
whether they should be called Monoids or ... whatever the other name was.
And now I see them all over the place, and I'm a better person for it.

Surely this is too much to be considered actual programming!

cheers,
Fraser.

On Mon, Feb 16, 2009 at 10:40 PM, Duncan Coutts duncan.cou...@worc.ox.ac.uk
 wrote:

 On Mon, 2009-02-16 at 20:30 +0100, Fraser Wilson wrote:
  You must have missed the bit about congenitally lazy :-)
 
  Username requested ...

 See http://hackage.haskell.org/packages/accounts.html

 All you need to do is email Ross and ask.

 Duncan




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


Re: [Haskell-cafe] Functional GUIs again

2009-02-16 Thread Fraser Wilson

Hi Peter,

Thanks!

I haven't tried to compile with 0.10.0 but I can guess that the errors  
arise from the use of ListStore. I'm not sure what the best approach  
is here. Is 0.9.13 over now?  If so, then I'll upgrade and fix it.


For now it would certainly make sense to put the dependency into the  
cabal file, which I'm ashamed to say never occorred to me.


cheers,
Fraser

On 17 feb 2009, at 00:29, Peter Verswyvelen bugf...@gmail.com wrote:



That's some great hacking you did :-)

What version of GTK2HS did you use? I get various compiler errors  
when using the latest GTK2HS 0.10.0.


Cheers,
Peter



2009/2/16 Fraser Wilson blancoli...@gmail.com
Now that I re-read my email, it looks like I'm saying Username  
requested in the sense of OK, Cafe people, treat this as a user  
name request and step to it.  What I meant was that I have  
requested a username (via the email), and once I have an account  
I'll put it on hackage.


Sorry for the confusion.

Also, a patch that derives the Monoid instance for Style has been  
pushed.  Let me explain why I love this mailing list.  I hadn't  
really looked at Monoids, but then their utility fell out of the  
recent discussion about whether they should be called Monoids or ...  
whatever the other name was.  And now I see them all over the place,  
and I'm a better person for it.


Surely this is too much to be considered actual programming!

cheers,
Fraser.


On Mon, Feb 16, 2009 at 10:40 PM, Duncan Coutts duncan.cou...@worc.ox.ac.uk 
 wrote:

On Mon, 2009-02-16 at 20:30 +0100, Fraser Wilson wrote:
 You must have missed the bit about congenitally lazy :-)

 Username requested ...

See http://hackage.haskell.org/packages/accounts.html

All you need to do is email Ross and ask.

Duncan




--
http://thewhitelion.org/mysister

___
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] The wheather is ⊥

2009-02-15 Thread Fraser Wilson
Is that really cold or really hot?

On Sun, Feb 15, 2009 at 11:27 PM, Henk-Jan van Tuyl hjgt...@chello.nlwrote:


 The temperature is now NaN°:
  http://traviswalters.net/?p=58

 --
 Met vriendelijke groet,
 Henk-Jan van Tuyl


 --
 http://functor.bamikanarie.com
 http://Van.Tuyl.eu/
 --


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




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


Re: [Haskell-cafe] Why binding to existing widget toolkits doesn't make any sense

2009-02-03 Thread Fraser Wilson
You know, I read the Fudgets thesis, and threw together an experiment which
used Glade for layout and Haskell for semantics [1].  As somebody else
noted, this isn't really a clean division, because of things like editable
flags in the layout.  The darcs repository has a couple of demo
applications, there's also a Bridge game that doesn't quite work (not
included), and I understand that Arrows would solve all my problems, but I
still don't grok them, alas.

What I found was that wiring the events through the application in a nice,
functional way was quite tricky, but it was unclear whether this was just an
API problem, or something more fundamental.  The entire state seems to turn
up in every connection between widgets (which really suggests that it's
imperative with a veneer of declarative style, which of course it is).

For example, you need a changed flag in the state of the text editor.  This
is updated by a signal from the text widget, and read by the main window
(because it affects the title bar text), the File/New and File/Open menu
items (need to put up a Save Changes? message box) and the main window
destroy handler (same thing, but it also needs some way of cancelling the
action).  Unfortunately, the main window is at one end of the event chain,
while the menu is all the way over on the other side.  This leads to tricky
composition, and widgets which pass the entire state to each other because
there's one little bit of information they might need.

A related issue is that the application is like a river, in which events
flow from one end to the other.  Send events back the other way is ugly.
Some sort of blackboard design might work better.

This conversation made me start thinking about replacing Glade with a
Haskell layout language, but I still don't know how to solve the above
problems.  I should read the FRP papers again.

cheers,
Fraser.

[1] http://thewhitelion.org/darcs/barrie

On Mon, Feb 2, 2009 at 8:58 PM, John A. De Goes j...@n-brain.net wrote:


 The actual presentation and layout of widgets would be better handled by a
 DSL such as CSS (which is, in fact, declarative in nature), while event
 logic would be best handled purely in Haskell.

 Regards,

 John A. De Goes
 N-BRAIN, Inc.
 The Evolution of Collaboration

 http://www.n-brain.net|877-376-2724 x 101


 On Feb 2, 2009, at 12:39 PM, Creighton Hogg wrote:

  2009/1/29 Conal Elliott co...@conal.net:

 Hi Achim,

 I came to the same conclusion: I want to sweep aside these OO, imperative
 toolkits, and replace them with something genuinely functional, which
 for
 me means having a precise  simple compositional (denotational)
 semantics.
 Something meaningful, formally tractable, and powefully compositional
 from
 the ground up.  As long as we build on complex legacy libraries (Gtk,
 wxWidgets, Qt, OpenGL/GLUT, ...), we'll be struggling against (or worse
 yet,
 drawn into) their ad hoc mental models and system designs.

 As Meister Eckhart said, Only the hand that erases can write the true
 thing.


 I think working on a purely functional widget toolkit would actually
 be a really cool project.  Do you have any ideas, though, on what
 should be the underlying primitives?

 The initial gut feeling I have is that one should just ignore any
 notion of actually displaying widgets  instead focus on a clean
 algebra of how to 'add'  widgets that relates the concepts of
 inheritance  relative position.  What I mean by inheritance, here, is
 how to direct a flow of 'events'.  I don't necessarily mean events in
 the Reactive sense, because I think it'd be important to make the
 model completely independent of how time  actual UI actions are
 handled.

 Any thoughts to throw in, here?

 Cheers,
 C
 ___
 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




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


Re: [Haskell-cafe] How to define Show [MyType] ?

2008-12-07 Thread Fraser Wilson

 1) They come from the show instance for String.  Try putStrLn (t2
 fleet) instead.


pedant
The show instance for Char.
/pedant

(I know you know this, I just have this weird fascination with the showList
wart, although for the life of me I can't think of a better way of doing it)

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


[Haskell-cafe] GHC on Fedora 10 - getMBlock: mmap: Permission denied

2008-12-02 Thread Fraser Wilson
Hi all,

Has anybody seen this?  I thought it might be an SELinux thing, but then I
wouldn't expect GHC or darcs to run.  Audley is a fairly simple program in
operating system feature terms, but I get the same error with anything I
build myself.

[EMAIL PROTECTED] audley]$ ./dist/build/audley/audley
audley: internal error: getMBlock: mmap: Permission denied
(GHC version 6.8.3 for i386_unknown_linux)
Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
Aborted
[EMAIL PROTECTED] audley]$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.8.3
[EMAIL PROTECTED] audley]$ cat /proc/version
Linux version 2.6.27-0.352.rc7.git1.fc10.i686 (
[EMAIL PROTECTED]) (gcc version 4.3.2 20080917 (Red Hat
4.3.2-4) (GCC) ) #1 SMP Tue Sep 23 21:26:04 EDT 2008
[EMAIL PROTECTED] audley]$

cheers,
Fraser.

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


Re: [Haskell-cafe] GHC on Fedora 10 - getMBlock: mmap: Permission denied

2008-12-02 Thread Fraser Wilson
Why didn't that occur to me?  I should get more sleep. Thanks for the tip.
Now I know that it definitely is SELinux, a system I understand not at all,
I presume the problem is in these context things ... ghc has system_u and
bin_t, while audley has unconfined_u and file_t.  Time to go poking about.
The unconfined_u looks suspicious.

cheers,
Fraser.

On Tue, Dec 2, 2008 at 3:48 PM, David Leimbach [EMAIL PROTECTED] wrote:

 Did you try turning off SELinux to check?

 2008/12/2 Fraser Wilson [EMAIL PROTECTED]

 Hi all,

 Has anybody seen this?  I thought it might be an SELinux thing, but then I
 wouldn't expect GHC or darcs to run.  Audley is a fairly simple program in
 operating system feature terms, but I get the same error with anything I
 build myself.

 [EMAIL PROTECTED] audley]$ ./dist/build/audley/audley
 audley: internal error: getMBlock: mmap: Permission denied
 (GHC version 6.8.3 for i386_unknown_linux)
 Please report this as a GHC bug:
 http://www.haskell.org/ghc/reportabug
 Aborted
 [EMAIL PROTECTED] audley]$ ghc --version
 The Glorious Glasgow Haskell Compilation System, version 6.8.3
 [EMAIL PROTECTED] audley]$ cat /proc/version
 Linux version 2.6.27-0.352.rc7.git1.fc10.i686 (
 [EMAIL PROTECTED]) (gcc version 4.3.2 20080917 (Red
 Hat 4.3.2-4) (GCC) ) #1 SMP Tue Sep 23 21:26:04 EDT 2008
 [EMAIL PROTECTED] audley]$

 cheers,
 Fraser.

 --
 http://thewhitelion.org/mysister

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





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


Re: Re[2]: [Haskell-cafe] GHC on Fedora 10 - getMBlock: mmap: Permission denied

2008-12-02 Thread Fraser Wilson
Thanks, Bulat, ticket #738 appears to be it.  It was fixed in September, but
I guess it hasn't made it to yum yet, although there's a work-around with
permissions and so forth.

cheers,
Fraser.

On Tue, Dec 2, 2008 at 4:42 PM, Bulat Ziganshin
[EMAIL PROTECTED]wrote:

 Hello Fraser,

 Tuesday, December 2, 2008, 6:34:19 PM, you wrote:

 search in GHC tracker: afair there was some SELinux-releated report

  Why didn't that occur to me?  I should get more sleep. Thanks for
  the tip.  Now I know that it definitely is SELinux, a system I
  understand not at all, I presume the problem is in these context
  things ... ghc has system_u and bin_t, while audley has unconfined_u
  and file_t.  Time to go poking about.  The unconfined_u looks suspicious.
 
  cheers,
  Fraser.

  On Tue, Dec 2, 2008 at 3:48 PM, David Leimbach [EMAIL PROTECTED]
 wrote:
   Did you try turning off SELinux to check?

  2008/12/2 Fraser Wilson [EMAIL PROTECTED]
 
   Hi all,

  Has anybody seen this?  I thought it might be an SELinux thing, but
  then I wouldn't expect GHC or darcs to run.  Audley is a fairly
  simple program in operating system feature terms, but I get the same
  error with anything I build myself.
 
  [EMAIL PROTECTED] audley]$ ./dist/build/audley/audley
  audley: internal error: getMBlock: mmap: Permission denied
  (GHC version 6.8.3 for i386_unknown_linux)
  Please report this as a GHC bug:
  http://www.haskell.org/ghc/reportabug
   Aborted
  [EMAIL PROTECTED] audley]$ ghc --version
  The Glorious Glasgow Haskell Compilation System, version 6.8.3
  [EMAIL PROTECTED] audley]$ cat /proc/version
  Linux version 2.6.27-0.352.rc7.git1.fc10.i686
  ([EMAIL PROTECTED]) (gcc version 4.3.2 20080917
  (Red Hat 4.3.2-4) (GCC) ) #1 SMP Tue Sep 23 21:26:04 EDT 2008
   [EMAIL PROTECTED] audley]$

  cheers,
  Fraser.

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


 






 --
 Best regards,
  Bulatmailto:[EMAIL PROTECTED]




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


Re: [Haskell-cafe] Calling Haskell from other languages?

2008-11-11 Thread Fraser Wilson


I had a proof of concept lying around a couple of years ago in which a  
big complicated Ada program called a big complicated Haskell program  
and vice versa. The tricky bit from memory was making it link, and  
satisfying their rumtime initialisation requirements. No explicit C  
was required I think.


Fraser
On 11 nov 2008, at 18:09, Colin Paul Adams [EMAIL PROTECTED]  
wrote:



Jake == Jake Mcarthur [EMAIL PROTECTED] writes:


   Jake Actually, that's not the whole story. I didn't realize until
   Jake I sent it. There does exist good documentation for this, I
   Jake promise.

Good. Let me know where it is when you track it down.

The link you pointed me too doesn't seem to address my question
directly. Also, it only talks about C.

If I want to call Haskell (and I do, perhaps) from another
garbage-collected language (Eiffel, in particular) using C as the
mutually understood language, am I not going to run into big problems?
--
Colin Adams
Preston Lancashire
___
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] if - then - else layout

2008-09-24 Thread Fraser Wilson

I think you mean in a do. There is a proposal to fix this in Haskell'

cheers,
Fraser

On Sep 25, 2008, at 6:59, Brandon S. Allbery KF8NH [EMAIL PROTECTED] 
 wrote:



On 2008 Sep 25, at 0:47, leledumbo wrote:

consider this partial program:
if n5 then
putStrLn big
else
putStrLn small

this works fine in hugs, but in ghc I must change it to:
if n5
then
  putStrLn big
else
  putStrLn small



Actually, this also works:

 if n  5 then
 putStrLn big
   else
 putStrLn small

Except in a do, the else must be indented beyond the start of  
the if.  I think Hugs is violating the Haskell98 layout rules.


--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED]
system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED]
electrical and computer engineering, carnegie mellon university 
KF8NH



___
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] Confused by instances

2008-04-28 Thread Fraser Wilson
Hello, Haskellers,

I feel like I'm missing something obvious, but here's some example code:

 module Instance where

 data Value = Value Integer

 class ValueClass a where
 fromValue :: Value - a

 instance ValueClass Bool where
 fromValue (Value n) = n /= 0

 instance ValueClass String where
 fromValue (Value n) = show n

 instance (Num a) = ValueClass a where
 fromValue (Value n) = fromInteger n


The Bool instance compiles fine.  The String instance fails, and that would
be because String is a synonym for [Char], and we can't create instances for
those.  There's a slight hack in the Prelude which allows you to define your
own list show function, and that's exactly what gets done by Show Char,
right?  I'm sorry about calling it a hack but, well, it is.  :)


What I'm really confused by is the response to instance (Num a) =
ValueClass a -- what I am trying to say is if a is an instance of Num, then
can be an instance of ValueClass too, and here's how.  But ghc says:

Instance.hs:14:0:
Illegal instance declaration for `ValueClass a'
(All instance types must be of the form (T a1 ... an)
 where a1 ... an are distinct type *variables*
 Use -XFlexibleInstances if you want to disable this.)
In the instance declaration for `ValueClass a'

I don't understand why what I'm doing above is different from, for example,
instance Show a = Show [a], or Monad m = MonadState s (StateT s m) ... I
imagine that it's related to the fact that the difference between those two
and what I have is that they have either the same class on each side of the
=, or new type variables on the right.  But I'm having trouble abstracting
from that to the general rule.

Any help would be greatly appreciated.  In context, I'm attempting to wrap
up different types inside a data type, and rather than extracting the value
with getBoolean, getInteger, getString etc, I thought I would let type
classes work for me, and just say fromValue instead.  Is this silly?  You
can tell me, I won't be hurt.

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


Re: [Haskell-cafe] Confused by instances

2008-04-28 Thread Fraser Wilson
On Mon, Apr 28, 2008 at 10:50 PM, Brandon S. Allbery KF8NH 
[EMAIL PROTECTED] wrote:



 The format is instance [context =] classname instance.
 Your classname is ValueClass.
 Your instance is a.  a is not of the form (T a1 ... an).


But neither is
 instance (Show a) = Show [a] ...

*sound of penny dropping *

Ah.  Wood, trees, all that.

Thanks!

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


Re: [Haskell-cafe] Confused by instances

2008-04-28 Thread Fraser Wilson
On Mon, Apr 28, 2008 at 11:33 PM, Luke Palmer [EMAIL PROTECTED] wrote:


 To answer your other question, no, there is no list show hack.


Perhaps hack was a strong word.  I'm not referring to type synonyms, but to
the fact that Prelude's show class happens to have a special show function
for lists, which happens to be handy when writing an instance for Show
Char.  I find the coupling here (between Show and a particular instance of
Show, namely Show Char) to be disturbing -- Show should not (if you ask me)
contain special machinery for specific instances.  Not that I'll lose sleep
over it, and of course the benefit (having pretty strings) far outweighs the
philosophical cost.

The showList function has always struck me as a bit of a wart though.

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


Re: [Haskell-cafe] Confused by instances

2008-04-28 Thread Fraser Wilson
On Mon, Apr 28, 2008 at 11:46 PM, Luke Palmer [EMAIL PROTECTED] wrote:

 2008/4/28 Fraser Wilson [EMAIL PROTECTED]:
  what I am trying to say is if a is an instance of Num, then
  can be an instance of ValueClass too, and here's how.

 Oh, didn't answer this one.  This is almost canned response, questions
 like this get asked weekly on this list.


Thanks for the detailed response.  In the end, I've just selected the types
I'm really interested in, and added instances for those.  It works a treat.


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


Re: [Haskell-cafe] export question (GHC.Handle)

2008-04-17 Thread Fraser Wilson
On Thu, Apr 17, 2008 at 4:46 PM, Bertram Felgenhauer 
[EMAIL PROTECTED] wrote:


 Assuming you're writing a cabal package, you could separate the interface
 from the actual implementation:


[..]


 HTH,


Magic.  Thanks a lot!

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


Re: [Haskell-cafe] export question (GHC.Handle)

2008-04-16 Thread Fraser Wilson
On Thu, Apr 17, 2008 at 2:09 AM, Graham Fawcett [EMAIL PROTECTED]
wrote:

 I notice in the source for GHC.Handle that certain functions (e.g.
 fdToHandle_stat) are in the export list, but are not actually exported
 (at least, it seems you cannot import them). What mechanism causes
 these functions to be hidden, and are they still accessible in some
 way?


Good question.  I often need to export a name to other modules within the
hierarchy, but without making them visible outside it.  I've solved this
problem by giving them funky names and adding a comment, but is there a more
structured way to do this?  A quick google hasn't found one yet.

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


Re: [Haskell-cafe] Dynamic typing makes you more productive?

2008-03-18 Thread Fraser Wilson
I find it interesting that change is equated with maintenance.  I would
say that maintenance is a very small subset of change.  It's true that you
can change a program in a dynamically typed language more easily, in the
same way that changes are easier to make if you don't use source control and
everybody shares the same source folder.

Changes that improve things, however, are more tricky.  And as you say, a
large multiple developer, dynamically typed project sounds like a disaster.

(Of course, I don't have to tell any of you this)

cheers,
Fraser.

On Tue, Mar 18, 2008 at 5:41 PM, Justin Bailey [EMAIL PROTECTED] wrote:

 From a recent interview[1] with the guy leading Ruby development on
 .NET at Microsoft:

  You spend less time writing software than you spend maintaining
 software. Optimizing for writing software versus maintaining software
 is probably the wrong thing to do. Static typing makes it harder to
 maintain software because it's harder to change it.

 Two years ago I would have agreed with that statement. Now - no way.
 Make the compiler work for you. I've done a lot of Ruby development
 and I would never use it for a project of more than 3 or 4 people.
 It's an awesome language but I don't think it would scale to
 programming in the large. Any object can be modified at any time.
 Determining where a particular method comes from can be an exercise in
 Sherlockian deduction. Give an organization of 100 developers that
 much freedom and I can only imagine chaos would result.

 Justin

 [1] http://www.regdeveloper.co.uk/2008/03/17/ironruby_work_schedule/
 ___
 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] Binary IO of a list of ints

2008-01-24 Thread Fraser Wilson
(untested)

 mapM_ runPut data

?

On Jan 24, 2008 12:14 PM, Jamie Love [EMAIL PROTECTED] wrote:

 Hi there

 I have a list of ints, with values between 0 and 255 and I need to print
 them out in little endian form to a file.

 I've been using Data.Binary for single values, e.g.

 runPut $ do
put 'B'
put (0 :: Int32)


 I'm wondering how I can go about writing a list of Ints out. My thought
 was to do something like:

 foldr (\x B.hPut output (runPut $ do put (x :: Word8))) data

 (where output is my file handle), but apart from giving me type errors,
 it seems a rather arduous way to do it.

 Could anyone suggest a better way to do this?

 --
 Jamie Love
 Senior Consultant
 Aviarc Australia
 Mobile: +61 400 548 048



 

 This message has been scanned for viruses and dangerous content
 by MailScanner and is believed to be clean.

 ___
 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] Trouble with function with two clauses

2008-01-09 Thread Fraser Wilson
In head'', what is being compared to Nil?

The guards of a function are a series of Boolean expressions; but in your
example they are of type ConsCell a.  The difference is that in a pattern,
the structure of the argument is matched; in a guard, an arbitrary
expression is evaluated.

I have always found the Haskell report instructive in these cases;
particularly the transformations into the core language -- in this case see
section 4.4.3.2 (http://haskell.org/onlinereport/decls.html#sect4.4.3.2);
this should make it clear why head'' is not valid Haskell.

cheers,
Fraser.

Guards are really a series of Boolean equations, and the first that
evaluates to true
On Jan 9, 2008 7:15 PM, Fernando Rodriguez  [EMAIL PROTECTED] wrote:


 Hi,

 I have the following type and function:

 data ConsCell a = Nil | Cons a (ConsCell a) deriving Show
 head' Nil = Nothing
 head' (Cons a _) = Just a

 Works fine, however, what's wrong with the following function?

 head''
| Nil = Nothing
| Cons a _ = Just a

 Thanks!



 ___
 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] Filesystem access

2007-06-21 Thread Fraser Wilson

I don't use Haskell on Windows, but if you go to

http://www.haskell.org/ghc/docs/latest/html/libraries/index.html

you'll find a package called System.Win32.File, which has these functions:

*getFileAttributes* ::
Stringhttp://www.haskell.org/ghc/docs/latest/html/libraries/base/Data-Char.html#t%3AString-
IOhttp://www.haskell.org/ghc/docs/latest/html/libraries/base/System-IO.html#t%3AIO
FileAttributeOrFlaghttp://www.haskell.org/ghc/docs/latest/html/libraries/Win32/System-Win32-File.html#t%3AFileAttributeOrFlag

*getFileInformationByHandle* ::
HANDLEhttp://www.haskell.org/ghc/docs/latest/html/libraries/Win32/System-Win32-Types.html#t%3AHANDLE-
IOhttp://www.haskell.org/ghc/docs/latest/html/libraries/base/System-IO.html#t%3AIO
BY_HANDLE_FILE_INFORMATIONhttp://www.haskell.org/ghc/docs/latest/html/libraries/Win32/System-Win32-File.html#t%3ABY_HANDLE_FILE_INFORMATION

The first has all sorts of attributes in it, the second has a field for
length.  Maybe these will do what you want.

cheers,
Fraser.

On 6/21/07, Andrew Coppin [EMAIL PROTECTED] wrote:


Andrea Rossato wrote:
 On Thu, Jun 21, 2007 at 09:19:51PM +0100, Andrew Coppin wrote:

  OK, a few questions...

  1. Is there *any* way to determine how large a file is *without*
opening it?
  The only library function I can find to do with file sizes is
hFileSize;
  obviously this only works for files that you have permission to open!


 System.Posix.Files
 fileSize


Does that *work* on Windoze?

Wait, hang on a sec... No, it doesn't. The module doesn't even exist.

(I was half-expecting it might work. GHC does currently run in a Unix
emulator...)

  2. Is there any way to discover Windoze-style attributes for files?
  (Read-only, archive, system, hidden, et al.)


 The module before, if I understand correctlu.


No, AFAIK the archive attribute doesn't even exist on POSIX. It's a
Windoze-specific thang.

___
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] Records (was Re: [Haskell] Improvements to GHC)

2005-11-17 Thread Fraser Wilson
On 11/17/05, Greg Woodhouse [EMAIL PROTECTED] wrote:
Isn't there a potential for confusion with function composition (f . g)?
Perhaps, but I always have spaces on either side when it's function composition. Isn't there already an ambiguity?

-- I bet there's a quicker way to do this ...
module M where data M a = M a deriving (Show)

data T a = T a deriving (Show)
module M.T where f = (+1)
 
import M
import qualified M.T

f = (*2)
v1 = M . T . f $ 5
v2 = M.T.f $ 5

main = do { print v1; print v2; return () }

Fraser.

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


Re: [Haskell-cafe] Families of type classes

2005-11-06 Thread Fraser Wilson
On 11/6/05, Klaus Ostermann [EMAIL PROTECTED] wrote:
instance Node Person where isConnectedTo g n (p1,p2) = (p1 == n) || (p2 == n)

At this point, isConnectedTo knows nothing about the third argument
except that it is an edge, and there's no reason to think that an Edge
is a tuple. All you can say is that there are two functions, n1
and n2, which extract the nodes of the edge. Use those instead,
for example

isConnectedTo g n p = n == n1 p || n == n2 p

 Couldn't match the rigid variable `e' against `(a, b)'`e' is bound by the type signature for `isConnectedTo'
Expected type: eInferred type: (a, b)When checking the pattern: (p1, p2)In the definition of `isConnectedTo':isConnectedTo g n (p1, p2) = (p1 == n) || (p2 == n)
Hopefully this error makes more sense now. It's saying that it expected something of type 'e', but it found a tuple.

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


[Haskell-cafe] Interactive Haskell and hs-plugins

2005-11-01 Thread Fraser Wilson
Hi there,

I would like to use evaluate arbitrary expressions in the context of a
mixed-language (Ada, Haskell and about twelve lines of C glue)
applications. Is it possible to use dynload from hs-plugins to
load a module that references symbols in the loading program?

For example, the application contains a Haskell module that looks a bit like this:

 module TestKeys.NamedObject where
  tt :: Int
  tt = 2

I want the application to be able to offer the following sort of interaction:

haskell tt
2
haskell

But what actually happens is this:

haskell tt
test_haskell3: /tmp/MDnum15633.o: unknown symbol `TestKeysziNamedObject_tt_closure'
test_haskell3: user error (resolveObjs failed with False)

Compiling Haskell code in advance works (i.e. if I create and compile a
module that evalutes tt and link it in, everything runs fine).

This is how I try to evaluate the _expression_:

 evaluate :: String - IO ()
 evaluate  = return ()
 evaluate e = do writeFile temp.hs fileContents
   status - makeWith LeanderStub.hs temp.hs [-c]
   case status of MakeSuccess code path - loadAndEval path
   
 MakeFailure
error - print error
  where fileContents = module Temp where\n\


\ result =  ++ e ++ \n

 loadAndEval :: FilePath - IO ()
 loadAndEval path = do mv - dynload path [] [] result
case mv of
  

LoadFailure msg - print msg
 LoadSuccess _ v - putStrLn v

LeanderStub.hs is a module containing the necessary imports for the _expression_ to evaluate in the right context.

I was hoping that passing -c to makeWith would create an object file
whose missing dependencies would be resolved when it was loaded into an
application which contained them. Is this a dumb
expectation? The alternative -- linking to the entire application
for each _expression_ evaluated -- seems a bit over the top, and I can't
see how state would be maintained.

I originally used unsafeEval_, but this has the same problem.

I can't help but think that this must have been done before. Any
advice? If you know Guile, then the equivalent of gh_repl is what
I'm really after.

cheers,
Fraser.

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