Re: [Haskell-cafe] What is a number. (Was: Num instances for 2-dimensional types)

2009-10-05 Thread Jason Dagit
On Mon, Oct 5, 2009 at 11:02 AM, Sönke Hahn wrote: > > > > On 5 Oct 2009, at 21:06, Lennart Augustsson wrote: > > > OK, "just pairs" have no arithmetic, but one way of defining > > > arithmetic is to treat the pairs as complex numbers. Or as mantissa > > > and exponent. Or as something else. S

[Haskell-cafe] Re: Finally tagless - stuck with implementation?of?"lam"

2009-10-05 Thread Chung-chieh Shan
Don Stewart wrote in article <20091006031054.gb18...@whirlpool.galois.com> in gmane.comp.lang.haskell.cafe: > ccshan: > > (Section 5 of our (JFP) paper addresses both CBN and CBV.) > Do you have a link to the paper? Sorry, here it is. http://www.cs.rutgers.edu/~ccshan/tagless/jfp.pdf -- Edit t

Re: [Haskell-cafe] Generalizing IO

2009-10-05 Thread David Menendez
On Mon, Oct 5, 2009 at 11:54 PM, Floptical Logic wrote: >> Instead of specifying the monad implementation, specify the interface. >> That is, you are using state operations (from MonadState) and IO >> operations (from MonadIO). Try removing all the type signatures that >> mention PDState and see w

Re: [Haskell-cafe] Generalizing IO

2009-10-05 Thread Antoine Latter
On Mon, Oct 5, 2009 at 10:54 PM, Floptical Logic wrote: > > If I were to make an instance of MonadIO be a parameter to StateT and > I wanted to use the Net monad (from Roll your own IRC bot on the wiki) > with it, I would need to make Net an instance of MonadIO.  What would > this instance look li

Re: [Haskell-cafe] Generalizing IO

2009-10-05 Thread Floptical Logic
> Instead of specifying the monad implementation, specify the interface. > That is, you are using state operations (from MonadState) and IO > operations (from MonadIO). Try removing all the type signatures that > mention PDState and see what you get. > > E.g., loop :: (MonadState PD m, MonadIO m) =

Re: [Haskell-cafe] Market Place for Haskell development teams?

2009-10-05 Thread Jörg Roman Rudnick
Hi John, IMHO, with medium sized projects which are not application software to be installed on a greater number of unknown systems, the problem described by you is less aggravating: Hackage offers a fairly good track of version history and I for myself have adapted versions a good deal of

Re: [Haskell-cafe] Market Place for Haskell development teams?

2009-10-05 Thread Jörg Roman Rudnick
Hi Thomas, two very substantial contributions... :-) (a) Yes, let's do it with Happstack. (b) I just applied for the group. Nick Thomas Hartman wrote: Hey, first of all, in terms of a platform for promoting haskell commercially, happstutorial.com actually implements a job board. Yeah, it

Re: [Haskell-cafe] Market Place for Haskell development teams?

2009-10-05 Thread Jörg Roman Rudnick
Hi Curt, in case you regard as 'mainstream' big industry projects, this is not the thing at least I am speaking about. I am speaking about small and especially medium sized projects. Frankly, I think that: o there are people among us which at some times have influence on decisions about

Re: [Haskell-cafe] Re: Finally tagless - stuck with implementation of?"lam"

2009-10-05 Thread Don Stewart
ccshan: > class HOAS repr arrow int where > > lam :: (repr a -> repr b) -> repr (arrow a b) > app :: repr (arrow a b) -> repr a -> repr b > fix :: (repr a -> repr a) -> repr a > let_ :: repr a -> (repr a -> repr b) -> repr b > > int :: int -> repr int > add :: repr int -

Re: [Haskell-cafe] Market Place for Haskell development teams?

2009-10-05 Thread Jörg Roman Rudnick
Hi Alberto, you are working on *second order scalibility*?? Great. May I regard you a one of the first of a breed of Haskell business evangelists?? ;-)) Somebody stated here - sorry, the name's missing - the relevance of Hackage being diminuished by the great amount of *scientific* libraries,

