Hello,
I'm new to this, so the only problems I see are finding a compiler
that targets the platform (ARM7, for instance, or others) and
uploading the compiled firmware to the device.
I used Hume [1] to program Mindstorms NXT robots (ARM7) as well as Tmote
Sky sensors (MSP430). In both cases I
(in my own FRP experiments I have an update thread and a render thread).
I wonder how to nicely deal with state that requires communication with
the outer world, even though it is functional at heart. For instance, if
you want to change a vertex buffer or a texture or whatever during the
update,
I did not look thoroughly at elerea, but at least, when I tried its sample
dungeons of wor it worked properly ;)
Elerea has its own 'beauty' though. I suggest unpacking the source of
dow and executing it in ghci, the problem will be obvious as you play at
length. Unfortunately, Elerea doesn't
I looked at elerea. I found it simple and nice!
I heard complaints about this two-layered solution with
SignalMonad/SignalGen, so I'm glad you like it. :)
I just regret the fact that the SignalMonad can only be run inside IO.
That's life. ;) However, there is only a single point where you have
Doesn't SignalGen replace SignalMonad in the experimental branch ? They
aren't meant to be used together, are they?
Absolutely, they are incompatible, and play the same role in the
respective versions.
But there is no notion of time, here. So how do I make sure the network
is updated with the
Time has to be an external signal?
With the Simple version, yes. With the Param (and Delayed) versions it's
pretty much like the old one, where you have to pass something (delta
time being one possibility) as an additional parameter, and all stateful
and transfer nodes will see it.
I saw dow
I that the saw sleep time at each loop is fixed (0.02). So game speed
will
depend on processor speed, since with a more powerful CPU frames will be
computed quicklier?
Yes, that's how it works.
So we don't have (with the Simple branch) some way to say I want my
sprite
to move 100 pixels
IMO: For AAA game programming? Definitely not. For exploring new ways
of doing game programming and having a lot of fun and frustration?
Sure! For making casual games? I don't know.
Why not casual games? I don't see any immediate difficulty. Do you have
any particular bad experience?
One problem with Elerea experimental branch besides the update time
control:
the memo function. I can't understand when I have to call it and when I
don't.
Technically, you never have to. However, if you have a signal derived
from others by pure application (i.e. fmap or *), keep in mind that
Hello,
Hi ! We have a question about about openAL. We would like to know if anybody
knows how to read a WAV file by chunks of a determined size, and after doing
some processing with a specific chunk send that same chunk back to the sound
card so we can play the whole WAV continiously (just
Hello all,
I created a little library that provides first-class event sources and
event stream transformers, both allowing side effects. For the time
being, the code is only available on GitHub [1]. The library is called
Moio, short for 'multiple-occurrence I/O', since event sources are
Hello all,
I wanted to create a weak pointer with an IORef as the key and something
else as the value, but I saw no way to do it through the API provided.
After some experimentation I came up with the following abomination for
a solution:
myWeakRef (IORef (STRef r)) v f =
IO $ \s - case
Is the IORef or the value in the IORef your key?
I want the IORef itself to be the key. However, that doesn't work with
optimisations turned on (the pointers get wiped out at the first gc), I
guess because they remove the box around the MutVar#. Extracting that
MutVar# seems to solve the problem.
Could mkWeakPair do what you want?
http://haskell.org/ghc/docs/latest/html/libraries/base/System-Mem-Weak.html#v:mkWeakPair
No, it's just a convenience function that doesn't help much, because the
value already refers to the IORef anyway.
Here's a minimal example to illustrate the problem:
Hello all,
Elerea is a simple pull-based FRP library, which allows you to do
stream-oriented programming using a primarily applicative style. Unlike
traditional stream-based languages, streams (which I call 'signals' in
the library) are first-class entities. I uploaded a new version with an
Hello all,
I just uploaded the fruit of a little side project. Hemkay [1] is an
oldschool module music [2] player that performs all the hard work in
Haskell. If there was any goal, it was to express the transformation
from the song structure to the output of the mixer as a series of
function
Nice work!
Thanks! :)
Did you try the OpenAL binding? Not sure if that works.
No, I haven't really looked hard, to be honest. Portaudio looked simple
enough, so I picked it. But it could be anything, since the mixing is
done on my side anyway, and all I need is a way to push (preferably
Float)
The more of these I see, the more guilt I feel over the condition of the
portaudio module. There's a good chance that the performance issue you're
seeing is a bad implementation of the portaudio library. Do you have any
specific problems you ran into with portaudio? I'd love to revisit at
Patai, I asked a similar question about a week ago, inquiring about
efficient buffers for audio. I got a good response:
http://thread.gmane.org/gmane.comp.lang.haskell.cafe/67258/focus=67293
Well, the general lesson seems to be that using stream fusion or
something analogous is the way to go.
The documentation is incomplete, but along with the example program,
it should be enough to get you going:
http://github.com/mietek/portaudio/blob/master/examples/Play.hs
Yes, it looks like something worth giving a go. I'll try it soon,
thanks.
Gergely
--
http://www.fastmail.fm - The way an
Hello again,
Your message has motivated me to publish my own PortAudio binding,
which provides a simpler, more efficient callback-based interface:
http://github.com/mietek/portaudio
I tried this, and after rewriting the code a bit, I managed to decrease
CPU load by 70-80%, which is not bad for
The most complicated I tried was to import OctaMED printout to Haskore:
http://darcs.haskell.org/haskore/src/Haskore/Interface/MED/Text.hs
http://hackage.haskell.org/packages/archive/haskore/0.1/doc/html/Haskore-Interface-MED-Text.html
Oh, I'll have to try that too!
I have a
I would do resampling (with some of the Interpolation routines) and
mixing in two steps, that is I would prepare (lazy) storable vectors
with the resampled sounds and mix them.
And is that straightforward considering the peculiarities of tracked
music? After all, frequency can change between
Hi,
I would like to write a routine like
nextPtr :: Storable a = Ptr a - Ptr a
nextPtr = (`plusPtr` sizeOf (undefined :: a))
which increments a pointer by the correct amount, but
GHC complains that the type variable a is ambiguous.
Maybe Foreign.Marshal.Array.advancePtr is
Hello all,
I did some refactoring, and separated the device independent part of
Hemkay into a package of its own, hemkay-core [1]. This is a library
that provides facilities to load MOD music and render it in various
ways, including a direct-to-buffer option that's considerably more
efficient
[1] http://hackage.haskell.org/package/hemkay-core
[2] http://hackage.haskell.org/package/hemkay
Hmm, it's a pity that they don't build on Hackage due to a conflict
between two bytestring versions -- the current and the one binary was
compiled with, I assume. It would be nice if at least the
I see no problem. I would generate a frequency and a volume control
curve for each channel and apply this to the played instrument, then I
would mix it.
Yes, that's basically what I do now: I flatten the song into a series of
play states where for each active channel I store the pointer to the
Hi,
explode [[[1,2],[3],[4,5,6]], [[1, 2], [14,15], [16]]] -- [[1,3,4],
[1,3,5],[1,3,6],[2,3,4],[2,3,5],[2,3,6],[1,14,16],[1,15,16],
[2,14,16],[2,15,16]]
I don't think the following will solve your problem, but explode can be
rewritten with existing functions thanks to the list monad:
Hello all,
I added a few new features to the experimental branch of Elerea [1], my
little FRP library. The previous release added random sources -- both
noise signals and instantaneous values within generators -- using
mersenne-random, and the current update added an extra primitive to
handle
Hello all,
I just uploaded the first public version of Dungeons of Wor [1], a
homage to the renowned three-decade-old arcade game, Wizard of Wor.
While it makes a fine time killer if you have a few minutes to spare, it
might be of special interest to the lost souls who are trying to figure
out
1) This is missing the obligatory youtube video.
That's usually handled by dons. ;)
Gergely
--
http://www.fastmail.fm - Email service worth paying for. Try it for free
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
Exciting! But on a mac, I can't get the window to become focussed
or accept input. Tips ?
I don't have a Mac, but I heard that GLFW is not without problems there,
so maybe it's the culprit this time too. Do other GLFW apps work on your
machine?
Gergely
--
http://www.fastmail.fm - IMAP
I tried it, but after briefly displaying a window, the program terminates
with the message:
dow: user error (unknown OpenGL extension entry glTexParameteri, check
for OpenGL 3.1)
I just tried it under XP, using an unaltered Haskell Platform 2009.2.0.1
(GHC 6.10.3), and it compiled and
Seems like today FRP is the last word in game programming with Haskell.
Do you know something that could be a good tutorial, or at least
introduction to FRP ? Something that could somewhat help me learn the ropes,
'cause I'm afraid if I dive directly into your code I'm gonna be lost.
I don't
I tried to compile my program with -prof, but GHC just whines at me
that the packages I'm using haven't been compiled for profiling. Do I
really need to go recompile every single package I'm using with
profiling support before I can profile my program? How do I tell Cabal
to install the
...Are hereby presented at:
http://www.ee.bgu.ac.il/~noamle/_downloads/gaccum.pdf
Comments are more than welcome.
(P.S Thanks to a whole bunch of people at #haskell for educating me about
this, but most notably Conal Elliott)
Well, my impression is that trying to unite events and
I'm not sure I want to follow WWRD all the way. I do want events, for
example mouse clicks (for which there doesn't seem to be any logical
behavior representation). As you note the pull-based approach does a
lot more work in those cases than seems necessary.
Events are indispensable for
Hello all,
I silently updated Elerea [1] to version 2 about half a month ago, which
deprecated the old interface in favour of the 'experimental' branch of
version 1. The most important change besides this swap is the addition
of the clocked variant of the library, which allows the programmer to
I don't agree. A concurrent change is the effect of an IO action, not
of the thread. For example if a concurrent thread writes to an MVar,
then that change becomes the effect of the next takeMVar, which gets
executed. If a concurrent thread changes a file on disk, then that
changing
No. As you say the world1 value is immutable, but that's not
contradictory. If between 'getLine' and 'print' something was done by a
concurrent thread, then that change to the world is captured by 'print'.
Well, that's technically true, but it basically amounts to saying that
the 'model' of
Hello all,
I'm trying to reuse as much of the sweat and tear put into GHC as
possible to derive a compiler for a language highly similar to Haskell
in many aspects. The difference is that instead of constructing an
expression of type IO (), the programmer has to provide a stream
processor on the
And it is not enough to provide just a driver function, that is called in
'main', say
run :: IOArrow a b - a - IO b
?
No, because I need to compile the stream processing program itself by a
different tool. I just want to trick GHC into doing much of the
weightlifting. No IO monad is
Not sure how this fits into what I thought you were saying. Are you
trying to use Haskell to build an AST, use GHC to optimize it, and
then spit it out and compile it with, say, a OCaml program that you
have already written?
Yes, that would be the basic idea:
1. Compile the Haskell
There are many implementations of EDSLs which take the approach that you want
to take by using Haskell to create a syntax tree and the offshore it to some
backend compiler. None of them uses a timeout.
The difference is that they implement all the transformations after the
parsing phase, and
So in the result of (a = f), the first element is taken from the
first element of applying f to the first element of a; the second
element is the second element in the result of applying f to the second
element of a; and so on. Off the top of my head I am not sure what
this corresponds to in
fromList :: [a] - SignalGen (Signal a)
fromList xs =
stateful xs tail = memo . fmap head
1) It does what I want, but is it the good way to do it?
Yes, I'd do it the same way, assuming that the input is always an
infinite list (so this version should probably be called
unsafeFromList...).
I keep on experimenting with Elerea. I'm on my way to achieve a simple
Pong
game, but the display is awfully jerky, however the sampling occurs on
average every 0,0015 sec, which gives 670 FPS.
I had a similar experience under Windows. Never really got to find out
why it happened. You might
I forgot to say: I run Ubuntu 10.10 (32bits), and I use HGL for the
graphics, not GLFW. This may be important since HGL seems to react badly
to threadDelay
Oh, HGL! The Yampa Arcade example (SpaceInvaders) suffered from the same
problem, and it was solved by adding the -threaded switch. Without
But expressions that use unsafePerformIO might get inlined.
That's true, but given the way this interface is used, this doesn't seem
to be an issue, since there are typically no unsafePerformIO's hidden
deep inside an expression without a chain of Elerea primitives leading
to it.
What about
network. Therefore, duplication and merging of identical
expressions only affects the performance unless they are
hidden in the input signal of a latcher.
But isn't the latter a fundamental problem?
Of course it is, but I said afterwards that this can be resolved by
sampling 'more
So does this mean that whether a signal is started at the
beginning or at switching time depends on what dependencies the
signal has?
No, the situation is even more complicated, since some of its
dependencies might be aged through other dependency chains, while
others can only be animated
Hello all,
I'm one of the lucky individuals accepted for this year's Summer of
Code. Here's the abstract of my proposal:
http://socghop.appspot.com/student_project/show/google/gsoc2009/haskell/t124022468245
There's less than a month left before I'm supposed to jump into coding,
and I'd love to
Hello all,
is there a function that can safely split a command line into a FilePath
to the executable and its parameters? I couldn't manage to find one. If
not, what are the pitfalls in creating a cross-platform solution to this
problem? Can I assume that the first space not within double quotes
There getArgs and getProgName in System module. If you want
parse this parameters there is System.Console.GetOpt.
Those will only tell me how my program was called. I want to work with
command lines as data within my program, which is a completely different
thing.
All the splitting, escaping
which does shell command line expansion. This might be more than you
want however as it also expands *.hs wildcards, arithmetic, quote
removal, ~user paths, $env vars and (optionally) $(command)
substitution.
I don't think I'll have to deal with very complicated cases, just more
or less static
Hello everyone,
finally there's a bit of eye candy for anyone interested in the heap
profiling project:
http://just-bottom.blogspot.com/
Feel encouraged to comment and check out the project page too, where you
can already see the beginnings of the core library.
Gergely
--
I haven't seen this blog on planet.haskell.org, but it definitely
should be! Instructions on how to have it added are on that page.
Yes, I did that not long after starting the blog. Maybe someone should
flush the queue. ;)
--
http://www.fastmail.fm - The way an email service should be
Seems pretty cool :) Will this graph be interactive during the run of
the program?
What kind of interaction do you have in mind? I intend to add at least
zooming-panning, filtering and a few different views (at least
independent cost centres like now and cumulative modes like hp2ps).
(I tried
Hi all,
I intend to start coding the UI of the heap profiling toolkit I'm
working on [1] soon. I'd be happy to get some advice on choosing the
right windowing toolkit for this task. The main requirements are:
- portability and native look feel if possible
- easy to distribute executables under
Web - HTML
I'd agree with that. It would be really nice for X-platform. Maybe
it's possible to use JQuery (or Flapjax) to get some nice
dynamic/interacitivity?
I'm not sure if a web interface is really a good fit here, but I'll
think about it.
Gergely
--
http://www.fastmail.fm - Access
Hello all,
This post is not about my own creation, it's just a little fun program
written by a student of mine. You can install the bloxorz package to try
it out, and read more about its background on my blog:
http://just-bottom.blogspot.com/2009/07/playing-and-learning.html
Gergely
--
Here's a video of bloxorz at work, very cool!
http://archhaskell.wordpress.com/2009/07/04/bloxorz-an-opengl-logic-game-written-in-haskell/
I see it wasn't rehearsed in advance. ;)
Gergely
--
http://www.fastmail.fm - The professional email service
Will the darcs (or.. ) repository for the code be made public?
I'm sure there are people in the community who'd like to contribute new
levels, etc.
I don't think there is a repository at all, and I'm not even sure if
Viktor wants to maintain it. I'll ask and direct him to the list.
Gergely
--
Will the darcs (or.. ) repository for the code be made public?
I'm sure there are people in the community who'd like to contribute new
levels, etc.
I asked him, and he said that he plans to develop it further during the
summer and make a public repo somewhere. We'll probably have to wait a
few
Hello all,
I was asked to give a one-hour 'introductory' seminar on Haskell. The
audience is a bunch of very clever people with a wider than usual
perspective on programming and mathematics, and my talk should be rather
informational than evangelistic. Which topics do you think I should
touch by
I would concentrate on the fact that when you use Haskell, you write
code that is less prone to errors and bugs. When you write a program
in Haskell and it finally compiles, chances are that there are far
less bugs than in a program written in another language
the question is how to
Hi all,
Having taken a short break from my profiling project, I updated my
little FRP library called Elerea [1] along with the runnable example
programs [2]. The interface was changed into a monadic-applicative
hybrid that distinguishes stateful and stateless combinators for safety
reasons. Since
Hi all,
It's been a while since I announced anything about the project on the
list, but I've been regularly posting about it on my blog [1]. Everyone
should feel encouraged to check out the cabalised code [2] and play with
it, stress test it. Adventurous ones can also look at the source. ;)
Hi everyone,
I finally uploaded the profiling tools to Hackage. The package names are
hp2any-{core,graph,manager}. The first two should be possible to install
right away, while the manager needs Gtk2Hs. A bit more on the project
and this update at http://just-bottom.blogspot.com.
Gergely
--
Hello all,
I'm trying to make the hp2any suite to be fully functional under
Windows, but I'm running into permission errors when I try to read the
heap profile that's still being written by its producer. Is there a way
to solve this problem without turning to the Win32 interface and having
to
Do you have an overview somewhere of the tools and how to use them?
Well, not really. While there is some basic information on the project
wiki at Google Code, it is rather outdated. So probably the blog comes
closest to that, but it also concentrates on the details. I intend to
extract the bits
Hello Jean,
If I got you right, you basically want to have a signal that changes its
value by a predetermined transform function whenever there is an edge
detected on a bool signal. In that case, it would be easier to define it
in terms of transfer:
accumIf :: a - (a - a) - Signal Bool -
or
event :: a - Signal Bool - (a - a) - SignalMonad (Signal a)
event v0 b f = accumIf v0 f = return b
?
That's not a good idea, because it doesn't take time into consideration,
so you'd jump a huge amount in every frame. What I had in mind is
something like this:
ifte :: Signal Bool -
can you explain, please ? I can't feel it when I play.
Well, the paddle moves very fast that way, and its speed depends on the
refresh rate. While the refresh rate is set in this program, it's not a
good idea to depend on it in any way. Transfer functions provide access
to the frame time, so you
I finally uploaded the profiling tools to Hackage. The package names are
hp2any-{core,graph,manager}. The first two should be possible to install
right away, while the manager needs Gtk2Hs. A bit more on the project
and this update at http://just-bottom.blogspot.com.
Do you have an
Here is my first real program in Haskell.
How come you started out with playing around with FRP libraries right
away? It's a rather peculiar choice, I'd say.
In fact, I'm not fully responsible because it's just an adapted
version of a Tetris Creighton Hogg had written for Reactive/GLUT.
As
For example, starting from
[4,3,2,6,7]
you need to find the averages of
4,3,2 and 3,2,6 and 2,6,7
resulting in
[3,4,5]
What is the most elegant way to do that?
It's probably less elegant than tails, but very likely more efficient to
keep track of running sums instead of summing
Hi everyone,
I was experimenting with simple accumulator functions, and found that an
apparently tail recursive function can easily fill the stack. Playing
around with ghc and jhc gave consistently unpleasant results. Look at
this program:
%%%
-- ghc: no, ghc -O3: yes, jhc: no
isum 0 s
Thanks everyone for the answers. I understood the underlying mechanism,
and I did see that turning on optimisation helps, as I said in the
comments. I just wasn't aware that this analysis is not turned on by
default, my bad for not reading the FM.
So the final verdict is that type and strictness
I tried your example in GHC 6.10 and isum appears to work fine.
The type of 1000 gets defaulted to Integer, a specialized version
of isum for Integer is then created, the strictness analyzer
determines that isum is strict in s, and the code generator produces a
loop. (If you want to look
Hi everyone,
I have a general program design question, but I can't really think of
good examples so it will be a bit vague. There was a discussion on Show
not long ago which brought up the problem that there are several ways to
show a data structure, and it depends on the context (or should I
As a side curiosity, I would love to see an example of any data structure
which has more than one Functor instance. Especially those which have
more than one useful functor instance.
data Record a b = R { field1 :: a, field2 :: b }
If I want to use fmap to transform either field, I have to
Hello again,
I think that I have done all of the above in different situations, and
so I don't think that there is a single correct answer. I usually
avoid using the newtype trick as I find it inconvenient: usually
the newtype does not have the same operations as the underlying type
and so
I've been wondering for a while now what a well-designed alternative
to CSS could be, where well-designed would mean consistent, composable,
orthogonal, functional, based on an elegantly compelling semantic model
(denotational).
Well, if you think about CSS as in webpage styling, it's simply a
Hello all,
I entered a little proposal in the issue tracker:
http://hackage.haskell.org/trac/summer-of-code/ticket/1570
As I see it, the graphical part could be a warm-up exercise with an
already useful product, and interaction with the rts would be the actual
challenge. Reasoning about
although with some hacks one can already have a poor mans real time
interface for heap profiling:
http://www.haskell.org/ghc/docs/latest/html/users_guide/hp2ps.html#id2677301
I'm aware of that, even did it myself a few times. That's part of the
reason why I want something better. ;)
I agree
Last Summer, I also proposed a Google SOC project for profiling,
called Parallel Profiling Support for GHC. This project was denied
for the Google SOC mostly due to the scope of the project and the
concern that the project would take far longer than the Summer.
Yes, I'm aware of that trap.
I'm not sure what your problem is. I downloaded Trac not long ago, and
Haskell highlighting worked out of the box for me after installing
Pygments. Here's the proof (this is the wiki of a course I'm teaching):
http://kfarkas.iit.bme.hu/trac/bfp/wiki/EloadasAbsztrakciok1
The code to activate it
Does ZipList have any useful monad instance? The thought came up while
thinking about higher order dataflows and an ArrowApply interface for
Yampa. As a ZipList can be thought of as a function with a discrete
domain, I figured its monadic form could be analogous to the reader
monad, hence:
Having spent several months on this exact problem, I'll say that I
consider it pretty unlikely.
I wouldn't be very surprised if that was the case.
A clever data structure might give you logarithmic or even amortized
constant time access in sequential cases, but you probably will not have
Yes, although you should use an actual infinite list type if you're
depending on that.
I know, I just wanted to stick with the basic list type for the sake of
the discussion.
In fact, the Stream package provides an infinite list type with
Applicative and Monad instances.
I didn't know that,
For instance, if we consider just join, with the above definition:
join [[1,2],[3]] = [1, _|_]
Which, I think, is fairly undesirable. You can try to avoid bottoms like
so:
Well, there is a trick you can use here: wrap everything in a Maybe. Not
that it helps with the efficiency issue,
And just as IO is unnecessary for behavior (functions of time), it's also
unnecessary for imagery (functions of space). Continuing with the
functional (non-IO) theme, you can give a semantically precise,
composable and simple type of images.
Yes, that's a further separation of concerns.
Interesting. I'm testing it on Window though. You're using Linux? Maybe
the scheduling is different.
Now I tried it on Windows in VirtualBox, and it still looks quite smooth
to me (except that hardware acceleration doesn't seem to work properly
through virtualisation, but it's okay as long as I
I wonder if this breaks referential transparency. Say, you define a signal
s and use s twice in some expression. s may be evaluated once and it
maybe evaluated twice. Does this make a difference?
I'm not sure about the answer at the moment, but I believe we'd simply
get two identically behaving
I don't think using dirty tricks to implement FRP deserves
flak, at all, from my POV, it sounds like complaining that the
IO monad is implemented using C... meaning that if you're that
close to bare thunks, you have every right to use any means
necessary to make them behave properly.
I will test it on a couple of machines, desktops and laptops.
Try using a sensible nonzero value with threadDelay. Apparently it
brings CPU usage down under Windows while retaining smoothness. However,
increasing it from zero results in jerkiness under Linux...
If you take a look what Yampa
On the other hand, I hadn't got round to cleaning up the interface,
let alone firming the theoretical foundations, so perhaps this isn't an
exception to your rule?-) But I thought I'd mention it on the topic of
other FRP libraries, with variations of approach/concepts.
Thanks for the
On the other hand, breaking referential transparency in the
external interface is a very bad idea, in my opinion. Actually,
this means that the library user would have to turn certain
compiler optimizations off to get the intended behavior.
However, in practice you can compile Elerea with -O2
I end up doing
:set -i../Documents/haskell/SOE/src
To set the search directory so that ghci can find the source.
I've not been how to tailor that 'cd' which is run at start
up (but I've not looked to hard)
It is looking for the closest ancestor directory with a file ending in
.cabal,
1 - 100 of 103 matches
Mail list logo