Re: Laws and partial values (was: [Haskell-cafe] mapM_ -> Monoid.Monad.map)

2009-01-23 Thread Thomas Davie
On 24 Jan 2009, at 02:33, Luke Palmer wrote: On Fri, Jan 23, 2009 at 6:10 PM, wrote: On Fri, 23 Jan 2009, Derek Elkins wrote: mempty `mappend` undefined = undefined (left identity monoid law) The above definition doesn't meet this, similarly for the right identity monoid law. That only lea

Re: [Haskell-cafe] How to define an operation in terms of itself (but of different type)?

2009-01-23 Thread Luke Palmer
2009/1/23 Brandon S. Allbery KF8NH > On 2009 Jan 23, at 17:58, Olex P wrote: > > class Vector v where > (^+^) :: v -> v -> v > > class Matrix m where > (^+^) :: m -> m -> m > > > You can't reuse the same operator in different classes. Vector "owns" > (^+^), so Matrix can't use

Re: [Haskell-cafe] How to define an operation in terms of itself (but of different type)?

2009-01-23 Thread Brandon S. Allbery KF8NH
On 2009 Jan 23, at 17:58, Olex P wrote: class Vector v where (^+^) :: v -> v -> v class Matrix m where (^+^) :: m -> m -> m You can't reuse the same operator in different classes. Vector "owns" (^+^), so Matrix can't use it itself. You could say > instance Matrix m => V

Re: [Haskell-cafe] Generalizing a filter-making function

2009-01-23 Thread Ross Mellgren
Parsec is an awesome piece of software. Throw away anything you might know from writing parsers in something else -- writing parsers with parsec is so succinct you can use it most anytime without feeling like you're resorting to it. -Ross On Jan 23, 2009, at 11:26 PM, Dominic Espinosa wrot

Re: [Haskell-cafe] how to implement daemon start and stop directives?

2009-01-23 Thread Brandon S. Allbery KF8NH
On 2009 Jan 22, at 3:11, Belka wrote: Actually, I'm more interested in technical details how to communicate from shell with background process - how to send commands to it. Currently looking into POSIX libraries hope to find answers there... Also, maybe a FIFO-pipe-file would solve my problem.

Re: [Haskell-cafe] how to implement daemon start and stop directives?

2009-01-23 Thread Brandon S. Allbery KF8NH
On 2009 Jan 22, at 1:36, Belka wrote: Could somebody please share some experience on how to implement daemon start and stop directives. In theory I need something like this: 1. "my_daemon start" - starts my app with an infinite loop of serving inside. 2. "my_daemon stop" - puts in some TVar a v

Re: [Haskell-cafe] Generalizing a filter-making function

2009-01-23 Thread Dominic Espinosa
Thanks, that does help. I see I was unnecessarily passing a function parameter (as a newcomer to Haskell, I tend to forget how to properly use composition). The reason to do these maneuvers is that the particular accessor function to use is being parsed from user input. The main problem is along

Re: Laws and partial values (was: [Haskell-cafe] mapM_ -> Monoid.Monad.map)

2009-01-23 Thread roconnor
Thanks for letting me reflect on this. I assume that my final program (my final value) is always a total value. Anything else is an error. Therefore, if we required relaxed monoid laws of the form x `mappend` mzero <= x then we could safely substitute (x `mappend` mzero) by x without changi

Re: [Haskell-cafe] Current research on overlapping/closed type families?

2009-01-23 Thread Dan Weston
Would this then also eventually work? data Zero data Succ a = Succ a type family IsFunction f type instances IsFunction (a -> b) = Succ (IsFunction b) IsFunction c= Zero Simon Peyton-Jones wrote: Provided all the overlapping instances are supplied together, as you suggest, I thi

Re: [Haskell-cafe] Error in HTTP 4.004 + CouchDB?

2009-01-23 Thread Daniel McAllansmith
On Sat, 24 Jan 2009 14:18:24 Tristan Seligmann wrote: > * Alex Ott [2009-01-22 20:32:26 +0100]: > > PUT http://127.0.0.1:5984/test1/Users_ott_tmp_1_tst HTTP/1.1 > > Content-Type: ... > > ... > > Host: 127.0.0.1:5984 > > ... > > Note that this is a valid HTTP request, according to my reading of RFC

