Here is a sketch for a library with these properties:
-> Easy to test. All Haskell code can be tested in a text
terminal. Also, testing code that uses the library can also be
done without using a GUI.
-> Extremely easy to document and use.
-> Not even close to Gtk2hs power, but enough for small
applications.
-> Could be the first GUI to build on hackage :)
What we need is:
-> MyState. A user suplied type for application state.
-> WidId. A user suplied type for widget identifiers.
-> Gui wi. A type capable of describing an interface with all of
its state. It's an instance of Eq.
-> Event wi. A type for events.
-> Prop. A type for properties than can related to a WidId.
Running an application would be like this:
main = runGUI
initState -- An initial MyState.
event -- :: MyState -> DiffTime -> Event WidId -> MyState
props -- :: WidId -> [Prop]
action -- :: MyState -> DiffTime -> IO (Maybe (MyState,Gui WidId))
timeout -- :: DiffTime
DiffTime parameters for callbacks are always the time elapsed
since application started.
From initState and event, the implementation of runGUI can save a
state that optionally changes with time.
From props, it can get details on what to present in widgets
associated with a WidId (selected state, picture to draw etc.).
action presents a chance for using IO, and optionally change state
and GUI description.
timeout is the maximum time runGUI implementation is allowed to
wait between calls to action.
Examples for those types:
newtype MyState = {
lastUpdate :: DiffTime,
builtGui :: Bool,
earthCoordinates :: (Double,Double),
map :: SVG,
...
}
data WidId = XCoord | YCoord | MapWindow | ReloadButton ...
data Gui widid = TitleWindow (Gui widid)
| Tabs [(String,Gui widid)]
| PressButton String widid
| Selection [String] widid
| ...
deriving Eq
{-
Eq is needed by runGUI to detect if GUI has
changed after the last call to action.
-}
data Event widid = ButtonPressed widid
| FileSelected String widid
| OptionSelected String widid
| ...
data Prop widid = Active Bool
| Text String
| Draw SVG
| ...
I believe this can represent most kinds of simple applications,
and be efficient enough for practical use.
It's interesting that all of this can be designed, implemented and
tested independent of runGUI implementation. Actually, if you want
a pet project and want to write and design the Haskell part, I may
probably be able to write runGUI for you :)
Best,
Maur�cio
_______________________________________________
Haskell-Cafe mailing list
Haskel...@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
This is an imperative style library. For more Haskellian GUI library
ideas, see Fruit (http://www.haskell.org/fruit/) and TVs
(http://www.haskell.org/haskellwiki/TV). They may not pass the
"builds" constraint :-P
Luke
2009/11/22 Maur�cio CA <mauricio...@gmail.com>:
2009/11/22 Luke Palmer <lrpa...@gmail.com>:
martin
Sure, just let me know :)
If this is to be done, I think it's better that the person writing
the Haskell code do not write runGUI, so the implementation
details wouln't discourage ideas that make life easier for users.
> This is an imperative style library. For more Haskellian GUI
> library ideas, see Fruit (http://www.haskell.org/fruit/) and TVs
> (http://www.haskell.org/haskellwiki/TV). They may not pass the
> "builds" constraint :-P
I do remember looking at TVs and also Fudgets as sugested by
Keith.
But there's a unfilled hole for a library that's conceptually
simple. I believe that with the library I described users
(begginers in Haskell?) could even use QuickCheck and HUnit with
their GUI code.
Thanks for your comments,
> -> Could be the first GUI to build on hackage :)
If you have wxWidgets installed, the new fully Cabalised wxHaskell
builds just fine. It's quite handy/refreshing for 'cabal install wx' to
finally "just work" :-)
Unless you mean "build on the Hackage server" which should also be
possible in principle, although the wxHaskell folks may want to have
a quick look at
http://hackage.haskell.org/packages/archive/wxcore/0.12.1.2/logs/failure/ghc-6.10
--
Eric Kow <http://www.nltg.brighton.ac.uk/home/Eric.Kow>
PGP Key ID: 08AC04F9
I'm currently reading The Haskell Road to Logic, Maths and Programming and
having a lot of (geek) fun. By the way, i found this:
http://www.mail-archive.com/haskel...@haskell.org/msg45406.html . It was
sent by Mattias Bengtsson. I made something similar using Ruby's Treetop,
with the difference that my concern was to validate and generate truth
tables for formulas using Unicode.
So... my first noob question to the list: What is the difference of Unicode
support in HUGS and GHCI ? In GHCI I can do something like:
(∧) = (&&)
Prelude> True ∧ False
*False*
(The carachter is the unicode for conjunction U+2227)
But in HUGS i can't. It says:
ERROR "conjunction.hs":1 - Unrecognised character `\8743'
Somebody?
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
>
> iEYEARECAAYFAksKqZgACgkQBUrOwgisBPmGBQCfRnW1dcLV3JaLi2p5PppsO+XK
> 7uwAoMVhCV00sdNctgAjw2TyQGs6TyNv
> =tnXa
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskel...@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
--
Juan Maiz Lulkin Flores da Cunha
---------------------------------------------------------------------------
Softa Consultoria para Desenvolvimento
http://www.softa.com.br
http://www.mailee.me - Finalmente e-mail marketing 2.0
http://www.linkedin.com/in/juanmaiz
http://workingwithrails.com/recommendation/new/person/9354-juan-maiz
“The most exciting breakthroughs of the 21st century will not occur because
of technology but because of an expanding concept of what it means to be
human”
John Naisbitt
Monday, November 23, 2009, 7:01:39 PM, you wrote:
> But in HUGS i can't. It says:
> ERROR "conjunction.hs":1 - Unrecognised character `\8743'
hugs doesn't accept unicode source files
there are lots of unicode support problems in both haskell
implementations. probably we have some wiki page what describes current
state
--
Best regards,
Bulat mailto:Bulat.Z...@gmail.com
And well, tha's bad, i've really enjoyed Hugs, but i'll have to use GHC
instead :D
Thanks.
On Mon, Nov 23, 2009 at 2:14 PM, Bulat Ziganshin
<bulat.z...@gmail.com>wrote:
> Hello Juan,
>
> Monday, November 23, 2009, 7:01:39 PM, you wrote:
>
> > But in HUGS i can't. It says:
> > ERROR "conjunction.hs":1 - Unrecognised character `\8743'
>
> hugs doesn't accept unicode source files
>
> there are lots of unicode support problems in both haskell
> implementations. probably we have some wiki page what describes current
> state
>
> --
> Best regards,
> Bulat mailto:Bulat.Z...@gmail.com
>
>
--
Juan Maiz Lulkin Flores da Cunha
---------------------------------------------------------------------------
Softa Consultoria para Desenvolvimento
http://www.softa.com.br
http://www.mailee.me - Finalmente e-mail marketing 2.0
http://www.linkedin.com/in/juanmaiz
http://workingwithrails.com/recommendation/new/person/9354-juan-maiz
�The most exciting breakthroughs of the 21st century will not occur because
of technology but because of an expanding concept of what it means to be
human�
John Naisbitt
Supporting cross platform guis is often a bit ... complicated. Java attempted to resolve their debug-everywhere nightmare with AWT by making the per-platform bit as small as possible, and building everything else in Java.
I guess in theory gtk and wxWidgets take on this support burden, but you do get some fairly hefty imperative apis as a result. Perhaps it would make sense to focus efforts on stabilising a small 'core gui' library that can act as the foundation stone for all manner of pure haskell gui libraries?*
Or perhaps this already exists?
Just a thought.
Cheers,
Sam
I believe the plan I sugested in the begining of the thread could
be easily made into what you want. It could not be, however, as
powerfull as the mainstream libraries.
Maur�cio
See my proposal here:
http://www.reddit.com/r/haskell_proposals/comments/9w7nk/adjust_the_swt_binding_generators_for_haskell/
Sam Martin <sam.m...@geomerics.com> hat am 23. November 2009 um 19:04
geschrieben: