Achim Schneider | 1 Jun 01:40 2008
Picon

Re: Images and GUIs in Haskell

"Ronald Guida" <oddron <at> gmail.com> wrote:

> Two questions:
> 
> 1. In a Haskell program, if all I want to do is output an image, like
> a graph or chart, what is the simplest library to use?
> 
> N.B. Simpler := easier to get minimal functionality. I really don't
> want to wade through a bunch of boilerplate or climb a steep learning
> curve just to be able to plot a few lines or circles.
> 
> 2. Suppose I want interactivity.  For example, I want to plot a line
> graph, and then let the user click and drag the data points.  From
> what I understand about GUIs, I would need to track mouse buttons (up
> and down), mouse movements, and possibly keystrokes.  (I know this is
> the complete opposite extreme from my first question)
> 
> In this case, what would be the best (not necessarily simplest)
> library to use?  What would you recommend?
>
http://hackage.haskell.org/packages/archive/pkg-list.html#cat:Graphics
or
Gnuplot

YMMV.

--

-- 
(c) this sig last receiving data processing entity. Inspect headers for
past copyright information. All rights reserved. Unauthorised copying,
hiring, renting, public performance and/or broadcasting of this
(Continue reading)

Ronald Guida | 1 Jun 03:00 2008
Picon

Re: Re: Images and GUIs in Haskell

I wrote:
> 1. In a Haskell program, if all I want to do is output an image, like
> a graph or chart, what is the simplest library to use?

Achim Schneider wrote:
> http://hackage.haskell.org/packages/archive/pkg-list.html#cat:Graphics

OK, Chart (the first package under Graphics) is obviously the answer to (1).

I wrote:
> 2. Suppose I want interactivity.  For example, I want to plot a line
> graph, and then let the user click and drag the data points.  ...
> the complete opposite extreme from my first question

So I have a choice: OpenGL, HGL, SDL, ObjectIO(?), or even straight X11/Win32 :/
Let me ask both ways:

2a. Which of these (or perhaps something else) is the simplest/easiest
to get started with?

2b. Could someone please point me to some advice to help me decide
which of these would be the best for me to use.  I'm just trying to
avoid the need to invest gobs of time into investigating libraries.
Achim Schneider | 1 Jun 04:09 2008
Picon

Re: Images and GUIs in Haskell

"Ronald Guida" <oddron <at> gmail.com> wrote:

> So I have a choice: OpenGL, HGL, SDL, ObjectIO(?), or even straight
> X11/Win32 :/ Let me ask both ways:
> 
> 2a. Which of these (or perhaps something else) is the simplest/easiest
> to get started with?
> 
> 2b. Could someone please point me to some advice to help me decide
> which of these would be the best for me to use.  I'm just trying to
> avoid the need to invest gobs of time into investigating libraries.

I would go for GL(U(T)), as it's as good for 2d primitives as SDL will
ever be, has excellent cross-platform support and allows you to go 3d
if you want to. There's also some very decent event handling.

--

-- 
(c) this sig last receiving data processing entity. Inspect headers for
past copyright information. All rights reserved. Unauthorised copying,
hiring, renting, public performance and/or broadcasting of this
signature prohibited. 
Daniel Gorín | 1 Jun 04:54 2008
Picon

Re: hint / ghc api and reloading modules