[Haskell-cafe] Re: Finally tagless - stuck with implementation of?"lam"

2009-10-05 Thread Chung-chieh Shan
Robert Atkey wrote in article <1254778973.3675.42.ca...@bismuth> in gmane.comp.lang.haskell.cafe: > To implement the translation of embedded language types to Haskell types > in Haskell we use type families. This type-to-type translation is indeed the crux of the trickiness. By the way, Section

[Haskell-cafe] Re: Haskell Platform - changing the global install dir

2009-10-05 Thread Mikhail Glushenkov
Hi Paul, Paul Moore gmail.com> writes: > Is there a way I could have specified that I want the global install > directory in D:\Apps\Haskell? I guess I could hack my cabal\config > file (and presumably change PATH) but that seems a bit ugly. A bit ugly? Why? That's precisely what the config fi

Re: [Haskell-cafe] Generalizing IO

2009-10-05 Thread Gregory Crosswhite
My thought is that you could simply drop the IO from your type definition, type PDState = StateT PD You will need to change all of your type signature from "PDState " to "PDState m " to make them all polymorphic over the choice of monad. Then all you should need to do is to generalize the

Re: [Haskell-cafe] Generalizing IO

2009-10-05 Thread David Menendez
On Mon, Oct 5, 2009 at 7:56 PM, Floptical Logic wrote: > The code below is a little interactive program that uses some state. > It uses StateT with IO to keep state.  My question is: what is the > best way to generalize this program to work with any IO-like > monad/medium?  For example, I would li

[Haskell-cafe] Generalizing IO

2009-10-05 Thread Floptical Logic
The code below is a little interactive program that uses some state. It uses StateT with IO to keep state. My question is: what is the best way to generalize this program to work with any IO-like monad/medium? For example, I would like the program to function as it does now using stdin but I woul

Re: [Haskell-cafe] Finally tagless - stuck with implementation of "lam"

2009-10-05 Thread David Menendez
2009/10/5 Robert Atkey : > Hi Günther, > > The underlying problem with the implementation of 'lam' is that > you have to pick an evaluation order for the side effects you want in > the semantics of your embedded language. The two obvious options are > call-by-name and call-by-value. I wonder how e

Re: [Haskell-cafe] Num instances for 2-dimensional types

2009-10-05 Thread Soenke Hahn
On Monday 05 October 2009 11:58:28 pm Henning Thielemann wrote: > On Mon, 5 Oct 2009, Soenke Hahn wrote: > > On Monday 05 October 2009 10:14:02 pm Henning Thielemann wrote: > >> I use NumericPrelude that has more fine grained type classes. E.g. (+) > >> is in Additive and (*) is in Ring. > >> > >>

Re: [Haskell-cafe] Num instances for 2-dimensional types

2009-10-05 Thread Henning Thielemann
On Mon, 5 Oct 2009, Soenke Hahn wrote: On Monday 05 October 2009 10:14:02 pm Henning Thielemann wrote: I use NumericPrelude that has more fine grained type classes. E.g. (+) is in Additive and (*) is in Ring. http://hackage.haskell.org/package/numeric-prelude That is pretty cool, thanks.

Re: [Haskell-cafe] Mutable data within a (non-IO) monad

2009-10-05 Thread Bryan O'Sullivan
On Sat, Oct 3, 2009 at 1:57 AM, Duncan Coutts wrote: > > Internally, each time you demand the next random number, it is mutating > the internal ST array. This is the same thing that the Statistics.RandomVariate code in the statistics package does, and it can be very fast: http://www.serpentine.c

Re: [Haskell-cafe] Finally tagless - stuck with implementation of "lam"

2009-10-05 Thread Robert Atkey
Hi Günther, The underlying problem with the implementation of 'lam' is that you have to pick an evaluation order for the side effects you want in the semantics of your embedded language. The two obvious options are call-by-name and call-by-value. The tricky point is that the types of the embedde

