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_FUNC
michael rice nowg...@yahoo.com 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
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,
lemme have it please!
Günther
Am 05.10.2009, 12:42 Uhr, schrieb Andrew U. Frank
fr...@geoinfo.tuwien.ac.at:
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
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 gue.schm...@web.de
lemme have it please!
Günther
Am
It'd be great if you could at least paste some sample lines of usage
of your library.
On 10/5/09, Gregor Burger burger.gre...@gmail.com 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
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 (*),
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 (*) * a
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.
___
Am Montag 05 Oktober 2009 11:52:17 schrieb Jon Fairbairn:
michael rice nowg...@yahoo.com writes:
This is from Learn You A Haskell:
snip
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
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
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 mismatching
And what is a number? Are complex numbers numbers?
On Mon, Oct 5, 2009 at 3:12 PM, Miguel Mitrofanov miguelim...@yandex.ru 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)
2009/10/5 Maria Boghiu maria.bog...@gmail.com:
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
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
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;
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
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
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 introduced
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)
2009/10/5 Michael Mossey m...@alumni.caltech.edu:
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
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 deniz.a.m.do...@gmail.com wrote:
2009/10/5 Maria Boghiu maria.bog...@gmail.com:
I get an error saying I am mismatching types IO [String] and [String].
Something
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 jon.fairba...@cl.cam.ac.uk wrote:
From: Jon
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
a
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
On Mon, Oct 5, 2009 at 9:48 AM, Maria Boghiu maria.bog...@gmail.com 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 -
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
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
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.
___
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
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 miguelim...@yandex.ru wrote:
Lennart Augustsson wrote:
And what is a number?
Can't say. You know, it's kinda funny to ask a biologist what it
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 particular pattern
On Mon, Oct 5, 2009 at 10:36 AM, Miguel Mitrofanov
miguelim...@yandex.ru 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
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 brad.lar...@gmail.com wrote:
On Mon, Oct 5, 2009 at 10:36 AM, Miguel Mitrofanov
miguelim...@yandex.ru wrote:
[...]
Of course, it's OK to call
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 just
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 class
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 the
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
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
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
int :: Int -
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,
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
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 preferably
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
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
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
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
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 Num if you
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:
patch-tag I
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'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
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
think.
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)
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
value,
2009/10/5 Don Stewart d...@galois.com:
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
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
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 care...@mcmaster.ca:
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.
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
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 types. The
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 the
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 $
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
On Sat, Oct 3, 2009 at 1:57 AM, Duncan Coutts
duncan.cou...@googlemail.comwrote:
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
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.
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.
2009/10/5 Robert Atkey bob.at...@ed.ac.uk:
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
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
On Mon, Oct 5, 2009 at 7:56 PM, Floptical Logic flopticalo...@gmail.com 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
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
type to PDState m type to make them all polymorphic over the
choice of monad. Then all you should need to do is to
Hi Paul,
Paul Moore p.f.moore at 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
Robert Atkey bob.at...@ed.ac.uk 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
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*
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 - repr int - repr
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
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,
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
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) = m a
On Mon, Oct 5, 2009 at 10:54 PM, Floptical Logic
flopticalo...@gmail.com 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
On Mon, Oct 5, 2009 at 11:54 PM, Floptical Logic
flopticalo...@gmail.com 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
Don Stewart d...@galois.com 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
80 matches
Mail list logo