(Since this can be of interest to those using the ghc-api I'm cc-ing  
the ghc users' list.)

Hi, Evan

The odd behavior you spotted happens only with hint under ghc-6.8. It  
turns out the problem was in the session initialization.

Since ghc-6.8 the newSession function no longer receives a GhcMode.  
The thing is that, apparently, if one was passing the Interactive  
mode to newSession under ghc-6.6, now you ought to set the ghcLink  
dynflag to LinkInMemory instead.

I couldn't find this documented anywhere (except for this patch  
http://www.haskell.org/pipermail/cvs-ghc/2007-April/034974.html) but  
it is what ghci is doing and after patching hint to do this the  
reloading of modules works fine.

I'll be uploading a fixed version of hint to hackage in the next days.

Thanks,
Daniel

On May 31, 2008, at 2:46 PM, Evan Laforge wrote:

> I'm using "hint", but since it's basically a thin wrapper around the
> GHC API, this is probably a GHC api question too.  Maybe this should
> go to cvs-ghc?  Let me know and I'll go subscribe over there.
>
> It's my impression from the documentation that I should be able to
(Continue reading)

Anatoly Yakovenko | 1 Jun 05:59 2008
Picon

Re: hmatrix

http://perception.inf.um.es/~aruiz/darcs/hmatrix/doc/html/Data-Packed-Vector.html
provided by hmatrix

On Sat, May 31, 2008 at 3:20 PM, Thomas Hartman <tphyahoo <at> gmail.com> wrote:
> what package do you install/import to get at Vector?
>
> 2008/5/31 Thomas Hartman <tphyahoo <at> gmail.com>:
>> what package do you install/import to get at Vector?
>>
>> 2008/5/31 Anatoly Yakovenko <aeyakovenko <at> gmail.com>:
>>> What is the most efficient way to update a position in a matrix or a
>>> vector?  I came up with this:
>>>
>>> updateVector :: Vector Double -> Int -> Double -> Vector Double
>>> updateVector vec pos val = vec `add` v2
>>>   where
>>>      v2 = fromList $ (replicate (pos) 0.0) ++ ((val - (vec  <at> >
>>> pos)):(replicate ((dim vec)- pos - 1) 0.0))
>>>
>>> but this seems pretty inefficient to me.
>>>
>>> thanks,
>>> Anatoly
>>> _______________________________________________
>>> Haskell-Cafe mailing list
>>> Haskell-Cafe <at> haskell.org
>>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>>
>>
>
(Continue reading)

Bertram Felgenhauer | 1 Jun 06:29 2008

Re: type-level integers using type families

Peter Gavin wrote:
> Roberto Zunino wrote:
>> Maybe he wants, given
>>   cond :: Cond x y z => x -> y -> z
>>   tt :: True
>>   true_exp  :: a
>>   false_exp :: <<<untypable>>>
>> that
>>   cond tt true_exp false_exp :: a
>> That is the type of false_exp is "lazily inferred", so that type errors
>> do not make inference fail if they show up in an unneeded place.
>
> Yes, that's exactly what I want, but for type families (not MPTC). I think 
> it could be done if the type arguments were matched one at a time, across 
> all visible instances.

What do you think of the following idea?

Using naive type level natural numbers,

> data Zero
> newtype Succ a = Succ a

Booleans,

> data True
> data False

comparison,

(Continue reading)

Thomas M. DuBuisson | 1 Jun 08:11 2008
Picon

[ANN] Bindings to Xen Control (xenctrl.h)

All,
I'm just getting started with hsXenCtrl [1] as both a fun way to play
with Xen and become proficient with Haskell FFI.  Once I get my
community.haskell.org account squared away I'll likely setup a public
darcs repo (and a homepage somewhere).

As for modules: I intend to expand on the trival FFI bindings in
System.Xen.CBindings and there'll be a higher level interface in
System.Xen (functions will standardize on returning Either or throwing
exceptions, hiding the xc_handle open/close, etc).

Typical Disclaimers:
The _only_ thing I've actually done with this, just tonight, is pause /
unpause domains.  API is subject to change!  Only my exact build of Xen
is sure to work, and no promise even then.

TomMD

[1] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hsXenCtrl
Don Stewart | 1 Jun 08:31 2008

Re: [ANN] Bindings to Xen Control (xenctrl.h)

thomas.dubuisson:
> All,
> I'm just getting started with hsXenCtrl [1] as both a fun way to play
> with Xen and become proficient with Haskell FFI.  Once I get my
> community.haskell.org account squared away I'll likely setup a public
> darcs repo (and a homepage somewhere).
> 
> As for modules: I intend to expand on the trival FFI bindings in
> System.Xen.CBindings and there'll be a higher level interface in
> System.Xen (functions will standardize on returning Either or throwing
> exceptions, hiding the xc_handle open/close, etc).
> 
> Typical Disclaimers:
> The _only_ thing I've actually done with this, just tonight, is pause /
> unpause domains.  API is subject to change!  Only my exact build of Xen
> is sure to work, and no promise even then.
> 
> TomMD
> 
> [1] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hsXenCtrl

Good stuff. Perhaps the synopsis should include a link or description of
the typical use cases/ thinks we might achieve?

-- Don
apfelmus | 1 Jun 09:37 2008
Picon

Re: appending an element to a list

Tillmann Rendel wrote:
> Abhay Parvate wrote:
>> I think I would like to make another note: when we talk about the complexity
>> of a function, we are talking about the time taken to completely evaluate
>> the result. Otherwise any expression in haskell will be O(1), since it 
>> just creates a thunk.
> 
> I don't like this notion of complexity, since it seems not very suited 
> for the analysis of composite expression in Haskell.
> 
> Is this intuitive view generalizable to arbitrary datatypes (instead of 
> lists) and formalized somewhere?

See also the thread section beginning with

   http://thread.gmane.org/gmane.comp.lang.haskell.cafe/34398/focus=34435

Regards,
apfelmus
Galchin, Vasili | 1 Jun 10:00 2008
Picon

Re: modelling C in Haskell ..

my knowledge of point-free is from category theory. in what sense is Haskell point-free handle namespace pollution?

Kind regards, Vasili

On Fri, May 30, 2008 at 3:23 AM, Jonathan Cast <jonathanccast <at> fastmail.fm> wrote:
On 30 May 2008, at 12:29 AM, Galchin, Vasili wrote:

compactness in writing and also namespace pollution .. ;^)

I know what the advantages of C's notation are.  But getting the best notation out of Haskell generally doesn't happen by trying to make your code look like C.

So the general answer to questions of the form `C can do x; can Haskell' is `No'.  Don't do it like in C.  It won't be idiomatic, it won't be elegant, and neither of us will like the results.  Understand the features of Haskell that make your program compact, point-free (how Haskell handles namespace pollution), and elegant and use those.  This will require a different factoring of your program vs. C.  Sorry, but that's life.

jcc


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Gmane