Re: [Haskell-cafe] I/O Haskell question

2009-10-05 Thread Terry Hayes
I found the handling of (IO t) by the interpreter (GHCI in my case) to be somewhat confusing. As pointed out below, I can type: readFile "bla" :: IO String and GHCI happily displays the contents of the file. However neither of the following work print $ readFile "bla" putStr $

Re: [Haskell-cafe] Finally tagless - stuck with implementation of "lam"

2009-10-05 Thread Jacques Carette
BTW, here is a more symmetric version of the same code: lam f = I . return $ unsafePerformIO . unI . f . I . return which has a very clear pattern of lam f = embed $ extract . f. embed where 'embed' is often called "return". Implementations of lam in "tagless final" style tend to follow th

Re: [Haskell-cafe] Num instances for 2-dimensional types

2009-10-05 Thread Soenke Hahn
On Monday 05 October 2009 10:14:02 pm Henning Thielemann wrote: > Sönke Hahn schrieb: > > Hi! > > > > I often stumble upon 2- (or 3-) dimensional numerical data types like > > > > (Double, Double) > > > > or similar self defined ones. I like the idea of creating instances for > > Num for these

Re: [Haskell-cafe] dsl and gui toolkit

2009-10-05 Thread Chris Eidhof
That sounds really interesting, it would be great if you could share some of your work by putting it on hackage or posting a link to the repository! -chris On 5 okt 2009, at 12:42, Andrew U. Frank wrote: writing a gui is a mess (independent of wx or gtk) - too much detail is shown and no

Re: [Haskell-cafe] Finally tagless - stuck with implementation of "lam"

2009-10-05 Thread Günther Schmidt
Hello Jacques, thanks, that is disappointing in some way, guess I still have a lot to learn. Günther Am 05.10.2009, 18:06 Uhr, schrieb Jacques Carette : It's possible, but it's not nice. You need to be able to "get out of the monad" to make the types match, i.e. lam f = I (return $

Re: [Haskell-cafe] Designing a DSL?

2009-10-05 Thread Günther Schmidt
Hello Doaitse, thank you very much! Best regards Günther ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] System.Random.Mersenne - no randomR variants

2009-10-05 Thread Paul Moore
2009/10/5 Don Stewart : > p.f.moore: >> I notice that System.Random.Mersenne has no randomR variants. Is there >> a reason for this, or is it just an oversight? It makes porting code >> from System.Random a little more complicated than it needs to be. I >> know it's possible to write a function map

Re: [Haskell-cafe] System.Random.Mersenne - no randomR variants

2009-10-05 Thread Don Stewart
p.f.moore: > I notice that System.Random.Mersenne has no randomR variants. Is there > a reason for this, or is it just an oversight? It makes porting code > from System.Random a little more complicated than it needs to be. I > know it's possible to write a function mapping a Double (or other > valu

[Haskell-cafe] System.Random.Mersenne - no randomR variants

2009-10-05 Thread Paul Moore
I notice that System.Random.Mersenne has no randomR variants. Is there a reason for this, or is it just an oversight? It makes porting code from System.Random a little more complicated than it needs to be. I know it's possible to write a function mapping a Double (or other value, as appropriate) to

Re: [Haskell-cafe] Num instances for 2-dimensional types

2009-10-05 Thread Henning Thielemann
Sönke Hahn schrieb: > Hi! > > I often stumble upon 2- (or 3-) dimensional numerical data types like > > (Double, Double) > > or similar self defined ones. I like the idea of creating instances for Num > for > these types. The meaning of (+), (-) and negate is clear and very intuitive, > i

[Haskell-cafe] Haskell Platform - changing the global install dir

2009-10-05 Thread Paul Moore
I've installed the Haskell Platform to a non-default location (D:\Apps\Haskell) to avoid some of the Win7 funniness over writing to C:\Program Files. However, even though I've done this, the cabal global install directory is still C:\Program Files\haskell. This has been added to my PATH and is used