Re: [Haskell-cafe] Current research on overlapping/closed type families?

2009-01-23 Thread Ryan Ingram
Of course. I was just wondering if anyone was looking into the implications of said features :) For example, with this instance, if "a" is a type variable, you can't reduce "IsFunction a" to HFalse, because "a" might be "b -> c" for some b, c. Whereas in the current formulation, you can treat th

RE: [Haskell-cafe] Current research on overlapping/closed type families?

2009-01-23 Thread Simon Peyton-Jones
Provided all the overlapping instances are supplied together, as you suggest, I think what you say makes perfect sense and does not threaten soundness. But we have not yet implemented the idea yet. First priority is to get type families working properly, and in conjunction with type classes. T

Re: Laws and partial values (was: [Haskell-cafe] mapM_ -> Monoid.Monad.map)

2009-01-23 Thread Luke Palmer
On Fri, Jan 23, 2009 at 6:10 PM, wrote: > On Fri, 23 Jan 2009, Derek Elkins wrote: > > mempty `mappend` undefined = undefined (left identity monoid law) >> The above definition doesn't meet this, similarly for the right identity >> monoid law. That only leaves one definition, () `mappend` () =

Re: [Haskell-cafe] Error in HTTP 4.004 + CouchDB?

2009-01-23 Thread Tristan Seligmann
* Alex Ott [2009-01-22 20:32:26 +0100]: > > PUT http://127.0.0.1:5984/test1/Users_ott_tmp_1_tst HTTP/1.1 > Content-Type: ... > ... > Host: 127.0.0.1:5984 > ... Note that this is a valid HTTP request, according to my reading of RFC2616. -- mithrandi, i Ainil en-Balandor, a faer Ambar signatur

Laws and partial values (was: [Haskell-cafe] mapM_ -> Monoid.Monad.map)

2009-01-23 Thread roconnor
On Fri, 23 Jan 2009, Derek Elkins wrote: mempty `mappend` undefined = undefined (left identity monoid law) The above definition doesn't meet this, similarly for the right identity monoid law. That only leaves one definition, () `mappend` () = () which does indeed satisfy the monoid laws. So th

Re: [Haskell-cafe] How to define an operation in terms of itself (but of different type)?

2009-01-23 Thread Jonathan Cast
On Fri, 2009-01-23 at 22:58 +, Olex P wrote: > Well if telepaths on vacation... > > class Vector v where > (^+^) :: v -> v -> v > > data Vector3 = V3 !Double !Double !Double > > instance Vector Vector3 where > (V3 x1 y1 z1) ^+^ (V3 x2 y2 z2) = V3 (x1 + x2) (y1 + y2) (z1 + z2) >

Re: [Haskell-cafe] How to define an operation in terms of itself (but of different type)?