[Haskell-cafe] Re: suggestions for doing date/time values with Data.Generics ?

2009-10-05 Thread Thomas Hartman
fwiw, this s what I'm doing till I figure out a better way: import System.Time data MyTime = MyTime Integer Integer deriving (Typeable,Data) myTimeToClockTime (MyTime a b) = TOD a b myTimeFromClockTime (TOD a b) = MyTime a b and use MyTime in the happstack state. 2009/10/5 Thomas Hartman : > I

[Haskell-cafe] suggestions for doing date/time values with Data.Generics ?

2009-10-05 Thread Thomas Hartman
I want to patch the time package, which I darcs got head on. Goal is to be able to do newtype deriving for UTCTime which I reckon is the base time value, for use in happstack applications state. basically, need instances for UTCTime, for Data and Typeable. ** on #haskell: I just darcs

Re: [Haskell-cafe] What is a number. (Was: Num instances for 2-dimensional types)

2009-10-05 Thread Sönke Hahn
> > On 5 Oct 2009, at 21:06, Lennart Augustsson wrote: > > OK, "just pairs" have no arithmetic, but one way of defining > > arithmetic is to treat the pairs as complex numbers. Or as mantissa > > and exponent. Or as something else. So there's nothing wrong, IMO, > > to make pairs an instance of

Re: [Haskell-cafe] What is a number. (Was: Num instances for 2-dimensional types)

2009-10-05 Thread Miguel Mitrofanov
And I agree that sometimes it can be suitable. But simply "defining an instance of Num" without a single word on the problem one is trying to solve is not just pointless. It's something that should not be done. On 5 Oct 2009, at 21:06, Lennart Augustsson wrote: OK, "just pairs" have no ar

Re: [Haskell-cafe] What is a number. (Was: Num instances for 2-dimensional types)

2009-10-05 Thread Lennart Augustsson
OK, "just pairs" have no arithmetic, but one way of defining arithmetic is to treat the pairs as complex numbers. Or as mantissa and exponent. Or as something else. So there's nothing wrong, IMO, to make pairs an instance of Num if you so desire. (Though I'd probably introduce a new type.) On

Re: [Haskell-cafe] What is a number. (Was: Num instances for 2-dimensional types)

2009-10-05 Thread Miguel Mitrofanov
"Just pairs" have no natural arithmetic upon them. Exactly my point. BTW. the missing term of M.M. is DUAL NUMBERS. Remembered this already. Thanks anyway. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listi

Re: [Haskell-cafe] Num instances for 2-dimensional types

2009-10-05 Thread Miguel Mitrofanov
On 5 Oct 2009, at 19:17, Lennart Augustsson wrote: Complex numbers are just pairs of numbers, What about dual numbers? (Yes, I've remembered the term) Aren't they also just pairs of numbers? There may be other ways to define the operations on pairs of numbers that makes sense too. But

Re: [Haskell-cafe] What is a number. (Was: Num instances for 2-dimensional types)

2009-10-05 Thread Anton van Straaten
jerzy.karczmarc...@info.unicaen.fr wrote: American people will call it a discussion about "semantics", and we, European will not understand why this word is used in a pejorative context... "Semantics" *should* be a pejorative word unless it refers to something formally specified, and preferabl

Re: [Haskell-cafe] Finally tagless - stuck with implementation of "lam"

2009-10-05 Thread Jacques Carette
It's possible, but it's not nice. You need to be able to "get out of the monad" to make the types match, i.e. lam f = I (return $ \x -> let y = I (return x) in unsafePerformIO $ unI (f y)) The use of IO 'forces' lam to transform its effectful input into an even

[Haskell-cafe] What is a number. (Was: Num instances for 2-dimensional types)

2009-10-05 Thread jerzy . karczmarczuk
L.A. says: complex numbers are just pairs of numbers. Later : Being a number is in the eye of the beholder. :) Now, the readers of this forum will with horror witness a discussion about the meaning of the word "just"... American people will call it a discussion about "semantics", and we, Euro

[Haskell-cafe] Finally tagless - stuck with implementation of "lam"

2009-10-05 Thread Günther Schmidt
Hi all, I'm playing around with finally tagless. Here is the class for my Syntax: class HOAS repr where lam :: (repr a -> repr b) -> repr (a -> b) app :: repr (a -> b) -> repr a -> repr b fix :: (repr a -> repr a) -> repr a let_ :: repr a -> (repr a -> repr b) -> repr b in

Re: [Haskell-cafe] Num instances for 2-dimensional types

2009-10-05 Thread Lennart Augustsson
Complex numbers are just pairs of numbers, and then the various operations on them are defined in a specific way. There may be other ways to define the operations on pairs of numbers that makes sense too. You can also view complex numbers as polynomials if you wish. Or two element lists of number

Re: [Haskell-cafe] Num instances for 2-dimensional types

2009-10-05 Thread Jacques Carette
Lennart Augustsson wrote: Everyone agrees that the Haskell numeric hierarchy is flawed, but I've yet to see a good replacement. That's because the "good replacement" which is mathematically sound would be a real mess to work with -- for exactly the same reason that Functor , Applicative and

Re: [Haskell-cafe] Num instances for 2-dimensional types

2009-10-05 Thread Joe Fredette
Shouldn't the question not be "Is this a number?" but rather "What is a number?" -- I mean, from an abstract point of view, there's really no such thing, right? We have sets of things which we define an operation that has certain properties, and suddenly we start calling them numbers. Are t

Re: [Haskell-cafe] Num instances for 2-dimensional types

2009-10-05 Thread Daniel Fischer
Am Montag 05 Oktober 2009 16:29:02 schrieb Job Vranish: > In what way is it not a number? > If there's a natural[1] implementation of fromInteger, good. If there isn't, *don't provide one*. fromInteger _ = error "Not sensible" is better than doing something strange. [1] In the case of residue cl

Re: [Haskell-cafe] Num instances for 2-dimensional types

2009-10-05 Thread Miguel Mitrofanov
No, they aren't. They are polynomials in one variable "i" modulo i^2+1. Seriously, if you say complex numbers are just pairs of real numbers - you have to agree that double numbers (sorry, don't know the exact English term), defined by (a,b)+(c,d) = (a+c,b+d) (a,b)(c,d) = (ac, ad+bc) are jus

Re: [Haskell-cafe] Num instances for 2-dimensional types

2009-10-05 Thread Lennart Augustsson
Everyone agrees that the Haskell numeric hierarchy is flawed, but I've yet to see a good replacement. On Mon, Oct 5, 2009 at 4:51 PM, Brad Larsen wrote: > On Mon, Oct 5, 2009 at 10:36 AM, Miguel Mitrofanov > wrote: > [...] >> Of course, it's OK to call anything "numbers" provided that you stated

Re: [Haskell-cafe] Num instances for 2-dimensional types

2009-10-05 Thread Brad Larsen
On Mon, Oct 5, 2009 at 10:36 AM, Miguel Mitrofanov wrote: [...] > Of course, it's OK to call anything "numbers" provided that you stated > explicitly what exactly you would mean by that. But then you have to drop > all kind of stuff mathematicians developed for the usual notion of numbers. > In th

Re: [Haskell-cafe] better way to do this?

2009-10-05 Thread Daniel Fischer
Am Montag 05 Oktober 2009 16:22:15 schrieb Michael Mossey: > Eugene Kirpichov wrote: > > [x,y,t,b,l,r] <- mapM (getStdRandom . randomR) [(-10,10), (-70,70), ...] > > return (BoxBounds ...) > > Thanks. > > I'm curious about the idea of "pattern matching in do-statements that can > fail." This partic

Re: [Haskell-cafe] Num instances for 2-dimensional types