2009-01-23 Thread minh thu
2009/1/24 Dan Piponi : > 2009/1/23 Olex P : > >> class Vector v where >> (^+^) :: v -> v -> v >> >> data Vector3 = V3 !Double !Double !Double >> >> instance Vector Vector3 where >> (V3 x1 y1 z1) ^+^ (V3 x2 y2 z2) = V3 (x1 + x2) (y1 + y2) (z1 + z2) >> >> class Matrix m where >> (^+

Re: [Haskell-cafe] mapM_ -> Monoid.Monad.map

2009-01-23 Thread Derek Elkins
On Fri, 2009-01-23 at 13:39 -0800, George Pollard wrote: > On Fri, 2009-01-23 at 21:30 +, Joachim Breitner wrote: > > Hi, > > > > Am Freitag, den 23.01.2009, 21:50 +0100 schrieb Henning Thielemann: > > > However our recent Monoid discussion made me think about mapM_, > > > sequence_, and fr

Re: [Haskell-cafe] How to define an operation in terms of itself (but of different type)?

2009-01-23 Thread Dan Piponi
2009/1/23 Olex P : > class Vector v where > (^+^) :: v -> v -> v > > data Vector3 = V3 !Double !Double !Double > > instance Vector Vector3 where > (V3 x1 y1 z1) ^+^ (V3 x2 y2 z2) = V3 (x1 + x2) (y1 + y2) (z1 + z2) > > class Matrix m where > (^+^) :: m -> m -> m > > data Matri

Re: [Haskell-cafe] How to define an operation in terms of itself (but of different type)?

2009-01-23 Thread minh thu
2009/1/23 Olex P : > Well if telepaths on vacation... > > class Vector v where > (^+^) :: v -> v -> v > > data Vector3 = V3 !Double !Double !Double > > instance Vector Vector3 where > (V3 x1 y1 z1) ^+^ (V3 x2 y2 z2) = V3 (x1 + x2) (y1 + y2) (z1 + z2) > > class Matrix m where > (^+

Re: [Haskell-cafe] How to define an operation in terms of itself (but of different type)?

2009-01-23 Thread Olex P
Well if telepaths on vacation... class Vector v where (^+^) :: v -> v -> v data Vector3 = V3 !Double !Double !Double instance Vector Vector3 where (V3 x1 y1 z1) ^+^ (V3 x2 y2 z2) = V3 (x1 + x2) (y1 + y2) (z1 + z2) class Matrix m where (^+^) :: m -> m -> m data Matrix3 = M

Re: [Haskell-cafe] How to define an operation in terms of itself (but of different type)?

2009-01-23 Thread Luke Palmer
2009/1/23 Olex P > Hello Haskellers! > It's probably a simple question but I can't find a proper solution... > Suppose we have a class Vector which overloads (+) operation. I'd like to > represent a Matrix data type as a set of vectors: > > data Matrix3 = M3 !Vector3 !Vector3 !Vector3 > > In this

Re: [Haskell-cafe] How to define an operation in terms of itself (but of different type)?

2009-01-23 Thread Miguel Mitrofanov
On 24 Jan 2009, at 01:35, Jonathan Cast wrote: On Sat, 2009-01-24 at 01:30 +0300, Miguel Mitrofanov wrote: Seems like all telepath are on vacation, Now, now, you didn't let enough time elapse to know that for sure. They're always on vacation when you need one. __

Re: [Haskell-cafe] Generalizing a filter-making function

2009-01-23 Thread Ross Mellgren
makeFilter :: (b -> b -> Bool) -> (a -> b) -> b -> a -> Bool makeFilter (==) proj expected = (expected ==) . proj makeEqFilter :: Eq b => (a -> b) -> b -> a -> Bool makeEqFilter = makeFilter (==) Then you have a foo: data Foo = Foo { fooA :: String, fooB :: Int } foos = [Foo "a" 1, Foo "b" 2]

Re: [Haskell-cafe] How to define an operation in terms of itself (but of different type)?

2009-01-23 Thread Jonathan Cast
On Sat, 2009-01-24 at 01:30 +0300, Miguel Mitrofanov wrote: > Seems like all telepath are on vacation, Now, now, you didn't let enough time elapse to know that for sure. jcc ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org

Re: [Haskell-cafe] How to define an operation in terms of itself (but of different type)?

2009-01-23 Thread Miguel Mitrofanov
Seems like all telepath are on vacation, so you would have to show the code. On 24 Jan 2009, at 01:15, Olex P wrote: Hello Haskellers! It's probably a simple question but I can't find a proper solution... Suppose we have a class Vector which overloads (+) operation. I'd like to represent a

Re: [Haskell-cafe] Employment

2009-01-23 Thread Krzysztof Skrzętnicki
There are quite a few people with working Haskell knowledge in Wroclaw. I'm sure many of my colleagues (from University of Wroclaw: http://www.ii.uni.wroc.pl/ ) know Haskell and I think would enjoy working with it. All best Christopher Skrzętnicki On Fri, Jan 23,

[Haskell-cafe] How to define an operation in terms of itself (but of different type)?

2009-01-23 Thread Olex P
Hello Haskellers! It's probably a simple question but I can't find a proper solution... Suppose we have a class Vector which overloads (+) operation. I'd like to represent a Matrix data type as a set of vectors: data Matrix3 = M3 !Vector3 !Vector3 !Vector3 In this case (+) for matrices could be i

Re: [Haskell-cafe] mapM_ -> Monoid.Monad.map

2009-01-23 Thread George Pollard
On Fri, 2009-01-23 at 21:30 +, Joachim Breitner wrote: > Hi, > > Am Freitag, den 23.01.2009, 21:50 +0100 schrieb Henning Thielemann: > > However our recent Monoid discussion made me think about mapM_, > > sequence_, and friends. I think they could be useful for many monads if > > they woul

Re: [Haskell-cafe] mapM_ -> Monoid.Monad.map

2009-01-23 Thread Dan Doel
On Friday 23 January 2009 3:50:18 pm Henning Thielemann wrote: > I always considered the monad functions with names ending on '_' a > concession to the IO monad. Would you need them for any other monad than > IO? For self-written monads you would certainly use a monoid instead of > monadic action

Re: [Haskell-cafe] Employment

2009-01-23 Thread Bartosz Wójcik
On Monday 19 January 2009 23:26:09 Sittampalam, Ganesh wrote: > We (Credit Suisse) have Haskell developers in both London and NY, > although the page only listed NY (I've now corrected it). If CS had Haskell positions in Wroclaw, Poland I'd apply for it! Best, Bartek

Re: [Haskell-cafe] mapM_ -> Monoid.Monad.map

2009-01-23 Thread Joachim Breitner
Hi, Am Freitag, den 23.01.2009, 21:50 +0100 schrieb Henning Thielemann: > However our recent Monoid discussion made me think about mapM_, > sequence_, and friends. I think they could be useful for many monads if > they would have the type: > mapM_ :: (Monoid b) => (a -> m b) -> [a] -> m b >

Re: [Haskell-cafe] MySQL and HDBC?

2009-01-23 Thread david48
On Fri, 2009-01-23 at 03:54 -0600, Galchin, Vasili wrote: > ooops ... cabal install HDBC-mysql doesn't work ?? for what it's worth, calbal install hdbc-mysql worked on my office's pc. ( kubuntu 8.10 ) ___ Haskell-Cafe mailing list Haskell-Cafe@haske

[Haskell-cafe] Generalizing a filter-making function

2009-01-23 Thread Dominic Espinosa
Novice question here. Sorry if the post is wordy. In the following code (which doesn't actually compile as-is), I'm trying to generalize these 'make*Filter' functions into a single 'makeFilter' function. However, I can't get the types to work right. Foo is a tuple type on which a large number of

Re: [Haskell-cafe] mapM_ -> Monoid.Monad.map

2009-01-23 Thread Thomas Davie
On 23 Jan 2009, at 21:50, Henning Thielemann wrote: I always considered the monad functions with names ending on '_' a concession to the IO monad. Would you need them for any other monad than IO? For self-written monads you would certainly use a monoid instead of monadic action, all retu

[Haskell-cafe] mapM_ -> Monoid.Monad.map

2009-01-23 Thread Henning Thielemann
I always considered the monad functions with names ending on '_' a concession to the IO monad. Would you need them for any other monad than IO? For self-written monads you would certainly use a monoid instead of monadic action, all returning (), but IO is a monad. (You could however wrap (ne

Re: [Haskell-cafe] MySQL and HDBC?

2009-01-23 Thread Duncan Coutts
On Fri, 2009-01-23 at 03:54 -0600, Galchin, Vasili wrote: > On Fri, Jan 23, 2009 at 3:23 AM, Duncan Coutts > wrote: > > This was uploaded to hackage yesterday: > > > http://hackage.haskell.org/cgi-bin/hackage-scrip

Re: [Haskell-cafe] Haskell mode for Emacs question

2009-01-23 Thread John A. De Goes
No, Haskell support in the free version too. However, you'll have to add the tools to compile .hs files in the "Tools" menu. You can pipe the output to directly highlight errors/warnings in the document (which is what's done in the screenshot below), because the editor understands what GH

Re: [Haskell-cafe] Haskell mode for Emacs question

2009-01-23 Thread Peter Verswyvelen
looks like a neath editor. too bad on windows you don't get anti aliased fonts (I guess it uses an old J2SE or something?) at first sight I was not able to find Haskell support in the freely downloadable version. is this available in the commercial version? On Thu, Jan 22, 2009 at 6:50 PM, John A

[Haskell-cafe] Re: how to implement daemon start and stop directives?

2009-01-23 Thread Gleb Alexeyev
Ertugrul Soeylemez wrote: And to prove that IORefs do lead to a pointer race condition and hence are insecure, try the following code: main :: IO () main = do ref <- newIORef False forkIO $ forever $ modifyIORef ref not forever $ readIORef ref >>= print It crashes for me. I'm u

Re: [Haskell-cafe] MySQL and HDBC?

2009-01-23 Thread Chris Waterson
On Jan 23, 2009, at 1:23 AM, Duncan Coutts wrote: On Fri, 2009-01-23 at 08:06 +, Sebastian Sylvan wrote: 2009/1/23 Galchin, Vasili Hello, "Real World Haskell" seems to say that the abstraction layer HDBC doesn't support MySQL. If so, in what sense doesn't

Re: [Haskell-cafe] Generic typeclass for converting between types

2009-01-23 Thread John Goerzen
Magnus Therning wrote: > On Fri, Jan 23, 2009 at 3:01 PM, John Goerzen wrote: >> Hi folks, >> >> I've been thinking today that I frequently need to convert data beween >> types: >> >> * Between various numeric types >> >> * Between various calendar types (both within the new calendar >> system

[Haskell-cafe] Re: how to implement daemon start and stop directives?

2009-01-23 Thread Ertugrul Soeylemez
Eugene Kirpichov wrote: > >> daemon :: IO () -> IO (IO ()) > >> daemon action = do > >> stopvar <- newIORef False > >> let run = do > >> stop <- readIORef stopvar > >> if stop then return () else (action >> run) > >> forkIO run > >> return (writeIORef stopvar T

Re: [Haskell-cafe] Generic typeclass for converting between types

2009-01-23 Thread Magnus Therning
On Fri, Jan 23, 2009 at 3:01 PM, John Goerzen wrote: > Hi folks, > > I've been thinking today that I frequently need to convert data beween > types: > > * Between various numeric types > > * Between various calendar types (both within the new calendar > system, and between the old and new) > >

[Haskell-cafe] Generic typeclass for converting between types

2009-01-23 Thread John Goerzen
Hi folks, I've been thinking today that I frequently need to convert data beween types: * Between various numeric types * Between various calendar types (both within the new calendar system, and between the old and new) * Marshalling data back and forth to a database in HDBC It's hard to

[Haskell-cafe] Re: Is it possible to model eventually consistent side effects?

2009-01-23 Thread Ertugrul Soeylemez
Daryoush Mehrtash wrote: > I am trying to figure out if there is a way to model cloud computing > computations in Haskell. > > My specific problems is that in cloud computing, as in Amazon > WebServices, side effects (writes to storage, simple database, queue) > follow the eventually consistent m

Re: [Haskell-cafe] Employment

2009-01-23 Thread Brent Yorgey
On Thu, Jan 22, 2009 at 04:57:56PM -0800, Jonathan Cast wrote: > On Tue, 2009-01-20 at 19:14 +, Andrew Coppin wrote: > > Jonathan Cast wrote: > > > On Mon, 2009-01-19 at 21:04 +, Andrew Coppin wrote: > > > >> I mean, heck, *I* use Haskell at work - and I'm not even supposed to be > > >> c

Re: [Haskell-cafe] MySQL and HDBC?

2009-01-23 Thread Galchin, Vasili
ok .. thank you. Vasili On Fri, Jan 23, 2009 at 3:23 AM, Duncan Coutts wrote: > On Fri, 2009-01-23 at 08:06 +, Sebastian Sylvan wrote: > > > > > > 2009/1/23 Galchin, Vasili > > Hello, > > > > "Real World Haskell" seems to say that the abstraction > > layer HDBC

Re: [Haskell-cafe] Re: how to implement daemon start and stop directives?

2009-01-23 Thread Eugene Kirpichov
2009/1/23 Ertugrul Soeylemez : > Luke Palmer wrote: > >> On Thu, Jan 22, 2009 at 9:04 AM, Ertugrul Soeylemez wrote: >> >> > Sometimes this is inevitable, but I've never seen a case, where >> > IORefs couldn't be replaced by a more elegant State/StateT-based >> > solution. And if you need to do m

[Haskell-cafe] Re: MySQL and HDBC?

2009-01-23 Thread Gour
> "Sebastian" == Sebastian Sylvan writes: Sebastian> It doesn't have a MySQL backend. However, it does have an Sebastian> ODBC backend which should work fine with MySQL. http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HDBC-mysql Sincerely, Gour -- Gour | Zagreb, Croatia |

Re: [Haskell-cafe] Re: Liskell installation configuration problems in Cygwin on Windows XP Professional, Service Pack 2

2009-01-23 Thread Neil Mitchell
Hi Benjamin, Try: cabal install ghc-paths If you want to install packages manually you can also get it from http://hackage.haskell.org Thanks Neil On Fri, Jan 23, 2009 at 9:16 AM, Benjamin L. Russell wrote: > On Fri, 23 Jan 2009 18:10:16 +0900, Benjamin L.Russell > wrote: > >>Yesterday, I d

Re: [Haskell-cafe] MySQL and HDBC?

2009-01-23 Thread Duncan Coutts
On Fri, 2009-01-23 at 08:06 +, Sebastian Sylvan wrote: > > > 2009/1/23 Galchin, Vasili > Hello, > > "Real World Haskell" seems to say that the abstraction > layer HDBC doesn't support MySQL. If so, in what sense doesn't > HDBC support > M

[Haskell-cafe] Re: Liskell installation configuration problems in Cygwin on Windows XP Professional, Service Pack 2

2009-01-23 Thread Benjamin L . Russell
On Fri, 23 Jan 2009 18:10:16 +0900, Benjamin L.Russell wrote: >Yesterday, I downloaded Darcs 2.2 and Liskell for Windows XP >Professional, Service Pack 2, but the following error message appeared >when I ran "./Setup.lhs configure" in Cygwin: > >Configuring liskell-0.1... >Setup.lhs: At least the

[Haskell-cafe] Liskell installation configuration problems in Cygwin on Windows XP Professional, Service Pack 2

2009-01-23 Thread Benjamin L . Russell
Yesterday, I downloaded Darcs 2.2 and Liskell for Windows XP Professional, Service Pack 2, but the following error message appeared when I ran "./Setup.lhs configure" in Cygwin: Configuring liskell-0.1... Setup.lhs: At least the following dependencies are missing: ghc-paths -any Does anybody know

Re: [Haskell-cafe] Why monoids will abide...

2009-01-23 Thread Brandon S. Allbery KF8NH
On 2009 Jan 22, at 10:09, Andrew Wagner wrote: See, that's the kind of name we need! StructureWithAssociativeOperationAndIdentity -- make both the mathematicians AND the non-mathematicians mad! "SimpleArithmetic" (you have "numbers" and a single "arithmetic operation" on them). You can pl

Re: [Haskell-cafe] Employment

2009-01-23 Thread George Pollard
On Fri, 2009-01-23 at 16:19 +1100, Toby Hutton wrote: > On Fri, Jan 23, 2009 at 11:56 AM, Jonathan Cast > wrote: > > > > Not really. My company *advertises* for Haskell developers, and then > > when they come in to interview, informs them that the code base is > > actually written in Perl. Work

Re: [Haskell-cafe] Re: Does readFile "/proc/mounts" hang for you?

2009-01-23 Thread Brandon S. Allbery KF8NH
On 2009 Jan 21, at 21:13, Thomas DuBuisson wrote: ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0x77470b70) = -1 ENOTTY (Inappropriate ioctl for device) This is just the test for buffering: terminal-like devices (TCGETS) are line buffered, others are block buffered. select(4, [3], [], NULL,

Re: [Haskell-cafe] MySQL and HDBC?

2009-01-23 Thread Sebastian Sylvan
2009/1/23 Galchin, Vasili > Hello, > > "Real World Haskell" seems to say that the abstraction layer HDBC > doesn't support MySQL. If so, in what sense doesn't HDBC support > MySQL?? It doesn't have a MySQL backend. However, it does have an ODBC backend which should work fine with MySQL.