2009-10-05 Thread Lennart Augustsson
But complex numbers are just pairs of numbers. So pairs of numbers can obviously be numbers then. On Mon, Oct 5, 2009 at 4:40 PM, Miguel Mitrofanov wrote: > Lennart Augustsson wrote: >> >> And what is a number? > > Can't say. You know, it's kinda funny to ask a biologist what it means to be > al

Re: [Haskell-cafe] apply function arguments in a list

2009-10-05 Thread Neil Brown
Michael Mossey wrote: If I have a list containing the arguments I want to give to a function, is there a general way to supply those arguments in a compact syntax? In other words, I could have args = [1,2,3] f x y z = ... I would write t = f (args!!0) (args!!1) (args!!2) but there may be a

Re: [Haskell-cafe] Num instances for 2-dimensional types

2009-10-05 Thread Miguel Mitrofanov
Lennart Augustsson wrote: And what is a number? Can't say. You know, it's kinda funny to ask a biologist what it means to be alive. Are complex numbers numbers? Beyond any reasonable doubt. Just like you and me are most certainly alive. ___ Hask

Re: [Haskell-cafe] apply function arguments in a list

2009-10-05 Thread Miguel Mitrofanov
t = let [x,y,z] = args in f x y z Michael Mossey wrote: t = f (args!!0) (args!!1) (args!!2) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Num instances for 2-dimensional types

2009-10-05 Thread Miguel Mitrofanov
Miguel Mitrofanov, please kindly stop pretending that you KNOW what is a number, and what is not. Never said that. Sometimes it's debatable. But if you can't figure out a way to multiply things so that it would make some kind of sense - you haven't made them numbers (yet). The numeric class

Re: [Haskell-cafe] I/O Haskell question

2009-10-05 Thread Gwern Branwen
On Mon, Oct 5, 2009 at 9:48 AM, Maria Boghiu wrote: Hey. I'm trying to configure Xmonad, the window manager. for this purpose, I'm trying to read the workspaces variable in the code below from file. As you can see, I do workspaces = readWS where readWS = do l <- readFile "~/bla"

[Haskell-cafe] apply function arguments in a list

2009-10-05 Thread Michael Mossey
If I have a list containing the arguments I want to give to a function, is there a general way to supply those arguments in a compact syntax? In other words, I could have args = [1,2,3] f x y z = ... I would write t = f (args!!0) (args!!1) (args!!2) but there may be a neater, more general sy

Re: [Haskell-cafe] Num instances for 2-dimensional types

2009-10-05 Thread Job Vranish
In what way is it not a number? data MyNumber a = MyNum a a deriving (Show, Eq) instance Functor MyNum where fmap f (MyNum a b) = MyNum (f a) (f b) instance Applicative MyNum where pure a = MyNum a a MyNum f g <*> MyNum a b = MyNum (f a) (g b) instance (Num a) => Num (MyNum a) where

Re: [Haskell-cafe] Re: Curried function terminology

2009-10-05 Thread michael rice
Yeah, and Haskell supports Linux, AND Windows. ;-) Thanks for the explanation. My shorts weren't in a knot; just said Huh? upon reading it, thinking maybe I misunderstood something along the way. Michael --- On Mon, 10/5/09, Jon Fairbairn wrote: From: Jon Fairbairn Subject: [Haskell-cafe

Re: [Haskell-cafe] I/O Haskell question

2009-10-05 Thread Keith Sheppard
I have to nominate "I'm lying here, but for a good cause" as a quote of the week. -Keith On Mon, Oct 5, 2009 at 10:06 AM, Deniz Dogan wrote: > 2009/10/5 Maria Boghiu : >> I get an error saying I am mismatching types IO [String] and [String]. > > Something of the type IO [String] is a computation

Re: [Haskell-cafe] better way to do this?

2009-10-05 Thread Eugene Kirpichov
2009/10/5 Michael Mossey : > > > Eugene Kirpichov wrote: >> >> [x,y,t,b,l,r] <- mapM (getStdRandom . randomR) [(-10,10), (-70,70), ...] >> return (BoxBounds ...) > > Thanks. > > I'm curious about the idea of "pattern matching in do-statements that can > fail." This particular pattern cannot fail. I

Re: [Haskell-cafe] better way to do this?

2009-10-05 Thread Michael Mossey
If I understand correctly, this works because IO is an instance of Applicative, correct? I wonder if any of the random monads are instances of Applicative. Felipe Lessa wrote: On Sun, Oct 04, 2009 at 01:55:11PM +0400, Eugene Kirpichov wrote: [x,y,t,b,l,r] <- mapM (getStdRandom . randomR) [(-1

Re: [Haskell-cafe] better way to do this?

2009-10-05 Thread Michael Mossey
Eugene Kirpichov wrote: [x,y,t,b,l,r] <- mapM (getStdRandom . randomR) [(-10,10), (-70,70), ...] return (BoxBounds ...) Thanks. I'm curious about the idea of "pattern matching in do-statements that can fail." This particular pattern cannot fail. I read that the "fail" function was introduc

Re: [Haskell-cafe] Num instances for 2-dimensional types

2009-10-05 Thread jerzy . karczmarczuk
Miguel Mitrofanov rebukes Sönke Hahn, who -: wrote: I used to implement fromInteger n = (r, r) where r = fromInteger n , but thinking about it, fromInteger n = (fromInteger n, 0) seems very reasonable, too. Stop pretending something is a number when it's not. Miguel Mitrofanov,

Re: [Haskell-cafe] dsl and gui toolkit

2009-10-05 Thread Jake McArthur
If you could throw it on Hackage or a public repo you will get more exposure. :) - Jake ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Designing a DSL?

2009-10-05 Thread S. Doaitse Swierstra
On 2 okt 2009, at 20:37, Jake McArthur wrote: Günther Schmidt wrote: And that I find to be the really tricky part, how do I *design* a DSL? I once wrote a tutorial on this subject in which I explain that designing a DSL is not so much different from an ordinary programming language; th

[Haskell-cafe] ICFP videos now available

2009-10-05 Thread Wouter Swierstra
I am happy to announce that videos of all talks at ICFP and some of the associated workshops this year have made available online: http://www.vimeo.com/user2191865/albums I'm sure you'll join me in thanking Malcolm Wallace for the time and effort he put into making this possible. Thank you Malc

Re: [Haskell-cafe] I/O Haskell question

2009-10-05 Thread Deniz Dogan
2009/10/5 Maria Boghiu : > I get an error saying I am mismatching types IO [String] and [String]. Something of the type IO [String] is a computation which does some IO (reading files, launching nukes, etc.) and then returns a list of strings. Something of the type [String] is merely a list of stri

Re: [Haskell-cafe] Num instances for 2-dimensional types

2009-10-05 Thread Lennart Augustsson
And what is a number? Are complex numbers numbers? On Mon, Oct 5, 2009 at 3:12 PM, Miguel Mitrofanov wrote: > > > Sönke Hahn wrote: > >> I used to implement >> >>    fromInteger n = (r, r) where r = fromInteger n >> >> , but thinking about it, >>    fromInteger n = (fromInteger n, 0) >> >> seems

[Haskell-cafe] I/O Haskell question

2009-10-05 Thread Maria Boghiu
Hey. I'm trying to configure Xmonad, the window manager. for this purpose, I'm trying to read the *workspaces* variable in the code below from file. As you can see, I do workspaces = readWS where * readWS = do l <- readFile "~/bla" return l* I get an error saying I am mismatchi

Re: [Haskell-cafe] Num instances for 2-dimensional types

2009-10-05 Thread John A. De Goes
That's not gonna happen until when/if Haskell supports name/operator overloading. There's a scarcity of good symbols/function names and everyone wants to use them. So naturally, type class abuse follows. Regards, John A. De Goes N-Brain, Inc. The Evolution of Collaboration http://www.n-br

Re: [Haskell-cafe] Re: Curried function terminology

2009-10-05 Thread Daniel Fischer
Am Montag 05 Oktober 2009 11:52:17 schrieb Jon Fairbairn: > michael rice writes: > > This is from Learn You A Haskell: > > The language (in CAPS) in the above two paragraphs seems to > > be backwards. > > It is. "5 is applied to that function" should be "5 is supplied to that > function" (or that

Re: [Haskell-cafe] Num instances for 2-dimensional types

2009-10-05 Thread Miguel Mitrofanov
Sönke Hahn wrote: I used to implement fromInteger n = (r, r) where r = fromInteger n , but thinking about it, fromInteger n = (fromInteger n, 0) seems very reasonable, too. Stop pretending something is a number when it's not. ___ Has

Re: [Haskell-cafe] Num instances for 2-dimensional types

2009-10-05 Thread Job Vranish
You are in luck! Such an instance is very simple with Applicative. If the type you want a Num instance for is a member of the Applicative type class you can define it like this: instance (Num a) => Num (Vector2 a) where a + b = pure (+) <*> a <*> b a - b = pure (-) <*> a <*> b a * b = pure

[Haskell-cafe] Num instances for 2-dimensional types

2009-10-05 Thread Sönke Hahn
Hi! I often stumble upon 2- (or 3-) dimensional numerical data types like (Double, Double) or similar self defined ones. I like the idea of creating instances for Num for these types. The meaning of (+), (-) and negate is clear and very intuitive, i think. I don't feel sure about (*), abs,

Re: [Haskell-cafe] Re: dsl and gui toolkit

2009-10-05 Thread Alp Mestan
It'd be great if you could at least paste some sample lines of usage of your library. On 10/5/09, Gregor Burger wrote: > hi there, > i can't resist to post grun here! although its python based > the ideas behind are great! maybe some excellent haskell > hackers can borrow some ideas from it. > >

Re: [Haskell-cafe] Re: dsl and gui toolkit

2009-10-05 Thread Gregor Burger
hi there, i can't resist to post grun here! although its python based the ideas behind are great! maybe some excellent haskell hackers can borrow some ideas from it. http://pypi.python.org/pypi/grun/ gregor 2009/10/5 Günther Schmidt > lemme have it please! > > Günther > > > Am 05.10.2009, 12:4

[Haskell-cafe] Re: dsl and gui toolkit

2009-10-05 Thread Günther Schmidt
lemme have it please! Günther Am 05.10.2009, 12:42 Uhr, schrieb Andrew U. Frank : writing a gui is a mess (independent of wx or gtk) - too much detail is shown and not enough abstraction is done. haskell can help. i have written an experimental way of producing the GUI automatically

[Haskell-cafe] dsl and gui toolkit

2009-10-05 Thread Andrew U. Frank
writing a gui is a mess (independent of wx or gtk) - too much detail is shown and not enough abstraction is done. haskell can help. i have written an experimental way of producing the GUI automatically with a description of the semantics of the types and operations involved (a la ontology, evn

[Haskell-cafe] Re: Curried function terminology

2009-10-05 Thread Jon Fairbairn
michael rice writes: > This is from Learn You A Haskell: > > == > > "Curried functions > > Every function in Haskell officially only takes one > parameter. So how is it possible that we defined and used > several functions that take more than one parameter so far? > Well, it's a clever tr

Re: [Haskell-cafe] Is c2hs able to generate FunPtr rather than just the function?

2009-10-05 Thread Bulat Ziganshin
Hello Rafal, Monday, October 5, 2009, 9:18:30 AM, you wrote: > Is there a neat way to have c2hs generate the FunPtr version for me? from my program: -- |My callback function type type CALLBACK_FUNC = Ptr CChar -> IO CInt foreign import ccall threadsafe "wrapper" mkCALL_BACK :: CALLBACK_FU