Re: [Haskell-cafe] GSoC proposal

2009-04-02 Thread minh thu
2009/4/2 Csaba Hruska csaba.hru...@gmail.com:
 Abstract:
 The objective of this project is to create a useful, fast and feature rich
 3D rendering engine in Haskell which supports advanced rendering features
 like level of detail, material state sorting, geometry instancing, scene
 handling, fast vertex buffer handling and so on. This would be beneficial
 for various applications, e.g. AI or virtual reality environments,
 simulation, games, and scientific applications.
 Current version available at http://code.google.com/p/lambdacube/
 Content:

 == Project Overview ==

 This project aims to be the first general purpose 3D rendering engine
 written in a pure functional language. There is no graphics library
 available for Haskell that would be suitable as a basis for a complex
 graphical program. My Haskell rendering engine (called Lambda Cube
 Engine) uses the same model and material format as Ogre3D
 (http://www.ogre3d.org). This choice is motivated by the fact that
 Ogre3D has well-designed mesh model and material formats, and it also
 provides exporter plugins for nearly every significant 3D modeling
 software (3DS-Max, Maya, XSI, Blender etc.). This design decision lets
 us reuse existing 3D content and Ogre3D exporter plugins with ease. My
 knowledge of the Ogre3D architecture will help in making correct
 design decisions during development.

 = Current State =

 The source code is surprisingly small considering the current feature
 list. The program consists of 9 small Haskell modules and 2 script
 scanner description files. It can load a model from Ogre XML format
 and it parses the material definition scripts. It prevents model and
 material duplication using a cache. However, the features implemented
 are still just a subset of what these files can describe.

 Here is a list of (mainly) partially working features:
  - mesh loading from XML file
  - parsing material script (see its format:
   http://www.ogre3d.org/docs/manual/manual_14.html#SEC23)
  - caching loaded data
  - loading resource files from zip archive or filesystem
  - rendering data

 There is already an example available, which demonstrates all listed
 features. The example also uses Yampa FRP (Functional Rective
 Programming) library.

 One of the core ideas of the design was separating the high and
 low-level data representations. The high-level representation provides
 a convenient interface for the user and the low-level representation
 ensures efficient rendering on hardware.

 The Lambda Cube Engine depends on some (platform independent)
 libraries:
  - OpenGL binding
  - uulib - Utrecht Parser Combinator library used for script parsing
  - HXT - Haskell XML Toolkit is used for reading XML representation of
   mesh files. There is a more efficient binary version of the mesh
   format that will be supported later.
  - zip-archive - used for loading files from zip files. This helps
   decerase the number of media files.
  - stb-image - this is a temporary solution to support loading various
   image files. A more professional freeimage (freeimage.sf.net)
   loader is planned later.

 = Goals for the Summer =

 Fortunately the current state of the engine is advanced enough to
 start adding some more interesting functionality, such as:

  - Skeletal Animation
   This covers keyframe animation of objects. With skeletal animation
   we can create a very dynamic and alive environment (e.g. walking
   people). Outcome: interpolation function (spline), vertex buffer
   update functions

  - Level Of Detail support
   This is required for good performance and it is a very commonly
   used technique. With this feature we will be able to build
   high-complexity scenes. Outcome: vertex buffer switcher function in
   render pipeline.

  - Shadow Mapping (shadow support)
   Shadows are very a basic requirement of a modern 3D
   application. Shadow mapping is a technique that fits modern
   graphics hardware. Outcome: changes in the render function.

  - Post Processing Effects support (e.g. Motion Blur, HDR)
   This is a relatively new technique. It is widely used in present
   games because it increases visual quality very much.
   Outcome: compositor script parser functions. Some changes in the
   render function.

  - Particle System support
   Particle systems are used to create nice effects like explosions,
   rain, smoke. This is also a very basic technique of computer
   graphics. Outcome: particle system parser functions.

  - Optimization function for rendering
   It is required to minimize the state changes of graphical hardware
   during the rendering process to get top performance. This is one
   of the most important parts of a rendering engine. A well-chosen
   ordering of rendering batches could increase the performance
   considerably. Outcome: a new low-level (incremental) data structure
   and an update function for it.

  - The most interesting planned feature and possibly the most
   difficult one is the mesh modifier 

[Haskell-cafe] Re: ANNOUNCE: vacuum-cairo: a cairo frontend to vacuum for live Haskell data visualization

2009-04-02 Thread Gleb Alexeyev

Don Stewart wrote:

Did you use hubigraph?

http://ooxo.org/hubigraph/

This cabalized project doesn't appear to be on hackage!


Oh, I wasn't aware of hubigraph until now.
Ubigraph has very simple XML-RPC-based API so I used it directly. 
Hubigraph, of course, looks nicer with its custom monad, datatypes for 
shapes etc.


BTW, it seems that you didn't notice the complete source code attached 
to my first message. Like I said it's just a quick and dirty hack, all 
real job is done by vacuum, Ubigraph server and a bit of code 
copy-pasted from vacuum-cairo.


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GSoC proposal

2009-04-02 Thread Csaba Hruska
2009/4/2 minh thu not...@gmail.com

 2009/4/2 Csaba Hruska csaba.hru...@gmail.com:
  Abstract:
  The objective of this project is to create a useful, fast and feature
 rich
  3D rendering engine in Haskell which supports advanced rendering features
  like level of detail, material state sorting, geometry instancing, scene
  handling, fast vertex buffer handling and so on. This would be beneficial
  for various applications, e.g. AI or virtual reality environments,
  simulation, games, and scientific applications.
  Current version available at http://code.google.com/p/lambdacube/
  Content:
 
  == Project Overview ==
 
  This project aims to be the first general purpose 3D rendering engine
  written in a pure functional language. There is no graphics library
  available for Haskell that would be suitable as a basis for a complex
  graphical program. My Haskell rendering engine (called Lambda Cube
  Engine) uses the same model and material format as Ogre3D
  (http://www.ogre3d.org). This choice is motivated by the fact that
  Ogre3D has well-designed mesh model and material formats, and it also
  provides exporter plugins for nearly every significant 3D modeling
  software (3DS-Max, Maya, XSI, Blender etc.). This design decision lets
  us reuse existing 3D content and Ogre3D exporter plugins with ease. My
  knowledge of the Ogre3D architecture will help in making correct
  design decisions during development.
 
  = Current State =
 
  The source code is surprisingly small considering the current feature
  list. The program consists of 9 small Haskell modules and 2 script
  scanner description files. It can load a model from Ogre XML format
  and it parses the material definition scripts. It prevents model and
  material duplication using a cache. However, the features implemented
  are still just a subset of what these files can describe.
 
  Here is a list of (mainly) partially working features:
   - mesh loading from XML file
   - parsing material script (see its format:
http://www.ogre3d.org/docs/manual/manual_14.html#SEC23)
   - caching loaded data
   - loading resource files from zip archive or filesystem
   - rendering data
 
  There is already an example available, which demonstrates all listed
  features. The example also uses Yampa FRP (Functional Rective
  Programming) library.
 
  One of the core ideas of the design was separating the high and
  low-level data representations. The high-level representation provides
  a convenient interface for the user and the low-level representation
  ensures efficient rendering on hardware.
 
  The Lambda Cube Engine depends on some (platform independent)
  libraries:
   - OpenGL binding
   - uulib - Utrecht Parser Combinator library used for script parsing
   - HXT - Haskell XML Toolkit is used for reading XML representation of
mesh files. There is a more efficient binary version of the mesh
format that will be supported later.
   - zip-archive - used for loading files from zip files. This helps
decerase the number of media files.
   - stb-image - this is a temporary solution to support loading various
image files. A more professional freeimage (freeimage.sf.net)
loader is planned later.
 
  = Goals for the Summer =
 
  Fortunately the current state of the engine is advanced enough to
  start adding some more interesting functionality, such as:
 
   - Skeletal Animation
This covers keyframe animation of objects. With skeletal animation
we can create a very dynamic and alive environment (e.g. walking
people). Outcome: interpolation function (spline), vertex buffer
update functions
 
   - Level Of Detail support
This is required for good performance and it is a very commonly
used technique. With this feature we will be able to build
high-complexity scenes. Outcome: vertex buffer switcher function in
render pipeline.
 
   - Shadow Mapping (shadow support)
Shadows are very a basic requirement of a modern 3D
application. Shadow mapping is a technique that fits modern
graphics hardware. Outcome: changes in the render function.
 
   - Post Processing Effects support (e.g. Motion Blur, HDR)
This is a relatively new technique. It is widely used in present
games because it increases visual quality very much.
Outcome: compositor script parser functions. Some changes in the
render function.
 
   - Particle System support
Particle systems are used to create nice effects like explosions,
rain, smoke. This is also a very basic technique of computer
graphics. Outcome: particle system parser functions.
 
   - Optimization function for rendering
It is required to minimize the state changes of graphical hardware
during the rendering process to get top performance. This is one
of the most important parts of a rendering engine. A well-chosen
ordering of rendering batches could increase the performance
considerably. Outcome: a new low-level (incremental) data 

[Haskell-cafe] Re: [Haskell-beginners] Re: making translation from imperative code

2009-04-02 Thread Michael Mossey
Thanks very much for the help... I will look at this over the next couple of 
days. Your code actually addresses a different problem, the one of merging 
separates lists of timed events. I do need to write code to do that eventually, 
so I will try to understand what you have written here. However, the original 
problem concerns visual layout, which actually takes place *after* creating a 
merged list. In layout, items do have times associated with them, but also take 
up physical space. Different items takes up different amounts of space, and at 
any given time, there may be items on all the staves or  just some of them. I 
will try to come up with


(1) a more succinct explanation of the problem (with textual graphics as a 
visual aid)


(2) a more succinct algorithm.

For example, you are right that I'm mixing concerns. The system layout can 
terminate for two reasons: (1) reached the end of the score (2) reached the 
right edge of the page. There might be a way to simplify the loop or fold so 
that these concerns look more unified.


-Mike

PS a question below:

Heinrich Apfelmus wrote:

Michael Mossey wrote:

Heinrich Apfelmus wrote:

Can you elaborate on what exactly the algorithm is doing? Does it just
emit notes/chords/symbols at given positions or does it also try to
arrange them nicely? And most importantly, where does it emit them to,
i.e. what's the resulting data structure?

So far, the problem looks like a basic fold to me.

Here is some Haskell code that explains the problem in
more detail.
[...]


Thanks for the elaboration.

I think the code doesn't separate concerns very well; mixing information
about widths and times, page size and the recursion itself into one big
gnarl.

Also, there is one important issue, namely returning a special value
like -1 as error code in


 tryAgain state =
   case scoreNextTime score (time state) of
-1 - indicateNoMoreChunks state
 t - layoutSystem' (setTime state t)


Don't do this, use  Maybe  instead

tryAgain state = case scoreNextTime score (time state) of
Nothing - indicateNoMoreChunks state
Just t  - layoutSystem' (state { time = t })

where  Nothing  indicates failure and  Just  success.


Back to the gnarl in general, I still don't have a good grasp on the
problem domain, which is key to structuring the algorithm. Therefore,
I'll expand on toy model and you tell me how it differs from the real thing.

The model is this: we are given several lists of notes (f.i. a piano
part and a vocal line) where each note is annotated with the time it is
to be played at. We abstract away the fact that we are dealing with
musical notes and simply consider a list of *events*

type Time = Integer
type Events a = [(Time, a)]

with the invariant that the timestamps are (strictly) increasing:

valid :: Events a - Bool
valid xs = all $ zipWith (\(t1,_) (t2,_) - t1  t2) xs (drop 1 xs)

Now, the toy task is to merge several lists of similar events into one
big list that is ordered by time as well.

merge :: [Events a] - Events [a]

Since some events may now occur simultaneously, the events of the
results are actually lists of primitive events.

One possibility for implementing  merge  is to start with a function to
merge two event lists

merge2 :: Events [a] - Events [a] - Events [a]
merge2 [] ys = ys
merge2 xs [] = xs
merge2 xs@((tx,x):xt) ys@((ty,y):yt) = case compare tx ty of
  LT - (tx,x   ) : merge2 xt ys
  EQ - (tx,x++y) : merge2 xt yt
  GT - (ty,   y) : merge2 xs yt

and to apply it several times

merge = foldr merge2 [] . map lift
where lift = map $ \(t,x) - (t,[x])


Another possibility is to simply concatenate everything first and then
sort by time

merge = map (\((t,x):xs) - (t,x:map snd xs))
  . groupBy ((==) `on` fst)
  . sortBy (comparing fst)
  . concat


The code above can be made more readable by choosing nice names like

   time  = fst
   event = snd

or avoiding pairs altogether and implementing these names as record
fields. Also, the () combinator from  Control.Arrow  is very handy.

   merge = map (time . head  map event)
 . groupBy ((==) `on` time)
 . sortBy  (comparing time)
 . concat


I hope this gives you a few ideas to think about. How does this toy
model differ from the real thing?


Regards,
apfelmus


PS: If some parts of my example code give you trouble, it's probably
fastest to ask around on the #haskell IRC channel.

--
http://apfelmus.nfshost.com

___
Beginners mailing list
beginn...@haskell.org
http://www.haskell.org/mailman/listinfo/beginners

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Reverting to any old version using Darcs

2009-04-02 Thread Nicolas Pouillard
Excerpts from Peter Verswyvelen's message of Wed Apr 01 23:39:15 +0200 2009:
[...]

 biggest problems I usually see in teams - namely forgetting to add files,
 forgetting to check in dependencies and the inability the merge after
 renames or moves -

Have a look at the --look-for-adds flag that makes the enables the detection
of new files. Removing files is already detected and moving should be done
with darcs mv which makes it pretty close to what one can expect.

Best regards,

-- 
Nicolas Pouillard
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: ANNOUNCE: vacuum-cairo: a cairo frontend to vacuum for live Haskell data visualization

2009-04-02 Thread Daryoush Mehrtash
When I try to install the hubigraph I get the following error:


:~/Desktop/hubigraph-0.1$ cabal install
Resolving dependencies...
'haxr-3000.1.1.2' is cached.
Configuring haxr-3000.1.1.2...
Preprocessing library haxr-3000.1.1.2...
Building haxr-3000.1.1.2...
[1 of 6] Compiling Network.XmlRpc.DTD_XMLRPC ( Network/XmlRpc/DTD_XMLRPC.hs,
dist/build/Network/XmlRpc/DTD_XMLRPC.o )

Network/XmlRpc/DTD_XMLRPC.hs:183:4:
Warning: Pattern match(es) are overlapped
 In the definition of `fromElem':
 fromElem (CMisc _ : rest) = ...
 fromElem (CString _ s : rest) = ...
 fromElem rest = ...
[2 of 6] Compiling Network.XmlRpc.Base64 ( Network/XmlRpc/Base64.hs,
dist/build/Network/XmlRpc/Base64.o )
[3 of 6] Compiling Network.XmlRpc.Internals ( Network/XmlRpc/Internals.hs,
dist/build/Network/XmlRpc/Internals.o )
[4 of 6] Compiling Network.XmlRpc.Server ( Network/XmlRpc/Server.hs,
dist/build/Network/XmlRpc/Server.o )
[5 of 6] Compiling Network.XmlRpc.Client ( Network/XmlRpc/Client.hs,
dist/build/Network/XmlRpc/Client.o )

Network/XmlRpc/Client.hs:113:23:
Not in scope: type constructor or class `ConnError'

Network/XmlRpc/Client.hs:113:51:
Not in scope: type constructor or class `ConnError'
cabal: Error: some packages failed to install:
HUBIGraph-0.1 depends on haxr-3000.1.1.2 which failed to install.
haxr-3000.1.1.2 failed during the building phase. The exception was:
exit: ExitFailure 1

Any ideas?

Thanks,

Daryoush

On Thu, Apr 2, 2009 at 12:25 AM, Gleb Alexeyev gleb.alex...@gmail.comwrote:

 Don Stewart wrote:

 Did you use hubigraph?

http://ooxo.org/hubigraph/

 This cabalized project doesn't appear to be on hackage!

  Oh, I wasn't aware of hubigraph until now.
 Ubigraph has very simple XML-RPC-based API so I used it directly.
 Hubigraph, of course, looks nicer with its custom monad, datatypes for
 shapes etc.

 BTW, it seems that you didn't notice the complete source code attached to
 my first message. Like I said it's just a quick and dirty hack, all real job
 is done by vacuum, Ubigraph server and a bit of code copy-pasted from
 vacuum-cairo.


 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Announcement: Beta of Leksah IDE available

2009-04-02 Thread Duncan Coutts
On Wed, 2009-04-01 at 22:13 +0200, David Waern wrote:
 2009/4/1 jutaro j...@arcor.de:
  I guess you mean the dialog which should help leksah to find sources
  for installed packages. It needs this so you can go to all the definitions
  in the base packages ... This is very handy if it works. Look to the manual
  for details.
 
 Maybe could add support to Cabal for installing sources? Should be
 very useful to have in general.

http://hackage.haskell.org/trac/hackage/ticket/364


Duncan

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] binary package: memory problem decoding an IntMap

2009-04-02 Thread Manlio Perillo

Hi.

I'm having memory problems decoding a big IntMap.

The data structure is:

IntMap (UArr (Word16 :*: Word8))


There are 480189 keys, and a total of 100480507 elements
(Netflix Prize).
The size of the encoded (and compressed) data is 184 MB.

When I load data from the Netflix Prize data set, total memory usage is
1030 Mb.

However when I try to decode the data, memory usage grows too much (even 
using the -F1.1 option in the RTS).



The problem seems to be with `fromAscList` function, defined as:

fromList :: [(Key,a)] - IntMap a
fromList xs
  = foldlStrict ins empty xs
  where
ins t (k,x)  = insert k x t

(by the way, why IntMap module does not use Data.List.foldl'?).

The `ins` function is not strict.



This seems an hard problem to solve.
First of all, IntMap should provide strict variants of the implemented 
functions.

And the binary package should choose whether use the strict or lazy version.


For me, the simplest solution is to serialize the association list 
obtained from `toAscList` function, instead of directly serialize the 
IntMap.


The question is: can I reuse the data already serialized?
Is the binary format of `IntMap a` and `[(Int, a)]` compatible?



Thanks  Manlio Perillo
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Reverting to any old version using Darcs

2009-04-02 Thread Ketil Malde
Peter Verswyvelen bugf...@gmail.com writes:

 Forgetting to add a file can be a nasty one, since if you discover
 that too late, the original file at patch time might not exist
 anymore (how do you guys solve this? Just plain discipline I
 guess?).

I've done this once, but with the cabal dependencies, not darcs.  Thus
the uploaded sdist was missing one of the source files, and
consequently failed to build.

I suppose the best way is to test this with a separate test repository
which you don't touch, except from pulling from your development repo
and checking that it builds.

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Announcement: Beta of Leksah IDE available

2009-04-02 Thread David Waern
2009/4/2 Duncan Coutts duncan.cou...@worc.ox.ac.uk:
 On Wed, 2009-04-01 at 22:13 +0200, David Waern wrote:
 2009/4/1 jutaro j...@arcor.de:
  I guess you mean the dialog which should help leksah to find sources
  for installed packages. It needs this so you can go to all the definitions
  in the base packages ... This is very handy if it works. Look to the manual
  for details.

 Maybe could add support to Cabal for installing sources? Should be
 very useful to have in general.

 http://hackage.haskell.org/trac/hackage/ticket/364

Jutaru, perhaps a nice Hackathon project? :-)

David
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ZipList monad, anyone?

2009-04-02 Thread Patai Gergely
 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
 good garbage collection properties (all data will remain for all time).
I guess cleverness should be concentrated on aging streams properly. But
I do see how the ability to extract the diagonal conflicts with such
efforts.

 Stick with Applicative for this type of thing.  Monad will drive you
 insane :-)
In fact, even applicative is far from trivial. ;) For instance, I still
can't see how I could implement the * operator with stateless streams
that don't need to keep track of their local time (needed when combining
them with stateful streams, that is).

Gergely

-- 
http://www.fastmail.fm - Access all of your messages and folders
  wherever you are

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ZipList monad, anyone?

2009-04-02 Thread Patai Gergely
 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, but now that I checked it out, it is indeed the same
thing.

 Really, you're better off just using Nat - a. The primary advantage
 to using a list over a function is avoiding recomputation, but nothing
 is getting recomputed here.
Well, at least streams can be made efficient in the absence of bind, as
opposed to functions, but I see your point. After all, that's the
problem with bind: it receives a function, which has no visible internal
structure, so it can only grow as you combine it with other things...

Gergely

-- 
http://www.fastmail.fm - A no graphics, no pop-ups email service

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ZipList monad, anyone?

2009-04-02 Thread Patai Gergely
 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, but at least you can mark the
empty spots of the diagonal, since it's possible to check the length of
the list before extracting its nth element. Which leads to some kind of
MaybeZipList:

newtype MaybeZipList a = MZL { getMZL :: [Maybe a] }
deriving Show

instance Monad MaybeZipList where
return = MZL . repeat . Just
MZL mxs = f = MZL $ zipWith bind mxs [0..]
where bind mx n = do
x - mx
let ys = getMZL (f x)
if length (take (n+1) ys) = n
then Nothing else ys !! n

But it's still not perfect, since the laws only apply modulo extra
Nothings at the end of the resulting lists...

 This monad works fine for size enforced vectors
Sure, I just can't see any good use for those. After all, if you use
arrays, you have to keep the whole structure in the memory just to
discard most of it.

Thanks for all the answers!

Gergely

-- 
http://www.fastmail.fm - Or how I learned to stop worrying and
  love email again

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Announcement: Beta of Leksah IDE available

2009-04-02 Thread Simon Marlow

David Waern wrote:

2009/4/2 Duncan Coutts duncan.cou...@worc.ox.ac.uk:

On Wed, 2009-04-01 at 22:13 +0200, David Waern wrote:

2009/4/1 jutaro j...@arcor.de:

I guess you mean the dialog which should help leksah to find sources
for installed packages. It needs this so you can go to all the definitions
in the base packages ... This is very handy if it works. Look to the manual
for details.

Maybe could add support to Cabal for installing sources? Should be
very useful to have in general.

http://hackage.haskell.org/trac/hackage/ticket/364


Jutaru, perhaps a nice Hackathon project? :-)


I think there's some design work to do there.  See the discussion on the 
GHC ticket: http://hackage.haskell.org/trac/ghc/ticket/2630.


In short: just keeping the source code around isn't enough.  You need some 
metadata in order to make sense of the source code - for example, you can't 
feed the source code to the GHC API without knowing which additional flags 
need to be passed, and those come from the .cabal file.  Also you probably 
want to stash the results of the 'cabal configure' step so that you can get 
a view of the source code that is consistent with the version(s?) you 
compiled.  We need to think about about backwards and 
forwards-compatibility of whatever metadata format is used.


And then you'll need Cabal APIs to extract the metadata.  So we need to 
think about what APIs make sense, and the best way to do that is to think 
about what tool(s) you want to write and use that to drive the API design.


Perhaps all this is going a bit too far.  Maybe we want to just stash the 
source code and accept that there are some things that you just can't do 
with it.  However, I imagine that pretty soon people will want to feed the 
source code into the GHC API, and at that point we have to tackle the build 
metadata issues.


Cheers,
Simon
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] SciMark2 benchmark

2009-04-02 Thread Jon Harrop

Has anyone ported the SciMark2 benchmark suite to Haskell?

-- 
Dr Jon Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?e
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Announcement: Beta of Leksah IDE available

2009-04-02 Thread jutaro

Hi Simon,
you quite nicely describe what leksah is doing already. Try to find find the
source code for all installed packages by locating cabal files, parse the
module sources via the Ghc API (actually not so much the API), using info
from cabal files for this (which is a dark art). It extracts comments and
locations. It's quite an ad hoc solution. On my machine it's 97% successful,
but its a notorious support theme, because it depends so much on the
environment. 
Jürgen


Simon Marlow-7 wrote:
 
 David Waern wrote:
 2009/4/2 Duncan Coutts duncan.cou...@worc.ox.ac.uk:
 On Wed, 2009-04-01 at 22:13 +0200, David Waern wrote:
 2009/4/1 jutaro j...@arcor.de:
 I guess you mean the dialog which should help leksah to find sources
 for installed packages. It needs this so you can go to all the
 definitions
 in the base packages ... This is very handy if it works. Look to the
 manual
 for details.
 Maybe could add support to Cabal for installing sources? Should be
 very useful to have in general.
 http://hackage.haskell.org/trac/hackage/ticket/364
 
 Jutaru, perhaps a nice Hackathon project? :-)
 
 I think there's some design work to do there.  See the discussion on the 
 GHC ticket: http://hackage.haskell.org/trac/ghc/ticket/2630.
 
 In short: just keeping the source code around isn't enough.  You need some 
 metadata in order to make sense of the source code - for example, you
 can't 
 feed the source code to the GHC API without knowing which additional flags 
 need to be passed, and those come from the .cabal file.  Also you probably 
 want to stash the results of the 'cabal configure' step so that you can
 get 
 a view of the source code that is consistent with the version(s?) you 
 compiled.  We need to think about about backwards and 
 forwards-compatibility of whatever metadata format is used.
 
 And then you'll need Cabal APIs to extract the metadata.  So we need to 
 think about what APIs make sense, and the best way to do that is to think 
 about what tool(s) you want to write and use that to drive the API design.
 
 Perhaps all this is going a bit too far.  Maybe we want to just stash the 
 source code and accept that there are some things that you just can't do 
 with it.  However, I imagine that pretty soon people will want to feed the 
 source code into the GHC API, and at that point we have to tackle the
 build 
 metadata issues.
 
 Cheers,
   Simon
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe
 
 

-- 
View this message in context: 
http://www.nabble.com/Announcement%3A-Beta-of-Leksah-IDE-available-tp22816032p22846713.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] ANN: Buster 0.99.1, a library for application orchestration that is not FRP

2009-04-02 Thread Jeff Heard
Read more about it on its webpage: http://vs.renci.org/jeff/buster

Yes, it’s to solve a particular problem.  And yes, this is a rough
draft of an explanation of how it works.  I’ve not even really
solidified the vocabulary yet, but I have this module which couches a
large, abstract, interactive (both with the user and the system),
multicomponent application in terms of a bus, inputs, behaviours, and
events.

* Time is continuous and infinite.
* An event is a static, discrete item associated with a particular time.
* The bus is the discrete view of event in time at an instant.
* A widget is an IO action that assigns events to a particular
time based only upon sampling the outside world (other events and
behaviours are irrelevant to it).  e.g. a Gtk Button is a widget, a
readable network socket is an widget, the mouse is an widget, the
keyboard is an widget, a multitouch gesture engine is a widget.
* A behaviour is a continuous item — it exists for the entire
program and for all times — which maps events on the bus to other
events on the bus.  It is an IO action as well — where widgets only
sample the outside world and are in a sense read only, behaviours
encapsulate reading and writing.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] HXT: desperatedly trying to concat

2009-04-02 Thread Steffen Schuldenzucker
Hi.

I've got a problem with the Haskell XML Toolkit (hxt). I want to write a little 
app that performs REST requests from a certain (rather simple) XML format. 
A example procedure Call looks like testData defined below.
What I'd like to do is to transform this xml tree into a GET variable string 
using an XmlArrow. The task sounds easy, and it has to be easy, but I've been 
sitting here for about a day now, staring at my code.

It looks like this (the transformation should be done by the arrow mkGetStr):

-- Rest.hs
-- This is also on HPaste: 
http://hpaste.org/fastcgi/hpaste.fcgi/view?id=3210#a3210

{-# LANGUAGE NoMonomorphismRestriction #-}

module Rest where

import Text.XML.HXT.Arrow
import Data.List

getParamsA = hasName param  getChildren  isElem
  (getName  (getChildren  getText))  arr2 mkGetPair

mkMethodStr = (method= ++) 
mkGetPair k v = k ++ = ++ v

getMethodA = hasName method  getChildren  getText  arr mkMethodStr

mkGetStr = isElem
(getMethodA + getParamsA) 
   . intercalate  

-- Try it with: runX (testData  mkGetStr) = print
testData = xread  constA (
methodmy.Method/method
 ++ param
 ++ foo_argFoo/foo_arg
 ++ bar_argBar/bar_arg
 ++ /param )

-- End of Rest.hs

What I get out of it is this (in ghci):

*Rest runX (testData  mkGetStr) = print
method=my.Methodfoo_arg=Foobar_arg=Bar

There is an  missing right after method=my.Method!
Why? I've tried many variants of this and they give me either this or a similar 
result or multiple results (what I don't want either).

I'd be really happy if someone could save my day and help me with this issue.

Thanks in advance,

Steffen

Neu bei WEB.DE: Kostenlose maxdome Movie-FLAT!
https://register.maxdome.de/xml/order/LpWebDe?ac=OM.MD.MD008K15726T7073a

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Character I/O

2009-04-02 Thread Simon Marlow

Judah Jacobson wrote:


Not sure if it will help, but you could take a look at what I did in Haskeline:

http://code.haskell.org/haskeline/System/Console/Haskeline/Backend/Win32.hsc


It would be nice to get some of that into the main win32 package...

Cheers,
Simon
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: Buster 0.99.1, a library for application orchestration that is not FRP

2009-04-02 Thread Peter Verswyvelen
Sounds vaguely like Grapefruit's circuits, but I could be very wrong...
The link you provided seems to be broken?

On Thu, Apr 2, 2009 at 3:05 PM, Jeff Heard jefferson.r.he...@gmail.comwrote:

 Read more about it on its webpage: http://vs.renci.org/jeff/buster

 Yes, it’s to solve a particular problem.  And yes, this is a rough
 draft of an explanation of how it works.  I’ve not even really
 solidified the vocabulary yet, but I have this module which couches a
 large, abstract, interactive (both with the user and the system),
 multicomponent application in terms of a bus, inputs, behaviours, and
 events.

* Time is continuous and infinite.
* An event is a static, discrete item associated with a particular time.
* The bus is the discrete view of event in time at an instant.
* A widget is an IO action that assigns events to a particular
 time based only upon sampling the outside world (other events and
 behaviours are irrelevant to it).  e.g. a Gtk Button is a widget, a
 readable network socket is an widget, the mouse is an widget, the
 keyboard is an widget, a multitouch gesture engine is a widget.
* A behaviour is a continuous item — it exists for the entire
 program and for all times — which maps events on the bus to other
 events on the bus.  It is an IO action as well — where widgets only
 sample the outside world and are in a sense read only, behaviours
 encapsulate reading and writing.
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: Buster 0.99.1, a library for application orchestration that is not FRP

2009-04-02 Thread minh thu
It's vis instead of vs:
http://vis.renci.org/jeff/buster/

2009/4/2 Peter Verswyvelen bugf...@gmail.com:
 Sounds vaguely like Grapefruit's circuits, but I could be very wrong...
 The link you provided seems to be broken?
 On Thu, Apr 2, 2009 at 3:05 PM, Jeff Heard jefferson.r.he...@gmail.com
 wrote:

 Read more about it on its webpage: http://vs.renci.org/jeff/buster

 Yes, it’s to solve a particular problem.  And yes, this is a rough
 draft of an explanation of how it works.  I’ve not even really
 solidified the vocabulary yet, but I have this module which couches a
 large, abstract, interactive (both with the user and the system),
 multicomponent application in terms of a bus, inputs, behaviours, and
 events.

* Time is continuous and infinite.
* An event is a static, discrete item associated with a particular
 time.
* The bus is the discrete view of event in time at an instant.
* A widget is an IO action that assigns events to a particular
 time based only upon sampling the outside world (other events and
 behaviours are irrelevant to it).  e.g. a Gtk Button is a widget, a
 readable network socket is an widget, the mouse is an widget, the
 keyboard is an widget, a multitouch gesture engine is a widget.
* A behaviour is a continuous item — it exists for the entire
 program and for all times — which maps events on the bus to other
 events on the bus.  It is an IO action as well — where widgets only
 sample the outside world and are in a sense read only, behaviours
 encapsulate reading and writing.
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: Buster 0.99.1, a library for application orchestration that is not FRP

2009-04-02 Thread Jeff Heard
Yes,sorry.  vis, not vs. http://vis.renci.org/buster

It is a bit like grapefruit's circuits, but where Grapefruit circuits
describe the flow of events from place to place, Buster never does.
Events exist for all behaviours, to be selected by name, group, or
source.  The other major difference is the |~| or beside operator,
which describes concurrent application of behaviours.

A last but somewhat minor thing is that the Event type is fairly
general, allowing for multiple data to be attached to a single event
and this data to be of many of the standard types (Int, String,
Double, ByteString, etc) as well as a user-defined type.  Of course,
such an event type could be defined for other FRP frameworks as well.

-- Jeff

On Thu, Apr 2, 2009 at 9:53 AM, minh thu not...@gmail.com wrote:
 It's vis instead of vs:
 http://vis.renci.org/jeff/buster/

 2009/4/2 Peter Verswyvelen bugf...@gmail.com:
 Sounds vaguely like Grapefruit's circuits, but I could be very wrong...
 The link you provided seems to be broken?
 On Thu, Apr 2, 2009 at 3:05 PM, Jeff Heard jefferson.r.he...@gmail.com
 wrote:

 Read more about it on its webpage: http://vs.renci.org/jeff/buster

 Yes, it’s to solve a particular problem.  And yes, this is a rough
 draft of an explanation of how it works.  I’ve not even really
 solidified the vocabulary yet, but I have this module which couches a
 large, abstract, interactive (both with the user and the system),
 multicomponent application in terms of a bus, inputs, behaviours, and
 events.

    * Time is continuous and infinite.
    * An event is a static, discrete item associated with a particular
 time.
    * The bus is the discrete view of event in time at an instant.
    * A widget is an IO action that assigns events to a particular
 time based only upon sampling the outside world (other events and
 behaviours are irrelevant to it).  e.g. a Gtk Button is a widget, a
 readable network socket is an widget, the mouse is an widget, the
 keyboard is an widget, a multitouch gesture engine is a widget.
    * A behaviour is a continuous item — it exists for the entire
 program and for all times — which maps events on the bus to other
 events on the bus.  It is an IO action as well — where widgets only
 sample the outside world and are in a sense read only, behaviours
 encapsulate reading and writing.
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: Buster 0.99.1, a library for application orchestration that is not FRP

2009-04-02 Thread Jeff Heard
Check links...  god.  http://vis.renci.org/jeff/buster  (can you tell
I was up till 3am last night?)

On Thu, Apr 2, 2009 at 10:05 AM, Jeff Heard jefferson.r.he...@gmail.com wrote:
 Yes,sorry.  vis, not vs. http://vis.renci.org/buster

 It is a bit like grapefruit's circuits, but where Grapefruit circuits
 describe the flow of events from place to place, Buster never does.
 Events exist for all behaviours, to be selected by name, group, or
 source.  The other major difference is the |~| or beside operator,
 which describes concurrent application of behaviours.

 A last but somewhat minor thing is that the Event type is fairly
 general, allowing for multiple data to be attached to a single event
 and this data to be of many of the standard types (Int, String,
 Double, ByteString, etc) as well as a user-defined type.  Of course,
 such an event type could be defined for other FRP frameworks as well.

 -- Jeff

 On Thu, Apr 2, 2009 at 9:53 AM, minh thu not...@gmail.com wrote:
 It's vis instead of vs:
 http://vis.renci.org/jeff/buster/

 2009/4/2 Peter Verswyvelen bugf...@gmail.com:
 Sounds vaguely like Grapefruit's circuits, but I could be very wrong...
 The link you provided seems to be broken?
 On Thu, Apr 2, 2009 at 3:05 PM, Jeff Heard jefferson.r.he...@gmail.com
 wrote:

 Read more about it on its webpage: http://vs.renci.org/jeff/buster

 Yes, it’s to solve a particular problem.  And yes, this is a rough
 draft of an explanation of how it works.  I’ve not even really
 solidified the vocabulary yet, but I have this module which couches a
 large, abstract, interactive (both with the user and the system),
 multicomponent application in terms of a bus, inputs, behaviours, and
 events.

    * Time is continuous and infinite.
    * An event is a static, discrete item associated with a particular
 time.
    * The bus is the discrete view of event in time at an instant.
    * A widget is an IO action that assigns events to a particular
 time based only upon sampling the outside world (other events and
 behaviours are irrelevant to it).  e.g. a Gtk Button is a widget, a
 readable network socket is an widget, the mouse is an widget, the
 keyboard is an widget, a multitouch gesture engine is a widget.
    * A behaviour is a continuous item — it exists for the entire
 program and for all times — which maps events on the bus to other
 events on the bus.  It is an IO action as well — where widgets only
 sample the outside world and are in a sense read only, behaviours
 encapsulate reading and writing.
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe




___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: Buster 0.99.1, a library for application orchestration that is not FRP

2009-04-02 Thread minh thu
Funny ... I never write an url in a mail : I type it in firefox (so I
actually check it) then copy/paste it.

2009/4/2 Jeff Heard jefferson.r.he...@gmail.com:
 Check links...  god.  http://vis.renci.org/jeff/buster  (can you tell
 I was up till 3am last night?)

 On Thu, Apr 2, 2009 at 10:05 AM, Jeff Heard jefferson.r.he...@gmail.com 
 wrote:
 Yes,sorry.  vis, not vs. http://vis.renci.org/buster

 It is a bit like grapefruit's circuits, but where Grapefruit circuits
 describe the flow of events from place to place, Buster never does.
 Events exist for all behaviours, to be selected by name, group, or
 source.  The other major difference is the |~| or beside operator,
 which describes concurrent application of behaviours.

 A last but somewhat minor thing is that the Event type is fairly
 general, allowing for multiple data to be attached to a single event
 and this data to be of many of the standard types (Int, String,
 Double, ByteString, etc) as well as a user-defined type.  Of course,
 such an event type could be defined for other FRP frameworks as well.

 -- Jeff

 On Thu, Apr 2, 2009 at 9:53 AM, minh thu not...@gmail.com wrote:
 It's vis instead of vs:
 http://vis.renci.org/jeff/buster/

 2009/4/2 Peter Verswyvelen bugf...@gmail.com:
 Sounds vaguely like Grapefruit's circuits, but I could be very wrong...
 The link you provided seems to be broken?
 On Thu, Apr 2, 2009 at 3:05 PM, Jeff Heard jefferson.r.he...@gmail.com
 wrote:

 Read more about it on its webpage: http://vs.renci.org/jeff/buster

 Yes, it’s to solve a particular problem.  And yes, this is a rough
 draft of an explanation of how it works.  I’ve not even really
 solidified the vocabulary yet, but I have this module which couches a
 large, abstract, interactive (both with the user and the system),
 multicomponent application in terms of a bus, inputs, behaviours, and
 events.

* Time is continuous and infinite.
* An event is a static, discrete item associated with a particular
 time.
* The bus is the discrete view of event in time at an instant.
* A widget is an IO action that assigns events to a particular
 time based only upon sampling the outside world (other events and
 behaviours are irrelevant to it).  e.g. a Gtk Button is a widget, a
 readable network socket is an widget, the mouse is an widget, the
 keyboard is an widget, a multitouch gesture engine is a widget.
* A behaviour is a continuous item — it exists for the entire
 program and for all times — which maps events on the bus to other
 events on the bus.  It is an IO action as well — where widgets only
 sample the outside world and are in a sense read only, behaviours
 encapsulate reading and writing.
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe





___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: Buster 0.99.1, a library for application orchestration that is not FRP

2009-04-02 Thread Peter Verswyvelen
It seems to be a trend to use more and more IO in new FRP approaches.
Grapefruit's circuits encapsulate side effects, as does your approach

This is a big departure from the pure libs like Fran, Yampa, Reactive, ...

I wander if this is because of some fundamental problem with functional
programming when it comes to FRP?

Some people claim that IO is also pure, and I tend to agree if we can
capture the state of the real world and rewind to it somehow :)

On Thu, Apr 2, 2009 at 4:06 PM, Jeff Heard jefferson.r.he...@gmail.comwrote:

 Check links...  god.  http://vis.renci.org/jeff/buster  (can you tell
 I was up till 3am last night?)

 On Thu, Apr 2, 2009 at 10:05 AM, Jeff Heard jefferson.r.he...@gmail.com
 wrote:
  Yes,sorry.  vis, not vs. http://vis.renci.org/buster
 
  It is a bit like grapefruit's circuits, but where Grapefruit circuits
  describe the flow of events from place to place, Buster never does.
  Events exist for all behaviours, to be selected by name, group, or
  source.  The other major difference is the |~| or beside operator,
  which describes concurrent application of behaviours.
 
  A last but somewhat minor thing is that the Event type is fairly
  general, allowing for multiple data to be attached to a single event
  and this data to be of many of the standard types (Int, String,
  Double, ByteString, etc) as well as a user-defined type.  Of course,
  such an event type could be defined for other FRP frameworks as well.
 
  -- Jeff
 
  On Thu, Apr 2, 2009 at 9:53 AM, minh thu not...@gmail.com wrote:
  It's vis instead of vs:
  http://vis.renci.org/jeff/buster/
 
  2009/4/2 Peter Verswyvelen bugf...@gmail.com:
  Sounds vaguely like Grapefruit's circuits, but I could be very wrong...
  The link you provided seems to be broken?
  On Thu, Apr 2, 2009 at 3:05 PM, Jeff Heard 
 jefferson.r.he...@gmail.com
  wrote:
 
  Read more about it on its webpage: http://vs.renci.org/jeff/buster
 
  Yes, it’s to solve a particular problem.  And yes, this is a rough
  draft of an explanation of how it works.  I’ve not even really
  solidified the vocabulary yet, but I have this module which couches a
  large, abstract, interactive (both with the user and the system),
  multicomponent application in terms of a bus, inputs, behaviours, and
  events.
 
 * Time is continuous and infinite.
 * An event is a static, discrete item associated with a particular
  time.
 * The bus is the discrete view of event in time at an instant.
 * A widget is an IO action that assigns events to a particular
  time based only upon sampling the outside world (other events and
  behaviours are irrelevant to it).  e.g. a Gtk Button is a widget, a
  readable network socket is an widget, the mouse is an widget, the
  keyboard is an widget, a multitouch gesture engine is a widget.
 * A behaviour is a continuous item — it exists for the entire
  program and for all times — which maps events on the bus to other
  events on the bus.  It is an IO action as well — where widgets only
  sample the outside world and are in a sense read only, behaviours
  encapsulate reading and writing.
  ___
  Haskell-Cafe mailing list
  Haskell-Cafe@haskell.org
  http://www.haskell.org/mailman/listinfo/haskell-cafe
 
 
  ___
  Haskell-Cafe mailing list
  Haskell-Cafe@haskell.org
  http://www.haskell.org/mailman/listinfo/haskell-cafe
 
 
 
 

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: Buster 0.99.1, a library for application orchestration that is not FRP

2009-04-02 Thread Jeff Heard
It is parametrically polymorphic in a.  And no, it's an arbitrary
decision, BUT...  it allows me and other users to define generally
useful behaviours and widgets to package with the library using the
basic types without locking down 'a'.  The EventData type looks like
this:

data Event a { ..., edata :: EData a, ... }

data EData a = EChar Char
  | EString String
  | EStringL [String]
  | EByteString ByteString
  | EByteStringL [ByteString]
  | EInt Int
  | EIntL [Int]
  | EDouble Double
  | EDoubleL [Double]
  | EBool Bool
  | EBoolL [Bool]
  | EOther a
  | EOtherL [a]

Now, given that arbitrary decision, I'd be willing to modify Event so
that it is parametric on 'a' without EData and include EData as an
example binding for 'a' if the user chooses to use it.  However, I
foresee most behaviours and widgets that are generally useful to be
dependent on this type, which is why I made it a basic part of Event.

-- Jeff

On Thu, Apr 2, 2009 at 11:05 AM, Jules Bean ju...@jellybean.co.uk wrote:
 Jeff Heard wrote:

 A last but somewhat minor thing is that the Event type is fairly
 general, allowing for multiple data to be attached to a single event
 and this data to be of many of the standard types (Int, String,
 Double, ByteString, etc) as well as a user-defined type.  Of course,
 such an event type could be defined for other FRP frameworks as well.

 That sounds the opposite of general. That sounds specific. (Int, String,
 Double, ByteString as well as a user-defined type).

 Can you explain the reason for the EDouble, EString (etc.) alternatives as
 opposed to making the event simply (parametrically) polymorphic in a ?

 Jules

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: Buster 0.99.1, a library for application orchestration that is not FRP

2009-04-02 Thread Jules Bean

Jeff Heard wrote:

It is parametrically polymorphic in a.  And no, it's an arbitrary
decision, BUT...  it allows me and other users to define generally
useful behaviours and widgets to package with the library using the
basic types without locking down 'a'.  The EventData type looks like
this:

data Event a { ..., edata :: EData a, ... }

data EData a = EChar Char
  | EString String
  | EStringL [String]
  | EByteString ByteString
  | EByteStringL [ByteString]
  | EInt Int
  | EIntL [Int]
  | EDouble Double
  | EDoubleL [Double]
  | EBool Bool
  | EBoolL [Bool]
  | EOther a
  | EOtherL [a]


Maybe I wasn't clear, and probably I'm being dense. I understand what 
you've done - I looked at the type declarations before commenting - but 
I don't understand why.


Why is it useful to be able to use basic types without locking down 'a'?

Why is it useful to have a value of type Event FooBar which, in 
apparent defiance of the FooBar parameter, actually contains a value of 
type Double?


Jules
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: Buster 0.99.1, a library for application orchestration that is not FRP

2009-04-02 Thread Jules Bean

Jeff Heard wrote:

A last but somewhat minor thing is that the Event type is fairly
general, allowing for multiple data to be attached to a single event
and this data to be of many of the standard types (Int, String,
Double, ByteString, etc) as well as a user-defined type.  Of course,
such an event type could be defined for other FRP frameworks as well.


That sounds the opposite of general. That sounds specific. (Int, String, 
Double, ByteString as well as a user-defined type).


Can you explain the reason for the EDouble, EString (etc.) alternatives 
as opposed to making the event simply (parametrically) polymorphic in a ?


Jules
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: ANNOUNCE: vacuum-cairo: a cairo frontend to vacuum for live Haskell data visualization

2009-04-02 Thread Gleb Alexeyev

Daryoush Mehrtash wrote:

When I try to install the hubigraph I get the following error:



skip


Network/XmlRpc/Client.hs:113:23:
Not in scope: type constructor or class `ConnError'

Network/XmlRpc/Client.hs:113:51:
Not in scope: type constructor or class `ConnError'
cabal: Error: some packages failed to install:
HUBIGraph-0.1 depends on haxr-3000.1.1.2 which failed to install.
haxr-3000.1.1.2 failed during the building phase. The exception was:
exit: ExitFailure 1

Any ideas?



I've just run into this problem as well. It seems that haxr doesn't 
build with HTTP-4000, though its cabal file doesn't specify the upper bound.


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: Buster 0.99.1, a library for application orchestration that is not FRP

2009-04-02 Thread Jeff Heard
On Thu, Apr 2, 2009 at 11:22 AM, Jules Bean ju...@jellybean.co.uk wrote:

 Maybe I wasn't clear, and probably I'm being dense. I understand what you've
 done - I looked at the type declarations before commenting - but I don't
 understand why.

 Why is it useful to be able to use basic types without locking down 'a'?

 Why is it useful to have a value of type Event FooBar which, in apparent
 defiance of the FooBar parameter, actually contains a value of type Double?

 Jules


I'm assuming everyone won't want to start from scratch in creating all
their widgets and behaviours.  A bus contains only events of type 'a',
therefore all widgets and behaviours on that bus must use events of
type 'a'.  It is possible to run multiple buses at the same time in
the same program, and even possible to have them communicate between
each other (forkIO-ing the buses and attaching some arbitrary
behaviour that takes events from bus0, translates their types and then
puts them on bus1), and so that way you could use multiple types, but
I don't see a problem with a user having to read the documentation and
understand that an Event of type a contains data that is a variant
including type a.  How is it useful?  Consider the following widgets:

commandLineArgsWidget :: Widget a
commandLineArgsWidget = getArgs =
\args - produce' Environment
  CommandLineArgsWidget
  argv
  Persistent
  [EStringL args]

environmentWidget :: Widget a
environmentWidget b = getEnvironment =
mapM_ (\(k,v) - produce' Environment EnvironmentWidget k
Persistent [EString v] b)

progNameWidget :: Widget a
progNameWidget b = getProgName =
\v - produce' Environment ProgramNameWidget ProgramName
Persistent [EString v] b

As the library stands right now, I can take these widgets and put them
in a module and include them as part of the Buster library, and they
can be used pretty arbitrarily.  I can see being more semantically
pure and changing Event a to contain data of type a instead of data of
type [EData a], in which case the type signatures would look like
this:

progNameWidget :: WIdget [EData a]

and so forth to be compatible with Bus [EData a], but I think that in
the end so many widgets will reuse the EData type that it's just as
well to make it part of the Event rather than force the user to be
explicit about it every time.  But if I'm generally disagreed with
about this, I can change it -- I'm pretty neutral about it, to be
honest.

-- Jeff
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Problem with prepose.lhs and ghc6.10.1

2009-04-02 Thread Henry Laxen
Dear Group,

I'm trying to read the paper:
Functional Pearl: Implicit Configurations
at http://www.cs.rutgers.edu/~ccshan/prepose/
and when running the code in prepose.lhs I get:
../haskell/prepose.lhs:707:0: Parse error in pattern
which is pointing at:
normalize a :: M s a = M (mod a (modulus (undefined :: s)))

The paper says it uses lexically scoped type variables.  I tried reading about
them at:
http://www.haskell.org/ghc/docs/latest/html/users_guide/other-type-extensions.html#scoped-type-variables

so I added -XScopedTypeVariables to my OPTIONS but I still get the same error
message.  I would really like to play with the code in the paper, but I'm stuck
at this point.  Any pointers would be appreciated.
Best wishes,
Henry Laxen


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Type families and kind signatures

2009-04-02 Thread Louis Wasserman
The following module does not compile, and I can't figure out why:
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE KindSignatures #-}

module Foo where

import Control.Monad
import Data.Maybe

class Key k where
type Map k :: * - *
empty :: Map k v
 look :: k - Map k v  - Maybe v
update :: k - (Maybe v - Maybe v) - Map k v - Map k v

instance (Key k1, Key k2) = Key (k1, k2) where
type Map (k1, k2) v = Map k1 (Map k2 v)
empty = empty
 update (k1, k2) f = update k1 (update k2 f . fromMaybe empty)
look (k1, k2) = look k1 = look k2

The compile fails with
Foo.hs:16:1:
Number of parameters must match family declaration; expected 1
In the type synonym instance declaration for `Map'
In the instance declaration for `Key (k1, k2)'

Is this a bug with type synonym families? Is there something silly I'm
missing?

Louis Wasserman
wasserman.lo...@gmail.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Type families and kind signatures

2009-04-02 Thread Luke Palmer
2009/4/2 Louis Wasserman wasserman.lo...@gmail.com

 The following module does not compile, and I can't figure out why:
 {-# LANGUAGE TypeFamilies #-}
 {-# LANGUAGE KindSignatures #-}

 module Foo where

 import Control.Monad
 import Data.Maybe

 class Key k where
 type Map k :: * - *
 empty :: Map k v
  look :: k - Map k v  - Maybe v
 update :: k - (Maybe v - Maybe v) - Map k v - Map k v

 instance (Key k1, Key k2) = Key (k1, k2) where
 type Map (k1, k2) v = Map k1 (Map k2 v)


The arity of the instance has to be *exactly* the same as is declared.  So
the v is one too many parameters.  That does make your life a little more
difficult (but points to an abstraction you may not have seen :-).

I would resolve this as:

type Map (k1,k2) = Map k1 `O` Map k2

Where O is functor composition from TypeCompose on hackage.



 empty = empty
  update (k1, k2) f = update k1 (update k2 f . fromMaybe empty)
 look (k1, k2) = look k1 = look k2

 The compile fails with
 Foo.hs:16:1:
 Number of parameters must match family declaration; expected 1
 In the type synonym instance declaration for `Map'
 In the instance declaration for `Key (k1, k2)'

 Is this a bug with type synonym families? Is there something silly I'm
 missing?

 Louis Wasserman
 wasserman.lo...@gmail.com

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Type families and kind signatures

2009-04-02 Thread Louis Wasserman
Mkay.  One more quick thing -- the wiki demonstrates a place where the
original attempt worked, with a data family instead. (That is, replacing
'type' with 'data' and adjusting the instance makes this program compile
immediately.)
a) Is there a type-hackery reason this is different from data families?
b) Is there a reason this isn't made a lot clearer in the documentation?
 GHC's docs say that higher-order type families can be declared with kind
signatures, but never gives any examples -- which would make it a lot
clearer that the below program doesn't work.

Louis Wasserman
wasserman.lo...@gmail.com


On Thu, Apr 2, 2009 at 12:05 PM, Luke Palmer lrpal...@gmail.com wrote:

 2009/4/2 Louis Wasserman wasserman.lo...@gmail.com

 The following module does not compile, and I can't figure out why:
 {-# LANGUAGE TypeFamilies #-}
 {-# LANGUAGE KindSignatures #-}

 module Foo where

 import Control.Monad
 import Data.Maybe

 class Key k where
 type Map k :: * - *
 empty :: Map k v
  look :: k - Map k v  - Maybe v
 update :: k - (Maybe v - Maybe v) - Map k v - Map k v

 instance (Key k1, Key k2) = Key (k1, k2) where
 type Map (k1, k2) v = Map k1 (Map k2 v)


 The arity of the instance has to be *exactly* the same as is declared.  So
 the v is one too many parameters.  That does make your life a little more
 difficult (but points to an abstraction you may not have seen :-).

 I would resolve this as:

 type Map (k1,k2) = Map k1 `O` Map k2

 Where O is functor composition from TypeCompose on hackage.



  empty = empty
  update (k1, k2) f = update k1 (update k2 f . fromMaybe empty)
 look (k1, k2) = look k1 = look k2

 The compile fails with
 Foo.hs:16:1:
 Number of parameters must match family declaration; expected 1
 In the type synonym instance declaration for `Map'
 In the instance declaration for `Key (k1, k2)'

 Is this a bug with type synonym families? Is there something silly I'm
 missing?

 Louis Wasserman
 wasserman.lo...@gmail.com

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: Buster 0.99.1, a library for application orchestration that is not FRP

2009-04-02 Thread Jeff Heard
Alright, updated it to extract EData from the Event type and make it
separate.  Basically, now all type signatures

Event a
Widget a
Behaviour a

should read

Event [EData a]
Widget [EData a]
Behaviour [EData a]

for backward compatibility.

On Thu, Apr 2, 2009 at 11:53 AM, Jeff Heard jefferson.r.he...@gmail.com wrote:
 On Thu, Apr 2, 2009 at 11:22 AM, Jules Bean ju...@jellybean.co.uk wrote:

 Maybe I wasn't clear, and probably I'm being dense. I understand what you've
 done - I looked at the type declarations before commenting - but I don't
 understand why.

 Why is it useful to be able to use basic types without locking down 'a'?

 Why is it useful to have a value of type Event FooBar which, in apparent
 defiance of the FooBar parameter, actually contains a value of type Double?

 Jules


 I'm assuming everyone won't want to start from scratch in creating all
 their widgets and behaviours.  A bus contains only events of type 'a',
 therefore all widgets and behaviours on that bus must use events of
 type 'a'.  It is possible to run multiple buses at the same time in
 the same program, and even possible to have them communicate between
 each other (forkIO-ing the buses and attaching some arbitrary
 behaviour that takes events from bus0, translates their types and then
 puts them on bus1), and so that way you could use multiple types, but
 I don't see a problem with a user having to read the documentation and
 understand that an Event of type a contains data that is a variant
 including type a.  How is it useful?  Consider the following widgets:

 commandLineArgsWidget :: Widget a
 commandLineArgsWidget = getArgs =
    \args - produce' Environment
                      CommandLineArgsWidget
                      argv
                      Persistent
                      [EStringL args]

 environmentWidget :: Widget a
 environmentWidget b = getEnvironment =
    mapM_ (\(k,v) - produce' Environment EnvironmentWidget k
 Persistent [EString v] b)

 progNameWidget :: Widget a
 progNameWidget b = getProgName =
    \v - produce' Environment ProgramNameWidget ProgramName
 Persistent [EString v] b

 As the library stands right now, I can take these widgets and put them
 in a module and include them as part of the Buster library, and they
 can be used pretty arbitrarily.  I can see being more semantically
 pure and changing Event a to contain data of type a instead of data of
 type [EData a], in which case the type signatures would look like
 this:

 progNameWidget :: WIdget [EData a]

 and so forth to be compatible with Bus [EData a], but I think that in
 the end so many widgets will reuse the EData type that it's just as
 well to make it part of the Event rather than force the user to be
 explicit about it every time.  But if I'm generally disagreed with
 about this, I can change it -- I'm pretty neutral about it, to be
 honest.

 -- Jeff

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Problem with prepose.lhs and ghc6.10.1

2009-04-02 Thread andy morris
2009/4/2 Henry Laxen nadine.and.he...@pobox.com:
 Dear Group,

 I'm trying to read the paper:
 Functional Pearl: Implicit Configurations
 at http://www.cs.rutgers.edu/~ccshan/prepose/
 and when running the code in prepose.lhs I get:
 ../haskell/prepose.lhs:707:0: Parse error in pattern
 which is pointing at:
 normalize a :: M s a = M (mod a (modulus (undefined :: s)))

 The paper says it uses lexically scoped type variables.  I tried reading about
 them at:
 http://www.haskell.org/ghc/docs/latest/html/users_guide/other-type-extensions.html#scoped-type-variables

 so I added -XScopedTypeVariables to my OPTIONS but I still get the same error
 message.  I would really like to play with the code in the paper, but I'm 
 stuck
 at this point.  Any pointers would be appreciated.
 Best wishes,
 Henry Laxen

It probably needs brackets:
normalize (a :: M s a) = ...
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: Buster 0.99.1, a library for application orchestration that is not FRP

2009-04-02 Thread Felipe Lessa
On Thu, Apr 02, 2009 at 11:53:00AM -0400, Jeff Heard wrote:
 and so forth to be compatible with Bus [EData a], but I think that in
 the end so many widgets will reuse the EData type that it's just as
 well to make it part of the Event rather than force the user to be
 explicit about it every time.  But if I'm generally disagreed with
 about this, I can change it -- I'm pretty neutral about it, to be
 honest.

Why not trying something like what was done with the new extensible
extensions, using typeable existencials and casts? That way you could
put any value you want and they would all be first class citizens.

Another random idea: a phantom type could be used to be explicit about
the type of event something produces or expects, something on the
lines of

 data EData a = forall b. Typeable b = EData b
  deriving (Typeable)

 -- | Extract the data.
 extract :: EData a - a
 extract (EData d) = case cast d of
   Just x  - x
   Nothing - error extract: phantom didn't match

 -- | Carefull extract the data, returns @Nothing@ if the phantom
 --   type doesn't match.
 extractM :: EData a - Maybe a
 extractM (EData d) = cast d

 -- | Extracts any type of data from a polymorphic 'EData'.
 extractAny :: (forall a. EData a) - Maybe b
 extractAny (EData d) = cast d
 -- Is the forall above useful to prevent mistakes or not?

 -- | Unsafely casts the phantom type to another one.
 unsafeCastData :: EData a - EData b
 unsafeCastData (EData d) = EData d

Your examples would become something like

 commandLineArgsWidget :: Widget [String]
 commandLineArgsWidget = getArgs =
 \args - produce' Environment
   CommandLineArgsWidget
   argv
   Persistent
   args

 environmentWidget :: Widget String
 environmentWidget b = getEnvironment =
 mapM_ (\(k,v) - produce' Environment EnvironmentWidget k
Persistent v b)

 progNameWidget :: Widget String
 progNameWidget b = getProgName =
 \v - produce' Environment ProgramNameWidget ProgramName
 Persistent v b

where I'm assuming that you could construct the EData inside produce'
as now that's the only constructor available.  The bus could then be
polymorphic on the phantom type.  Why use phantom types at all, then?
It at least serves for documentation purposes.  Well, it is a random
idea after all :).

--
Felipe.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: ANNOUNCE: vacuum-cairo: a cairo frontend to vacuum for live Haskell data visualization

2009-04-02 Thread Gleb Alexeyev

Don Stewart wrote:

Please upload!!



I've run into 2 problems while trying to do this.
The first one - haxr won't build with HTTP-4000, so I had to edit 
haxr.cabal and add the upper version bound for HTTP.


The second one is puzzling me.

I've cabal-installed the package, but keep getting linking errors from 
ghci (though interactive loading of the same module from source works fine):


Prelude :m + System.Vacuum.Ubigraph
Prelude System.Vacuum.Ubigraph view 42
Loading package syb ... linking ... done.
Loading lots of packages skipped
Loading package vacuum-0.0.6 ... linking ... done.
Loading package haxr-3000.1.1.2 ... linking ... done.
Loading package vacuum-ubigraph-0.1.0.2 ... linking ... interactive: 
/home/gleb/.cabal/lib/vacuum-ubigraph-0.1.0.2/ghc-6.10.1/HSvacuum-ubigraph-0.1.0.2.o: 
unknown symbol `vacuumzmubigraphzm0zi1zi0zi2_GraphicsziUbigraph_lvl_closure'

ghc: unable to load package `vacuum-ubigraph-0.1.0.2'
Prelude System.Vacuum.Ubigraph

Non-working package is here: 
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/vacuum-ubigraph-0.1.0.1.


Any hints appreciated.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: ANNOUNCE: vacuum-cairo: a cairo frontend to vacuum for live Haskell data visualization

2009-04-02 Thread Iavor Diatchki
Hi,
The linking problem might be due to a bug in the cabal file:  if you
have modules that are not exposed, you still need to list them in the
other-modules section.
-Iavor

On Thu, Apr 2, 2009 at 10:01 AM, Gleb Alexeyev gleb.alex...@gmail.com wrote:
 Don Stewart wrote:

 Please upload!!


 I've run into 2 problems while trying to do this.
 The first one - haxr won't build with HTTP-4000, so I had to edit haxr.cabal
 and add the upper version bound for HTTP.

 The second one is puzzling me.

 I've cabal-installed the package, but keep getting linking errors from ghci
 (though interactive loading of the same module from source works fine):

 Prelude :m + System.Vacuum.Ubigraph
 Prelude System.Vacuum.Ubigraph view 42
 Loading package syb ... linking ... done.
 Loading lots of packages skipped
 Loading package vacuum-0.0.6 ... linking ... done.
 Loading package haxr-3000.1.1.2 ... linking ... done.
 Loading package vacuum-ubigraph-0.1.0.2 ... linking ... interactive:
 /home/gleb/.cabal/lib/vacuum-ubigraph-0.1.0.2/ghc-6.10.1/HSvacuum-ubigraph-0.1.0.2.o:
 unknown symbol `vacuumzmubigraphzm0zi1zi0zi2_GraphicsziUbigraph_lvl_closure'
 ghc: unable to load package `vacuum-ubigraph-0.1.0.2'
 Prelude System.Vacuum.Ubigraph

 Non-working package is here:
 http://hackage.haskell.org/cgi-bin/hackage-scripts/package/vacuum-ubigraph-0.1.0.1.

 Any hints appreciated.

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Retargeting the ghc code generator

2009-04-02 Thread Vasili I. Galchin
Hello,

  Is there any project to retarget the GHC code generator to generate
Common Intermediate Language(CLI) in order to run on Mono or .NET? I assume
that Mondrian did precisely that.

Thanks, Vasili
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: ANNOUNCE: vacuum-cairo: a cairo frontend to vacuum for live Haskell data visualization

2009-04-02 Thread Gleb Alexeyev

Iavor Diatchki wrote:

Hi,
The linking problem might be due to a bug in the cabal file:  if you
have modules that are not exposed, you still need to list them in the
other-modules section.


This was the problem, thanks!



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Reverting to any old version using Darcs

2009-04-02 Thread Simon Michael

I'm learning useful things in this thread.

Ketil Malde wrote:
 I've done this once, but with the cabal dependencies, not darcs.  Thus
 the uploaded sdist was missing one of the source files, and
 consequently failed to build.

I have a pre-release make target where I test everything I can think of. 
 I think it prevents the above, am I right ?


 # run pre-release checks: cabal is happy, the code builds, tests 
pass..
 check: setversion unittest doctest haddocktest 

   cabal clean 

   cabal check 

   cabal configure 

   cabal build 

   dist/build/hledger/hledger test 21 | tail -1 | grep -q 'Errors: 0 
 Failures: 0'   |


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Type families and kind signatures

2009-04-02 Thread David Menendez
2009/4/2 Louis Wasserman wasserman.lo...@gmail.com:
 Mkay.  One more quick thing -- the wiki demonstrates a place where the
 original attempt worked, with a data family instead. (That is, replacing
 'type' with 'data' and adjusting the instance makes this program compile
 immediately.)
 a) Is there a type-hackery reason this is different from data families?

It's not type hackery. Data families are different from type families,
and the syntax for declaring instances of higher-kinded families is a
consequence of those differences.

An instance of a data family is a new type constructor, so you have to
provide the additional arguments in order to declare the data
constructors.

data family Foo a :: * - *
data instance Foo Bool a = FB a a
-- Foo Bool has kind * - *, like [], so I could make it a Functor

Instance of type families are always pre-existing type constructors.

type family Bar a :: * - *  -- Bar a must equal something of kind * - *
type instance Bar () = Maybe

 b) Is there a reason this isn't made a lot clearer in the documentation?
  GHC's docs say that higher-order type families can be declared with kind
 signatures, but never gives any examples -- which would make it a lot
 clearer that the below program doesn't work.

Here's a higher-kinded type family I've used.

type family Sig t :: * - *

class (Traversable (Sig t)) = Recursive t where
roll :: Sig t t - t
unroll :: t - Sig t t


The Traversable context wouldn't be valid if I had declared Sig t a ::
*, because type families must always be fully applied.


The difference is analogous to the difference between

type M0 a = StateT Int IO a
type M1   = StateT Int IO

Since type synonyms (like type and data families) must always be fully
applied, you can use M1 in places where you can't use M0, even though
they're effectively the same thing.

foo :: ErrorT String M1 a -- valid
bar :: ErrorT String M0 a -- not valid



-- 
Dave Menendez d...@zednenem.com
http://www.eyrie.org/~zednenem/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Funny type signature question

2009-04-02 Thread Michael Snoyman
I've butted into this problem multiple times, so I thought it's finally time
to get a good solution. I don't even have the terminology to describe the
issue, so I'll just post the code I'm annoyed with and hope someone
understands what I mean.

import Control.Monad.Random
import System.Random

data Marital = Single | Married | Divorced
deriving (Enum, Bounded, Show)

randomEnum :: (Enum a, Bounded a, RandomGen g) = Rand g a
randomEnum = do
let minb = minBound
maxb = maxBound
randVal - getRandomR (fromEnum minb, fromEnum maxb)
return $ head [toEnum randVal, minb, maxb] -- if I do the obvious thing
(return $ toEnum randVal) I get funny errors

main = do
stdGen - newStdGen
let marital = evalRand randomEnum stdGen :: Marital
putStrLn $ Random marital status:  ++ show marital

Any help is appreciated. Thanks!
Michael
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Funny type signature question

2009-04-02 Thread Peter Verswyvelen
The type inferer seems to struggle to find the type of minBound and
maxBound, and GHC asks to use a type annotation.
To only way I see how to add a type annotation here is to use a GHC
extension:

{-# LANGUAGE ScopedTypeVariables #-}

randomEnum :: forall a g. (Enum a, Bounded a, RandomGen g) = Rand g a
randomEnum = do
randVal - getRandomR (fromEnum (minBound::a), fromEnum (maxBound::a))
return $ toEnum randVal


It is annoying when the type inferer encounters ambiguities - you also get
this all the time when using OpenGL e.g. GL.colour - but I don't know how to
solve this without adding type annotations


On Thu, Apr 2, 2009 at 8:03 PM, Michael Snoyman mich...@snoyman.com wrote:

 I've butted into this problem multiple times, so I thought it's finally
 time to get a good solution. I don't even have the terminology to describe
 the issue, so I'll just post the code I'm annoyed with and hope someone
 understands what I mean.

 import Control.Monad.Random
 import System.Random

 data Marital = Single | Married | Divorced
 deriving (Enum, Bounded, Show)

 randomEnum :: (Enum a, Bounded a, RandomGen g) = Rand g a
 randomEnum = do
 let minb = minBound
 maxb = maxBound
 randVal - getRandomR (fromEnum minb, fromEnum maxb)
 return $ head [toEnum randVal, minb, maxb] -- if I do the obvious thing
 (return $ toEnum randVal) I get funny errors

 main = do
 stdGen - newStdGen
 let marital = evalRand randomEnum stdGen :: Marital
 putStrLn $ Random marital status:  ++ show marital

 Any help is appreciated. Thanks!
 Michael

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Funny type signature question

2009-04-02 Thread Ross Mellgren
There's nothing connecting the Enum/Bounded used in fromEnum and min/ 
maxBound to the toEnum, as there's an Int in the middle. Annotated  
very explicitly, the type inferrer probably sees something like:



randomEnum :: (Enum a, Bounded a, RandomGen g) = Rand g a
randomEnum = do
let minb = (minBound :: a1)
maxb = (maxBound :: a1)
randVal - getRandomR (fromEnum minb, fromEnum maxb) -- a1 here
return $ head [toEnum randVal, minb, maxb] -- putting minb and  
maxb in the list forces the unknown a1 to be a, because lists are  
homogeneous


So you have to give it some clue what you really want.

-Ross


On Apr 2, 2009, at 2:18 PM, Peter Verswyvelen wrote:

The type inferer seems to struggle to find the type of minBound and  
maxBound, and GHC asks to use a type annotation.


To only way I see how to add a type annotation here is to use a GHC  
extension:


{-# LANGUAGE ScopedTypeVariables #-}

randomEnum :: forall a g. (Enum a, Bounded a, RandomGen g) = Rand g a
randomEnum = do
randVal - getRandomR (fromEnum (minBound::a), fromEnum  
(maxBound::a))

return $ toEnum randVal


It is annoying when the type inferer encounters ambiguities - you  
also get this all the time when using OpenGL e.g. GL.colour - but I  
don't know how to solve this without adding type annotations



On Thu, Apr 2, 2009 at 8:03 PM, Michael Snoyman  
mich...@snoyman.com wrote:
I've butted into this problem multiple times, so I thought it's  
finally time to get a good solution. I don't even have the  
terminology to describe the issue, so I'll just post the code I'm  
annoyed with and hope someone understands what I mean.


import Control.Monad.Random
import System.Random

data Marital = Single | Married | Divorced
deriving (Enum, Bounded, Show)

randomEnum :: (Enum a, Bounded a, RandomGen g) = Rand g a
randomEnum = do
let minb = minBound
maxb = maxBound
randVal - getRandomR (fromEnum minb, fromEnum maxb)
return $ head [toEnum randVal, minb, maxb] -- if I do the  
obvious thing (return $ toEnum randVal) I get funny errors


main = do
stdGen - newStdGen
let marital = evalRand randomEnum stdGen :: Marital
putStrLn $ Random marital status:  ++ show marital

Any help is appreciated. Thanks!
Michael

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Funny type signature question

2009-04-02 Thread Michael Snoyman
Peter and Lennart,

Scoped type variables is exactly what I needed to know. Thanks for solving
this annoyance for me!

Michael

On Thu, Apr 2, 2009 at 9:18 PM, Peter Verswyvelen bugf...@gmail.com wrote:

 The type inferer seems to struggle to find the type of minBound and
 maxBound, and GHC asks to use a type annotation.
 To only way I see how to add a type annotation here is to use a GHC
 extension:

 {-# LANGUAGE ScopedTypeVariables #-}

 randomEnum :: forall a g. (Enum a, Bounded a, RandomGen g) = Rand g a
 randomEnum = do
 randVal - getRandomR (fromEnum (minBound::a), fromEnum (maxBound::a))
 return $ toEnum randVal


 It is annoying when the type inferer encounters ambiguities - you also get
 this all the time when using OpenGL e.g. GL.colour - but I don't know how to
 solve this without adding type annotations


 On Thu, Apr 2, 2009 at 8:03 PM, Michael Snoyman mich...@snoyman.comwrote:

 I've butted into this problem multiple times, so I thought it's finally
 time to get a good solution. I don't even have the terminology to describe
 the issue, so I'll just post the code I'm annoyed with and hope someone
 understands what I mean.

 import Control.Monad.Random
 import System.Random

 data Marital = Single | Married | Divorced
 deriving (Enum, Bounded, Show)

 randomEnum :: (Enum a, Bounded a, RandomGen g) = Rand g a
 randomEnum = do
 let minb = minBound
 maxb = maxBound
 randVal - getRandomR (fromEnum minb, fromEnum maxb)
 return $ head [toEnum randVal, minb, maxb] -- if I do the obvious
 thing (return $ toEnum randVal) I get funny errors

 main = do
 stdGen - newStdGen
 let marital = evalRand randomEnum stdGen :: Marital
 putStrLn $ Random marital status:  ++ show marital

 Any help is appreciated. Thanks!
 Michael

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Funny type signature question

2009-04-02 Thread Felipe Lessa
On Thu, Apr 02, 2009 at 08:18:27PM +0200, Peter Verswyvelen wrote:
 The type inferer seems to struggle to find the type of minBound and
 maxBound, and GHC asks to use a type annotation.
 To only way I see how to add a type annotation here is to use a GHC
 extension:

 {-# LANGUAGE ScopedTypeVariables #-}

Just use 'asTypeOf'. It is defined as

 asTypeOf :: a - a - a
 asTypeOf = const

so that @asTypeOf x y == x@ but both types are constrained to be
equal.  The above function would become

 randomEnum :: (Enum a, Bounded a, RandomGen g) = Rand g a
 randomEnum = do
 let min = minBound; max = maxBound
 randVal - getRandomR (fromEnum min, fromEnum max)
 return $ toEnum randVal `asTypeOf` min `asTypeOf` max

Note that I use the fact that 'return' is constrained to the type
variable 'a' we want to constrain its argument, and the
'asTypeOf' constrains everything to be of the same type.

HTH,

--
Felipe.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Funny type signature question

2009-04-02 Thread Michael Snoyman
On Thu, Apr 2, 2009 at 9:51 PM, Felipe Lessa felipe.le...@gmail.com wrote:

 On Thu, Apr 02, 2009 at 08:18:27PM +0200, Peter Verswyvelen wrote:
  The type inferer seems to struggle to find the type of minBound and
  maxBound, and GHC asks to use a type annotation.
  To only way I see how to add a type annotation here is to use a GHC
  extension:
 
  {-# LANGUAGE ScopedTypeVariables #-}

 Just use 'asTypeOf'. It is defined as

  asTypeOf :: a - a - a
  asTypeOf = const

 so that @asTypeOf x y == x@ but both types are constrained to be
 equal.  The above function would become

  randomEnum :: (Enum a, Bounded a, RandomGen g) = Rand g a
  randomEnum = do
  let min = minBound; max = maxBound
  randVal - getRandomR (fromEnum min, fromEnum max)
  return $ toEnum randVal `asTypeOf` min `asTypeOf` max

 Note that I use the fact that 'return' is constrained to the type
 variable 'a' we want to constrain its argument, and the
 'asTypeOf' constrains everything to be of the same type.

 HTH,

 --
 Felipe.


Interesting alternative. However, I think the ScopedTypeVariables looks a
little bit cleaner. I'll keep the asTypeOf in mind for the future though.

Michael
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Funny type signature question

2009-04-02 Thread Peter Verswyvelen
Ah, I did not know this asTypeOf function.
But ScopedTypeVariables also allows you to give inner functions type
signatures that reuse polymorphic type parameters of the parent scope, which
makes code clearer I think.

On Thu, Apr 2, 2009 at 8:54 PM, Michael Snoyman mich...@snoyman.com wrote:



 On Thu, Apr 2, 2009 at 9:51 PM, Felipe Lessa felipe.le...@gmail.comwrote:

 On Thu, Apr 02, 2009 at 08:18:27PM +0200, Peter Verswyvelen wrote:
  The type inferer seems to struggle to find the type of minBound and
  maxBound, and GHC asks to use a type annotation.
  To only way I see how to add a type annotation here is to use a GHC
  extension:
 
  {-# LANGUAGE ScopedTypeVariables #-}

 Just use 'asTypeOf'. It is defined as

  asTypeOf :: a - a - a
  asTypeOf = const

 so that @asTypeOf x y == x@ but both types are constrained to be
 equal.  The above function would become

  randomEnum :: (Enum a, Bounded a, RandomGen g) = Rand g a
  randomEnum = do
  let min = minBound; max = maxBound
  randVal - getRandomR (fromEnum min, fromEnum max)
  return $ toEnum randVal `asTypeOf` min `asTypeOf` max

 Note that I use the fact that 'return' is constrained to the type
 variable 'a' we want to constrain its argument, and the
 'asTypeOf' constrains everything to be of the same type.

 HTH,

 --
 Felipe.


 Interesting alternative. However, I think the ScopedTypeVariables looks a
 little bit cleaner. I'll keep the asTypeOf in mind for the future though.

 Michael


 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Funny type signature question

2009-04-02 Thread Felipe Lessa
On Thu, Apr 02, 2009 at 09:54:16PM +0300, Michael Snoyman wrote:
 Interesting alternative. However, I think the ScopedTypeVariables looks a
 little bit cleaner. I'll keep the asTypeOf in mind for the future though.

That is a matter of taste.  However 'asTypeOf' has a clear
advantage: it is Haskell 98.  This is also a matter of taste, but
I prefer not to use extensions whenever they don't bring any real
gain (e.g. sometimes you can't use 'asTypeOf', and the scoped
type variables are your only option).

--
Felipe.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: ANNOUNCE: vacuum-cairo: a cairo frontend to vacuum for live Haskell data visualization

2009-04-02 Thread Matt Morrow
Very nice.

Gleb Alexeyev gleb.alex...@gmail.com wrote:
  http://hackage.haskell.org/cgi-bin/hackage-scripts/package/vacuum-ubigraph
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] .editrc

2009-04-02 Thread brad clawsie
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

does anyone have a .editrc they can provide that allows ghci to be used
on freebsd? 

i'm not looking for anything fancy, just backspace not being broken etc

thanks
brad
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.10 (Darwin)

iEYEARECAAYFAknVGdQACgkQxRg3RkRK91NZ4gCgm8Oktcs3sCYl6YoY6X4igZAR
IDIAn2cpF7QnI4zz4LFN1cVlzG7qSHHk
=CJXp
-END PGP SIGNATURE-
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: HXT: desperatedly trying to concat

2009-04-02 Thread Steffen Schuldenzucker
Hello again.

I finally got it myself. It was just a matter of parentheses:

See http://hpaste.org/fastcgi/hpaste.fcgi/view?id=3229 for the corrected 
version.
Looks like what I was trying to do is not expressable via just an arrow, one 
needs a function mapping the input arrow to a new one.

I'm gonna make a big WATCH YOUR PARENTHESES! poster... Yeah, with some arrows 
on it...

Thanks for reading, anyway.

Steffen

Neu bei WEB.DE: Kostenlose maxdome Movie-FLAT!
https://register.maxdome.de/xml/order/LpWebDe?ac=OM.MD.MD008K15726T7073a

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Issue with IsFunction/Vspace in GHC 6.10.1

2009-04-02 Thread Jacques Carette
I was playing with some of Oleg's code (at end for convenience).  After 
minor adjustments for ghc 6.10.1, it still didn't work.  The error 
message is quite puzzling too, as it suggests adding exactly the 
constraint which is present...  Any ideas?


Jacques

-- Oleg's definition of a vector space class, based on IsFunction and
-- TypeCast.  See http://okmij.org/ftp/Haskell/isFunction.lhs
-- for the January 2003 message, which works in GHC 6.2.1 and 6.4
-- code below *works* in 6.8.1 AFAIK
{-# LANGUAGE EmptyDataDecls, MultiParamTypeClasses, 
FunctionalDependencies #-}

{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE OverlappingInstances #-}

module Q where

class Vspace a v | v - a
   where
   (+) :: v - v - v
   (*)  :: a - v - v

instance (IsFunction v f, Vspace' f a v) = Vspace a v
 where
 (+) = doplus (undefined::f)
 (*)  = dostar (undefined::f)

class Vspace' f a v | f v - a
   where
   doplus :: f - v - v - v
   dostar :: f - a - v - v

instance Num a = Vspace' HFalse a a where
doplus _ = (+)
dostar _  = (*)
-- etc.  No problem.

instance (IsFunction v f, Vspace' f a v, Vspace a v)
   = Vspace' HTrue a (c-v) where
doplus _ f g = \x - f x + g x
dostar _ a f x = a * (f x)


test1 = (1::Int) + 2
test2 = ((\x - x + (10::Int)) + (\x - x + (10::Int))) 1
test3 = ((\x y - x + y) + (\x y - (x + y) + x)) (1::Int) (2::Int)

test4 = ((\x y - x + y) + (\x y - ((2 * x) + (3 * y
   (1::Int) (2::Int)

data HTrue
data HFalse

class IsFunction a b | a - b
instance TypeCast f HTrue = IsFunction (x-y) f
instance TypeCast f HFalse = IsFunction a f

-- literally lifted from the HList library
class TypeCast   a b   | a - b, b-a   where typeCast   :: a - b
class TypeCast'  t a b | t a - b, t b - a where typeCast'  :: t-a-b
class TypeCast'' t a b | t a - b, t b - a where typeCast'' :: t-a-b
instance TypeCast'  () a b = TypeCast a b where typeCast x = typeCast' () x
instance TypeCast'' t a b = TypeCast' t a b where typeCast' = typeCast''
instance TypeCast'' () a a where typeCast'' _ x  = x


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Issue with IsFunction/Vspace in GHC 6.10.1

2009-04-02 Thread Claus Reinke

{-# LANGUAGE ScopedTypeVariables #-}

without, the 'f's in the instance are independent.
Claus

- Original Message - 
From: Jacques Carette care...@mcmaster.ca

To: haskell-cafe@haskell.org
Sent: Thursday, April 02, 2009 10:15 PM
Subject: [Haskell-cafe] Issue with IsFunction/Vspace in GHC 6.10.1


I was playing with some of Oleg's code (at end for convenience).  After 
minor adjustments for ghc 6.10.1, it still didn't work.  The error 
message is quite puzzling too, as it suggests adding exactly the 
constraint which is present...  Any ideas?


Jacques

-- Oleg's definition of a vector space class, based on IsFunction and
-- TypeCast.  See http://okmij.org/ftp/Haskell/isFunction.lhs
-- for the January 2003 message, which works in GHC 6.2.1 and 6.4
-- code below *works* in 6.8.1 AFAIK
{-# LANGUAGE EmptyDataDecls, MultiParamTypeClasses, 
FunctionalDependencies #-}

{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE OverlappingInstances #-}

module Q where

class Vspace a v | v - a
   where
   (+) :: v - v - v
   (*)  :: a - v - v

instance (IsFunction v f, Vspace' f a v) = Vspace a v
 where
 (+) = doplus (undefined::f)
 (*)  = dostar (undefined::f)

class Vspace' f a v | f v - a
   where
   doplus :: f - v - v - v
   dostar :: f - a - v - v

instance Num a = Vspace' HFalse a a where
doplus _ = (+)
dostar _  = (*)
-- etc.  No problem.

instance (IsFunction v f, Vspace' f a v, Vspace a v)
   = Vspace' HTrue a (c-v) where
doplus _ f g = \x - f x + g x
dostar _ a f x = a * (f x)


test1 = (1::Int) + 2
test2 = ((\x - x + (10::Int)) + (\x - x + (10::Int))) 1
test3 = ((\x y - x + y) + (\x y - (x + y) + x)) (1::Int) (2::Int)

test4 = ((\x y - x + y) + (\x y - ((2 * x) + (3 * y
   (1::Int) (2::Int)

data HTrue
data HFalse

class IsFunction a b | a - b
instance TypeCast f HTrue = IsFunction (x-y) f
instance TypeCast f HFalse = IsFunction a f

-- literally lifted from the HList library
class TypeCast   a b   | a - b, b-a   where typeCast   :: a - b
class TypeCast'  t a b | t a - b, t b - a where typeCast'  :: t-a-b
class TypeCast'' t a b | t a - b, t b - a where typeCast'' :: t-a-b
instance TypeCast'  () a b = TypeCast a b where typeCast x = typeCast' () x
instance TypeCast'' t a b = TypeCast' t a b where typeCast' = typeCast''
instance TypeCast'' () a a where typeCast'' _ x  = x


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Looking for practical examples of Zippers

2009-04-02 Thread GüŸnther Schmidt

David, guys,

sorry, this all started with a misconception on my behalf of what a 
Zipper is and what it is good for.


In the days that followed my post this became much clearer though and I 
now realize my original question was pointless.


It seems you spotted that and yes, generalized trie is probably more 
what I'm looking for, thanks!


Günther


David Menendez schrieb:

On Mon, Mar 30, 2009 at 3:46 PM, Gü?nther Schmidt gue.schm...@web.de wrote:

Thanks Don,

I followed some examples but have not yet seen anything that would show me
how, for instance, turn a nested Map like

Map Int (Map Int (Map String Double)

into a zipped version.

That is presuming of course that this use is feasible at all.


Are you asking about the technique for navigating recursive
structures, or did you mean something having to do with the
isomorphism between Map Int (Map Int (Map String Double)) and Map
(Int,Int,String) Double?

For the latter, the term you want is generalized trie.




___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Program using 500MB RAM to process 5MB file

2009-04-02 Thread lucas
I'm relatively new to haskell so as one does, I am rewriting an
existing program in haskell to help learn the language.

However, it eats up all my RAM whenever I run the program.

http://hpaste.org/fastcgi/hpaste.fcgi/view?id=3175#a3175

Obviously I'm doing something wrong, but without my magical FP pants I
don't know what that might be.

-- 
Lucas Hazel lu...@die.net.au


pgpCpy889Gy8E.pgp
Description: PGP signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Missing dependency?

2009-04-02 Thread Lyle Kopnicky
Hi folks,

Since the time package is not included in ghc-6.10.2, I installed it via
cabal. Then I tried to configure my project, and it says that the dependency
is missing. Mysterious. Can anyone explain?

l...@lwk-desktop:~/devel/vintage-basic$ ghc-pkg list
/usr/local/lib/ghc-6.10.2/./package.conf:
Cabal-1.6.0.3, HUnit-1.2.0.3, QuickCheck-1.2.0.0, array-0.2.0.0,
base-3.0.3.1, base-4.1.0.0, bytestring-0.9.1.4, containers-0.2.0.1,
directory-1.0.0.3, (dph-base-0.3), (dph-par-0.3),
(dph-prim-interface-0.3), (dph-prim-par-0.3), (dph-prim-seq-0.3),
(dph-seq-0.3), editline-0.2.1.0, filepath-1.1.0.2, (ghc-6.10.2),
ghc-prim-0.1.0.0, haddock-2.4.2, haskell-src-1.0.1.3,
haskell98-1.0.1.0, hpc-0.5.0.3, html-1.0.1.2, integer-0.1.0.1,
mtl-1.1.0.2, network-2.2.1, old-locale-1.0.0.1, old-time-1.0.0.2,
packedstring-0.1.0.1, parallel-1.1.0.1, parsec-2.1.0.1,
pretty-1.0.1.0, process-1.0.1.1, random-1.0.0.1,
regex-base-0.72.0.2, regex-compat-0.71.0.1, regex-posix-0.72.0.3,
rts-1.0, stm-2.1.1.2, syb-0.1.0.1, template-haskell-2.3.0.1,
unix-2.3.2.0, xhtml-3000.2.0.1
/home/lwk/.ghc/i386-linux-6.10.2/package.conf:
HTTP-4000.0.4, time-1.1.2.3, zlib-0.5.0.0
l...@lwk-desktop:~/devel/vintage-basic$ runhaskell Setup.hs configure
Configuring vintage-basic-1.0.1...
Setup.hs: At least the following dependencies are missing:
time =1.1
l...@lwk-desktop:~/devel/vintage-basic$

Thanks,
Lyle
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Type families and kind signatures

2009-04-02 Thread Louis Wasserman
Mkay.  I get it now.  I was under the impression that, essentially, a data
family was precisely equivalent to a type family aliasing to a separately
declared datatype.

One more question: is there any way to get the low overhead of newtypes for
particular instances of a data family?  Is this impossible?  That is, is
there any way to do something like

data family Foo a
data instance Foo Int = Bar Int -- Bar is actually a newtype

Louis Wasserman
wasserman.lo...@gmail.com


On Thu, Apr 2, 2009 at 12:47 PM, David Menendez d...@zednenem.com wrote:

 2009/4/2 Louis Wasserman wasserman.lo...@gmail.com:
  Mkay.  One more quick thing -- the wiki demonstrates a place where the
  original attempt worked, with a data family instead. (That is, replacing
  'type' with 'data' and adjusting the instance makes this program compile
  immediately.)
  a) Is there a type-hackery reason this is different from data families?

 It's not type hackery. Data families are different from type families,
 and the syntax for declaring instances of higher-kinded families is a
 consequence of those differences.

 An instance of a data family is a new type constructor, so you have to
 provide the additional arguments in order to declare the data
 constructors.

 data family Foo a :: * - *
 data instance Foo Bool a = FB a a
 -- Foo Bool has kind * - *, like [], so I could make it a Functor

 Instance of type families are always pre-existing type constructors.

 type family Bar a :: * - *  -- Bar a must equal something of kind * - *
 type instance Bar () = Maybe

  b) Is there a reason this isn't made a lot clearer in the documentation?
   GHC's docs say that higher-order type families can be declared with kind
  signatures, but never gives any examples -- which would make it a lot
  clearer that the below program doesn't work.

 Here's a higher-kinded type family I've used.

 type family Sig t :: * - *

 class (Traversable (Sig t)) = Recursive t where
roll :: Sig t t - t
unroll :: t - Sig t t


 The Traversable context wouldn't be valid if I had declared Sig t a ::
 *, because type families must always be fully applied.


 The difference is analogous to the difference between

 type M0 a = StateT Int IO a
 type M1   = StateT Int IO

 Since type synonyms (like type and data families) must always be fully
 applied, you can use M1 in places where you can't use M0, even though
 they're effectively the same thing.

 foo :: ErrorT String M1 a -- valid
 bar :: ErrorT String M0 a -- not valid



 --
 Dave Menendez d...@zednenem.com
 http://www.eyrie.org/~zednenem/ http://www.eyrie.org/%7Ezednenem/

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Retargeting the ghc code generator

2009-04-02 Thread Toby Hutton
2009/4/3 Vasili I. Galchin vigalc...@gmail.com:
 Hello,

   Is there any project to retarget the GHC code generator to generate
 Common Intermediate Language(CLI) in order to run on Mono or .NET? I assume
 that Mondrian did precisely that.

There are/were a couple of projects attempting that or to bring
Haskell to .NET in general, but with limited success.

MSR were considering it but due to qualities like purity and laziness
making it difficult they chose to bring Ocaml to .NET and came up with
F#.  http://research.microsoft.com/en-us/um/cambridge/projects/fsharp/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Issue with IsFunction/Vspace in GHC 6.10.1

2009-04-02 Thread Jacques Carette
Claus Reinke wrote:
 {-# LANGUAGE ScopedTypeVariables #-}

 without, the 'f's in the instance are independent.
 Claus
Thanks - I discovered this (by trial-and-error) at about the same time
you sent the email. 

Is there a ticket somewhere to add a warning about this?  I expected me
'f's to be the same, and the error messages were not the least bit
enlightening.

Jacques
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Missing dependency?

2009-04-02 Thread Jonathan Cast
On Thu, 2009-04-02 at 16:13 -0700, Lyle Kopnicky wrote:
 Hi folks,
 
 Since the time package is not included in ghc-6.10.2, I installed it
 via cabal. Then I tried to configure my project, and it says that the
 dependency is missing. Mysterious. Can anyone explain?
 
 l...@lwk-desktop:~/devel/vintage-basic$ ghc-pkg list
 /usr/local/lib/ghc-6.10.2/./package.conf:
 Cabal-1.6.0.3, HUnit-1.2.0.3, QuickCheck-1.2.0.0, array-0.2.0.0,
 base-3.0.3.1, base-4.1.0.0, bytestring-0.9.1.4,
 containers-0.2.0.1,
 directory-1.0.0.3, (dph-base-0.3), (dph-par-0.3),
 (dph-prim-interface-0.3), (dph-prim-par-0.3), (dph-prim-seq-0.3),
 (dph-seq-0.3), editline-0.2.1.0, filepath-1.1.0.2, (ghc-6.10.2),
 ghc-prim-0.1.0.0, haddock-2.4.2, haskell-src-1.0.1.3,
 haskell98-1.0.1.0, hpc-0.5.0.3, html-1.0.1.2, integer-0.1.0.1,
 mtl-1.1.0.2, network-2.2.1, old-locale-1.0.0.1, old-time-1.0.0.2,
 packedstring-0.1.0.1, parallel-1.1.0.1, parsec-2.1.0.1,
 pretty-1.0.1.0, process-1.0.1.1, random-1.0.0.1,
 regex-base-0.72.0.2, regex-compat-0.71.0.1, regex-posix-0.72.0.3,
 rts-1.0, stm-2.1.1.2, syb-0.1.0.1, template-haskell-2.3.0.1,
 unix-2.3.2.0, xhtml-3000.2.0.1
 /home/lwk/.ghc/i386-linux-6.10.2/package.conf:
 HTTP-4000.0.4, time-1.1.2.3, zlib-0.5.0.0
 l...@lwk-desktop:~/devel/vintage-basic$ runhaskell Setup.hs configure
 Configuring vintage-basic-1.0.1...
 Setup.hs: At least the following dependencies are missing:
 time =1.1
 l...@lwk-desktop:~/devel/vintage-basic$ 

You need to use runhaskell Setup.hs configure --user, or else re-install
time globally (as root).

jcc


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Program using 500MB RAM to process 5MB file

2009-04-02 Thread Rick R
You could profile your app for memory usage. Then you could figure out just
what function is blowing up the mem usage and figure out how to optimize it.


http://book.realworldhaskell.org/read/profiling-and-optimization.html


2009/4/2 lu...@die.net.au

 I'm relatively new to haskell so as one does, I am rewriting an
 existing program in haskell to help learn the language.

 However, it eats up all my RAM whenever I run the program.

 http://hpaste.org/fastcgi/hpaste.fcgi/view?id=3175#a3175

 Obviously I'm doing something wrong, but without my magical FP pants I
 don't know what that might be.

 --
 Lucas Hazel lu...@die.net.au

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe




-- 
We can't solve problems by using the same kind of thinking we used when we
created them.
   - A. Einstein
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Wishful thinking: a text editor that expands function applications into function definitions

2009-04-02 Thread Duane Johnson
So I was thinking about a killer feature for a text editor.   
Wouldn't it be neat if you could expand function calls into their  
definitions, in-place?


For example, suppose we have minus defined like so, somewhere in  
another file:



minus (a, b, c) (x, y, z) = (a - x, b - y, c - z)


Later, we make use of the function in our current context:


let p1 = (1, 2, 3)
 p2 = (4, 5, 6)
in p1 `minus` p2


By telling the editor to expand the minus, we get a temporary  
replacing of the above with:



(1 - 4, 2 - 5, 3 - 6)


Another example:


  parse s = map readLine ls


And supposing that readLine is defined somewhere else, moving the  
cursor to readLine in the line above and expanding becomes:



  parse s = map (\line - words $ dropWhile (== ' ') line)


This is all pretty standard for the kinds of things we do in Haskell  
to work it out by hand, but is there any reason the parser couldn't do  
this?  I think it would be even harder to do automatically in any  
other language.  Maybe it's already been attempted or done?


Curious,

Duane Johnson

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wishful thinking: a text editor that expands function applications into function definitions

2009-04-02 Thread Derek Elkins
On Thu, 2009-04-02 at 18:01 -0600, Duane Johnson wrote:
 So I was thinking about a killer feature for a text editor.   
 Wouldn't it be neat if you could expand function calls into their  
 definitions, in-place?
 
 For example, suppose we have minus defined like so, somewhere in  
 another file:
 
  minus (a, b, c) (x, y, z) = (a - x, b - y, c - z)
 
 Later, we make use of the function in our current context:
 
  let p1 = (1, 2, 3)
   p2 = (4, 5, 6)
  in p1 `minus` p2
 
 By telling the editor to expand the minus, we get a temporary  
 replacing of the above with:
 
  (1 - 4, 2 - 5, 3 - 6)
 
 Another example:
 
parse s = map readLine ls
 
 And supposing that readLine is defined somewhere else, moving the  
 cursor to readLine in the line above and expanding becomes:
 
parse s = map (\line - words $ dropWhile (== ' ') line)
 
 This is all pretty standard for the kinds of things we do in Haskell  
 to work it out by hand, but is there any reason the parser couldn't do  
 this?  I think it would be even harder to do automatically in any  
 other language.  Maybe it's already been attempted or done?

See HaRe http://www.cs.kent.ac.uk/projects/refactor-fp/hare.html

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wishful thinking: a text editor that expands function applications into function definitions

2009-04-02 Thread Zachary Turner
It seems like a neat feature, and it could just be my inexperience with
Haskell but it doesn't seem killer.  For example, why would you want to
expand readLine like that if you already have it defined?  It seems to
defeat much of the benefit of functional languages in the first place, which
is that it's so easy to reuse code by composing functions into new
functions.  I can see the case where you're passing all constants to a
function, because then supposedly inlining it might be more efficient, but I
would think the compiler would optimize most of the cases for you anyway.

One feature that I -do- think would be killer though, is the ability for the
editor to do a mouse-over tooltip of a) function definitions, and b)
arbitrary expressions.  So like in your example above, hovering the mouse
over `minus` in the expression p1 `minus` p2 would pop up a two line tooltip
that looked like this

minus :: (Num a, Num b, Num c) = (a,b,c) - (a,b,c) - (a,b,c)
minus :: first - second - (a,b,c)

Something along those lines.  It's nice to be able to see names of function
arguments without having to navigate away from the line you're editing.
This isn't the killer yet though since it's actually pretty standard for
most sufficiently advanced programming language IDEs.  The killer is that
the mouse-over event would also look one line above the function definition
for a comment.  It would then scan backward until it finds no more
comments.  It would then display that text above the function definition.
It's great having a type signature, but comments would just be icing on the
cake.

For arbitrary expressions, suppose you had the following function:

replaceItem :: [a] - (a - Bool) - a - [a]
let replaceItem xs pred = (: filter (not.pred) xs)

You then highlight the text filter (not.pred) and hover over the
highlighted text.  The mouse then pops up a tooltip that says [a] - [a].
That would be killer IMO



On Thu, Apr 2, 2009 at 7:01 PM, Duane Johnson duane.john...@gmail.comwrote:

 So I was thinking about a killer feature for a text editor.  Wouldn't it
 be neat if you could expand function calls into their definitions, in-place?

 For example, suppose we have minus defined like so, somewhere in another
 file:

  minus (a, b, c) (x, y, z) = (a - x, b - y, c - z)


 Later, we make use of the function in our current context:

  let p1 = (1, 2, 3)
 p2 = (4, 5, 6)
 in p1 `minus` p2


 By telling the editor to expand the minus, we get a temporary replacing
 of the above with:

  (1 - 4, 2 - 5, 3 - 6)


 Another example:

   parse s = map readLine ls


 And supposing that readLine is defined somewhere else, moving the cursor to
 readLine in the line above and expanding becomes:

   parse s = map (\line - words $ dropWhile (== ' ') line)


 This is all pretty standard for the kinds of things we do in Haskell to
 work it out by hand, but is there any reason the parser couldn't do this?  I
 think it would be even harder to do automatically in any other language.
  Maybe it's already been attempted or done?

 Curious,

 Duane Johnson

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wishful thinking: a text editor that expands function applications into function definitions

2009-04-02 Thread Duane Johnson
Perhaps it wouldn't be as all-wonderful as I think, but as a new  
Haskell user, I am constantly switching back and forth between various  
definitions of things trying to compare documentation and files...


The purpose of expansion as I was explaining it is not to  
*permanently replace* what is in the text, but rather to *temporarily  
replace* it.  I imagine it kind of like a zoom in for code.  You  
could zoom in on one function, and seeing a new function that you  
don't recognize, zoom in again, and so on.  Once done, you would hit  
ESC to make it all return as it was.


BTW, I do like your suggestion of tooltip types.  That would be very  
handy!


Duane Johnson

On Apr 2, 2009, at 6:24 PM, Zachary Turner wrote:

It seems like a neat feature, and it could just be my inexperience  
with Haskell but it doesn't seem killer.  For example, why would  
you want to expand readLine like that if you already have it  
defined?  It seems to defeat much of the benefit of functional  
languages in the first place, which is that it's so easy to reuse  
code by composing functions into new functions.  I can see the case  
where you're passing all constants to a function, because then  
supposedly inlining it might be more efficient, but I would think  
the compiler would optimize most of the cases for you anyway.


One feature that I -do- think would be killer though, is the ability  
for the editor to do a mouse-over tooltip of a) function  
definitions, and b) arbitrary expressions.  So like in your example  
above, hovering the mouse over `minus` in the expression p1 `minus`  
p2 would pop up a two line tooltip that looked like this


minus :: (Num a, Num b, Num c) = (a,b,c) - (a,b,c) - (a,b,c)
minus :: first - second - (a,b,c)

Something along those lines.  It's nice to be able to see names of  
function arguments without having to navigate away from the line  
you're editing.  This isn't the killer yet though since it's  
actually pretty standard for most sufficiently advanced programming  
language IDEs.  The killer is that the mouse-over event would also  
look one line above the function definition for a comment.  It would  
then scan backward until it finds no more comments.  It would then  
display that text above the function definition.  It's great having  
a type signature, but comments would just be icing on the cake.


For arbitrary expressions, suppose you had the following function:

replaceItem :: [a] - (a - Bool) - a - [a]
let replaceItem xs pred = (: filter (not.pred) xs)

You then highlight the text filter (not.pred) and hover over the  
highlighted text.  The mouse then pops up a tooltip that says [a] - 
 [a].  That would be killer IMO




On Thu, Apr 2, 2009 at 7:01 PM, Duane Johnson  
duane.john...@gmail.com wrote:
So I was thinking about a killer feature for a text editor.   
Wouldn't it be neat if you could expand function calls into their  
definitions, in-place?


For example, suppose we have minus defined like so, somewhere in  
another file:


minus (a, b, c) (x, y, z) = (a - x, b - y, c - z)

Later, we make use of the function in our current context:

let p1 = (1, 2, 3)
p2 = (4, 5, 6)
in p1 `minus` p2

By telling the editor to expand the minus, we get a temporary  
replacing of the above with:


(1 - 4, 2 - 5, 3 - 6)

Another example:

 parse s = map readLine ls

And supposing that readLine is defined somewhere else, moving the  
cursor to readLine in the line above and expanding becomes:


 parse s = map (\line - words $ dropWhile (== ' ') line)

This is all pretty standard for the kinds of things we do in Haskell  
to work it out by hand, but is there any reason the parser couldn't  
do this?  I think it would be even harder to do automatically in any  
other language.  Maybe it's already been attempted or done?


Curious,

Duane Johnson

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Type families and kind signatures

2009-04-02 Thread Manuel M T Chakravarty

Louis Wasserman:
Mkay.  I get it now.  I was under the impression that, essentially,  
a data family was precisely equivalent to a type family aliasing to  
a separately declared datatype.


No, they are not equivalent.  You can see that as follows.  Assume,

  data family T a
  type family S a

Now, given `T a ~ T b', we know that `a ~ b'.  (We call this  
implication decomposition.)


In contrast, given `S a ~ S b' we do *not* know whether `a ~ b'.  Why  
not?  Consider the instances


  type instance S Int = Bool
  type instance S Float = Bool

Clearly, `S Int ~ S Float', but surely not `Int ~ Float'.  So,  
decomposition does not hold for type synonym families, but it does  
hold for data families.


This is actually, not really a property of type *families* alone.  It  
already distinguishes vanilla data types from vanilla type synonyms.   
We know, say, that if `Maybe a ~ Maybe b', then `a ~ b'.  However, given


  type Const a = Int

we have `Const Int ~ Const Float' (and still not `Int ~ Float').   
Definitions, such as that of `Const', are rarely used, which is why  
this issue doesn't come up much until you use type families.


One more question: is there any way to get the low overhead of  
newtypes for particular instances of a data family?  Is this  
impossible?  That is, is there any way to do something like


data family Foo a
data instance Foo Int = Bar Int -- Bar is actually a newtype


You can use

  newtype instance Foo Int = MkFoo Int

So, the instances of a data family can be data or newtype instances.,  
and you can freely mix them.


Manuel


On Thu, Apr 2, 2009 at 12:47 PM, David Menendez d...@zednenem.com  
wrote:

2009/4/2 Louis Wasserman wasserman.lo...@gmail.com:
 Mkay.  One more quick thing -- the wiki demonstrates a place where  
the
 original attempt worked, with a data family instead. (That is,  
replacing
 'type' with 'data' and adjusting the instance makes this program  
compile

 immediately.)
 a) Is there a type-hackery reason this is different from data  
families?


It's not type hackery. Data families are different from type families,
and the syntax for declaring instances of higher-kinded families is a
consequence of those differences.

An instance of a data family is a new type constructor, so you have to
provide the additional arguments in order to declare the data
constructors.

data family Foo a :: * - *
data instance Foo Bool a = FB a a
-- Foo Bool has kind * - *, like [], so I could make it a Functor

Instance of type families are always pre-existing type constructors.

type family Bar a :: * - *  -- Bar a must equal something of kind *  
- *

type instance Bar () = Maybe

 b) Is there a reason this isn't made a lot clearer in the  
documentation?
  GHC's docs say that higher-order type families can be declared  
with kind
 signatures, but never gives any examples -- which would make it a  
lot

 clearer that the below program doesn't work.

Here's a higher-kinded type family I've used.

type family Sig t :: * - *

class (Traversable (Sig t)) = Recursive t where
   roll :: Sig t t - t
   unroll :: t - Sig t t


The Traversable context wouldn't be valid if I had declared Sig t a ::
*, because type families must always be fully applied.


The difference is analogous to the difference between

type M0 a = StateT Int IO a
type M1   = StateT Int IO

Since type synonyms (like type and data families) must always be fully
applied, you can use M1 in places where you can't use M0, even though
they're effectively the same thing.

foo :: ErrorT String M1 a -- valid
bar :: ErrorT String M0 a -- not valid



--
Dave Menendez d...@zednenem.com
http://www.eyrie.org/~zednenem/

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Reverting to any old version using Darcs

2009-04-02 Thread Trent W. Buck
Nicolas Pouillard nicolas.pouill...@gmail.com writes:

 Excerpts from Peter Verswyvelen's message of Wed Apr 01 23:39:15 +0200 2009:
 [...]

 biggest problems I usually see in teams - namely forgetting to add files,
 forgetting to check in dependencies and the inability the merge after
 renames or moves -

 Have a look at the --look-for-adds flag that makes the enables the detection
 of new files.

If you were really paranoid about this, you could turn --look-for-adds
on by default in a repo or for a user, so that any darcs record would
also ask about new files.  This would probably get annoying unless you
added a bunch of entries to _darcs/prefs/boring.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Reverting to any old version using Darcs

2009-04-02 Thread Trent W. Buck
Ketil Malde ke...@malde.org writes:

 Peter Verswyvelen bugf...@gmail.com writes:

 Forgetting to add a file can be a nasty one, since if you discover
 that too late, the original file at patch time might not exist
 anymore (how do you guys solve this? Just plain discipline I
 guess?).

 I've done this once, but with the cabal dependencies, not darcs.  Thus
 the uploaded sdist was missing one of the source files, and
 consequently failed to build.

 I suppose the best way is to test this with a separate test repository
 which you don't touch, except from pulling from your development repo
 and checking that it builds.

For what its worth, the darcs test preference performs the tests in a
completely fresh working tree that it creates ONLY using files that have
been checked in.  This helps avoid the problem of things only working
accidentally, because of uncommitted changes.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Reverting to any old version using Darcs

2009-04-02 Thread Trent W. Buck
Simon Michael si...@joyful.com writes:

 I'm learning useful things in this thread.

 Ketil Malde wrote:
 I've done this once, but with the cabal dependencies, not darcs.  Thus
 the uploaded sdist was missing one of the source files, and
 consequently failed to build.

 I have a pre-release make target where I test everything I can think
 of. I think it prevents the above, am I right ?

Dunno.

  # run pre-release checks: cabal is happy, the code builds, tests
 pass..
  check: setversion unittest doctest haddocktest
cabal clean
cabal check
cabal configure
cabal build

dist/build/hledger/hledger test 21 | tail -1 | grep -q 'Errors: 0
 Failures: 0'   |

You'd also want to test

cabal haddock
cabal test
cabal copy $(TMPDIR=$PWD mktemp -dt yow.XX)# untested

IMO even if your tests aren't implemented in Setup.lhs, you should still
teach cabal test how to run them.  That helps distributors like me
automatically run the test -- i.e. you get testing for free because we
don't have to go out of our way to turn it on.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Program using 500MB RAM to process 5MB file

2009-04-02 Thread lucas
On Thu, Apr 02, 2009 at 07:55:07PM -0400, Rick R wrote:
 You could profile your app for memory usage. Then you could figure out just
 what function is blowing up the mem usage and figure out how to optimize it.
 
 
 http://book.realworldhaskell.org/read/profiling-and-optimization.html
 
 
 2009/4/2 lu...@die.net.au
 
  I'm relatively new to haskell so as one does, I am rewriting an
  existing program in haskell to help learn the language.
 
  However, it eats up all my RAM whenever I run the program.
 
  http://hpaste.org/fastcgi/hpaste.fcgi/view?id=3175#a3175
 
  Obviously I'm doing something wrong, but without my magical FP pants I
  don't know what that might be.
 

I ran some profiling as suggested,

[SNIP]

total time  =8.36 secs   (418 ticks @ 20 ms)
total alloc = 3,882,593,720 bytes  (excludes profiling overheads)

COST CENTREMODULE   %time %alloc

line   PkgDb 89.7   93.5

COST CENTRE MODULE no. entries %time %alloc %time %alloc
linePkgDb  305 109771  89.7  93.3   89.7  93.3

[SNIP]

The line function is part of the file parser

line :: Parser String
line = anyChar `manyTill` newline

files' :: Parser Files
files' = line `manyTill` newline

Perhaps I should also explain the structure of the file. It's for a
simple package manager called pkgutils, used for CRUX[1]. The file
contains information for all the packages installed and is structured
as follows

package name
package version
file
file
...
file

package name
...

From profiling it shows that the memory is simple consumed by reading
in all the lines, the graph from using -p -hd shows an almost Ologn2
growth of the heap as the collection of lines grows.

Is there a better way to do this?

[1] http://crux.nu
-- 
Lucas Hazel lu...@die.net.au


pgplYxxA2pBsy.pgp
Description: PGP signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Program using 500MB RAM to process 5MB file

2009-04-02 Thread Luke Palmer
2009/4/2 lu...@die.net.au

 I'm relatively new to haskell so as one does, I am rewriting an
 existing program in haskell to help learn the language.

 However, it eats up all my RAM whenever I run the program.

 http://hpaste.org/fastcgi/hpaste.fcgi/view?id=3175#a3175

 Obviously I'm doing something wrong, but without my magical FP pants I
 don't know what that might be.


(1) You are using plain Strings.  Those things are like 8 bytes per
character (or something, someone more knowledgeable can give a more accurate
figure).  Use bytestrings (with bytestring-utf8 if you need it) instead.

(2) You are parsing strictly, meaning you have to read the whole input file
before anything can be output.  This may be necessary for your application,
but Haskell is *very* strong with streaming applications.  Change to a lazy
parser and you will run in constant memory.

(I don't know offhand of any lazy parsing libraries, but I've heard them
discussed before, so they're somewhere)

Luke
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Missing dependency?

2009-04-02 Thread Brandon S. Allbery KF8NH

On 2009 Apr 2, at 19:13, Lyle Kopnicky wrote:
Since the time package is not included in ghc-6.10.2, I installed it  
via cabal. Then I tried to configure my project, and it says that  
the dependency is missing. Mysterious. Can anyone explain?



You installed time in the per-user package dictionary, but by default  
Setup.hs uses only the global dictionary.  Try:


runhaskell Setup.hs --user

--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com
system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon universityKF8NH




PGP.sig
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] ANNOUNCE: fad 1.0 -- Forward Automatic Differentiation library

2009-04-02 Thread Bjorn Buckwalter
I'm pleased to announce the initial release of the Haskell fad
library, developed by Barak A. Pearlmutter and Jeffrey Mark Siskind.
Fad provides Forward Automatic Differentiation (AD) for functions
polymorphic over instances of 'Num'. There have been many Haskell
implementations of forward AD, with varying levels of completeness,
published in papers and blog posts[1], but alarmingly few of these
have made it into hackage -- to date Conal Elliot's vector-spaces[2]
package is the only one I am aware of.

Fad is an attempt to make as comprehensive and usable a forward AD
package as is possible in Haskell. However, correctness is given
priority over ease of use, and this is in my opinion the defining
quality of fad. Specifically, Fad leverages Haskell's expressive
type system to tackle the problem of _perturbation confusion_,
brought to light in Pearlmutter and Siskind's 2005 paper Perturbation
Confusion and Referential Transparency[3]. Fad prevents perturbation
confusion by employing type-level branding as proposed by myself
in a 2007 post to haskell-cafe[4]. To the best of our knowledge all
other forward AD implementations in Haskell are susceptible to
perturbation confusion.

As this library has been in the works for quite some time it is
worth noting that it hasn't benefited from Conal's ground-breaking
work[5] in the area. Once we wrap our heads around his beautiful
constructs perhaps we'll be able to borrow some tricks from him.

As mentioned already, fad was developed primarily by Barak A.
Pearlmutter and Jeffrey Mark Siskind. My own contribution has been
providing Haskell infrastructure support and wrapping up loose ends
in order to get the library into a releasable state. Many thanks
to Barak and Jeffrey for permitting me to release fad under the BSD
license.

Fad resides on GitHub[6] and hackage[7] and is only a cabal install
fad away! What follows is Fad's README, refer to the haddocks for
detailed documentation.

Thanks,
Bjorn Buckwalter


[1] http://www.haskell.org/haskellwiki/Functional_differentiation
[2] http://www.haskell.org/haskellwiki/Vector-space
[3]:  http://www.bcl.hamilton.ie/~qobi/nesting/papers/ifl2005.pdf
[4]: http://thread.gmane.org/gmane.comp.lang.haskell.cafe/22308/
[5]: http://conal.net/papers/beautiful-differentiation/
[6] http://github.com/bjornbm/fad/
[7] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/fad




   Copyright  : 2008-2009, Barak A. Pearlmutter and Jeffrey Mark Siskind
   License: BSD3

   Maintainer : bjorn.buckwal...@gmail.com
   Stability  : experimental
   Portability: GHC only?

Forward Automatic Differentiation via overloading to perform
nonstandard interpretation that replaces original numeric type with
corresponding generalized dual number type.

Each invocation of the differentiation function introduces a
distinct perturbation, which requires a distinct dual number type.
In order to prevent these from being confused, tagging, called
branding in the Haskell community, is used.  This seems to prevent
perturbation confusion, although it would be nice to have an actual
proof of this.  The technique does require adding invocations of
lift at appropriate places when nesting is present.

For more information on perturbation confusion and the solution
employed in this library see:
http://www.bcl.hamilton.ie/~barak/papers/ifl2005.pdf
http://thread.gmane.org/gmane.comp.lang.haskell.cafe/22308/


Installation

To install:
cabal install

Or:
runhaskell Setup.lhs configure
runhaskell Setup.lhs build
runhaskell Setup.lhs install


Examples

Define an example function 'f':

 import Numeric.FAD
 f x = 6 - 5 * x + x ^ 2  -- Our example function

Basic usage of the differentiation operator:

 y   = f 2  -- f(2) = 0
 y'  = diff f 2 -- First derivative f'(2) = -1
 y'' = diff (diff f) 2  -- Second derivative f''(2) = 2

List of derivatives:

 ys = take 3 $ diffs f 2  -- [0, -1, 2]

Example optimization method; find a zero using Newton's method:

 y_newton1 = zeroNewton f 0   -- converges to first zero at 2.0.
 y_newton2 = zeroNewton f 10  -- converges to second zero at 3.0.


Credits
===
Authors: Copyright 2008,
Barak A. Pearlmutter ba...@cs.nuim.ie 
Jeffrey Mark Siskind q...@purdue.edu

Work started as stripped-down version of higher-order tower code
published by Jerzy Karczmarczuk jerzy.karczmarc...@info.unicaen.fr
which used a non-standard standard prelude.

Initial perturbation-confusing code is a modified version of
http://cdsmith.wordpress.com/2007/11/29/some-playing-with-derivatives/

Tag trick, called branding in the Haskell community, from
Bjorn Buckwalter bjorn.buckwal...@gmail.com
http://thread.gmane.org/gmane.comp.lang.haskell.cafe/22308/


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Wishful thinking: a text editor that expands function applications into function definitions

2009-04-02 Thread Michael Snoyman
2009/4/3 Duane Johnson duane.john...@gmail.com

 Perhaps it wouldn't be as all-wonderful as I think, but as a new Haskell
 user, I am constantly switching back and forth between various definitions
 of things trying to compare documentation and files...
 The purpose of expansion as I was explaining it is not to *permanently
 replace* what is in the text, but rather to *temporarily replace* it.  I
 imagine it kind of like a zoom in for code.  You could zoom in on one
 function, and seeing a new function that you don't recognize, zoom in
 again, and so on.  Once done, you would hit ESC to make it all return as
 it was.


Sounds exactly like the F9 feature in Excel (that's where you got the idea,
right?). I can personally attest that it can be an incredibly useful
feature.

Michael
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wishful thinking: a text editor that expands function applications into function definitions

2009-04-02 Thread Zachary Turner
On Thu, Apr 2, 2009 at 9:33 PM, Michael Snoyman mich...@snoyman.com wrote:



 2009/4/3 Duane Johnson duane.john...@gmail.com

 Perhaps it wouldn't be as all-wonderful as I think, but as a new Haskell
 user, I am constantly switching back and forth between various definitions
 of things trying to compare documentation and files...
 The purpose of expansion as I was explaining it is not to *permanently
 replace* what is in the text, but rather to *temporarily replace* it.  I
 imagine it kind of like a zoom in for code.  You could zoom in on one
 function, and seeing a new function that you don't recognize, zoom in
 again, and so on.  Once done, you would hit ESC to make it all return as
 it was.


 Sounds exactly like the F9 feature in Excel (that's where you got the idea,
 right?). I can personally attest that it can be an incredibly useful
 feature.

 Michael


I actually wasn't thinking about temporarily replacing it.  That sounds
cooler than how I originally interpreted it :)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] List and description of language extensions

2009-04-02 Thread Michael Snoyman
It's been multiple times now that I've been confounded by something in
Haskell which was then solved by a language extension (first
FunctionalDependencies, most recently ScopedTypeVariables). I'm wondering if
there is a list anywhere of all the language extensions supported by GHC and
a brief description of them. I looked around, but couldn't find one. If
there isn't one, would others be willing to fill one in on the Haskell wiki?
I'll do what I can, but I obviously have a very limited knowledge of the
extensions available.

Thanks,
Michael
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wishful thinking: a text editor that expands function applications into function definitions

2009-04-02 Thread Duane Johnson
I hadn't seen that feature in Excel before.  When I press F9 it seems  
to evaluate the expression, which isn't quite what I had in mind (Mac  
OS).  Is that the same as what you get?


Duane

On Apr 2, 2009, at 8:33 PM, Michael Snoyman wrote:




2009/4/3 Duane Johnson duane.john...@gmail.com
Perhaps it wouldn't be as all-wonderful as I think, but as a new  
Haskell user, I am constantly switching back and forth between  
various definitions of things trying to compare documentation and  
files...


The purpose of expansion as I was explaining it is not to  
*permanently replace* what is in the text, but rather to  
*temporarily replace* it.  I imagine it kind of like a zoom in for  
code.  You could zoom in on one function, and seeing a new  
function that you don't recognize, zoom in again, and so on.  Once  
done, you would hit ESC to make it all return as it was.


Sounds exactly like the F9 feature in Excel (that's where you got  
the idea, right?). I can personally attest that it can be an  
incredibly useful feature.


Michael



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Program using 500MB RAM to process 5MB file

2009-04-02 Thread Sterling Clover
I also suspect that manyTill is a really bad choice, since it doesn't  
give you anything until the end token. It would be much better if you  
could rewrite your parser in terms of many and many1.


--Sterl

On Apr 2, 2009, at 10:08 PM, Luke Palmer wrote:


2009/4/2 lu...@die.net.au
I'm relatively new to haskell so as one does, I am rewriting an
existing program in haskell to help learn the language.

However, it eats up all my RAM whenever I run the program.

http://hpaste.org/fastcgi/hpaste.fcgi/view?id=3175#a3175

Obviously I'm doing something wrong, but without my magical FP pants I
don't know what that might be.

(1) You are using plain Strings.  Those things are like 8 bytes per  
character (or something, someone more knowledgeable can give a more  
accurate figure).  Use bytestrings (with bytestring-utf8 if you  
need it) instead.


(2) You are parsing strictly, meaning you have to read the whole  
input file before anything can be output.  This may be necessary  
for your application, but Haskell is very strong with streaming  
applications.  Change to a lazy parser and you will run in constant  
memory.


(I don't know offhand of any lazy parsing libraries, but I've heard  
them discussed before, so they're somewhere)


Luke

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Loading C object files into ghci

2009-04-02 Thread Murray
Hi Cafe,

A quick question:

Is there a way to load a C object file associated with FFI imports into ghci 
after invocation (or in a .ghci file)?  I've checked the docs as carefully 
as I can and can't find anything.

Naming the file on the command line works of course but I was hoping for 
something I could keep in a per-directory .ghci file so that emacs and yi
interactive modes work properly.

I know I can (setq haskell-program-name
  ghci /long/path/to/my/project/build/dist/.../blah.o)
for emacs but I think it's hard-coded in yi.

Sorry if this is obvious, or a FAQ.

Murray.
mur...@sonology.net
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Program using 500MB RAM to process 5MB file

2009-04-02 Thread Jason Dagit
2009/4/2  lu...@die.net.au:
 On Thu, Apr 02, 2009 at 07:55:07PM -0400, Rick R wrote:
 You could profile your app for memory usage. Then you could figure out just
 what function is blowing up the mem usage and figure out how to optimize it.


 http://book.realworldhaskell.org/read/profiling-and-optimization.html


 2009/4/2 lu...@die.net.au

  I'm relatively new to haskell so as one does, I am rewriting an
  existing program in haskell to help learn the language.
 
  However, it eats up all my RAM whenever I run the program.
 
  http://hpaste.org/fastcgi/hpaste.fcgi/view?id=3175#a3175
 
  Obviously I'm doing something wrong, but without my magical FP pants I
  don't know what that might be.
 

 I ran some profiling as suggested,

 [SNIP]

 total time  =        8.36 secs   (418 ticks @ 20 ms)
 total alloc = 3,882,593,720 bytes  (excludes profiling overheads)

 COST CENTRE                    MODULE               %time %alloc

 line                           PkgDb                 89.7   93.5

 COST CENTRE MODULE no. entries %time %alloc %time %alloc
 line        PkgDb  305 109771  89.7  93.3   89.7  93.3

 [SNIP]

 The line function is part of the file parser

 line :: Parser String
 line = anyChar `manyTill` newline

 files' :: Parser Files
 files' = line `manyTill` newline

 Perhaps I should also explain the structure of the file. It's for a
 simple package manager called pkgutils, used for CRUX[1]. The file
 contains information for all the packages installed and is structured
 as follows

 package name
 package version
 file
 file
 ...
 file

 package name
 ...

 From profiling it shows that the memory is simple consumed by reading
 in all the lines, the graph from using -p -hd shows an almost Ologn2
 growth of the heap as the collection of lines grows.

 Is there a better way to do this?

In this case the syntax of your file seems pretty simple.  Someone
else suggested a streaming approach.  Putting those ideas together, I
defined testInput as follows:

testInput = package name\n
  ++package version\n
  ++file\n
  ++file\n
  ++...\n
  ++file\n
  ++\n
  ++package name\n
  ++...\n

Here is an interactive experiment I tried:
GHCi :t lines
lines :: String - [String]
GHCi lines testInput
[package name,package
version,file,file,...,file,,package name,...]

Okay, looks we can use 'lines' from the Prelude to split the input into lines.

GHCi :t cycle
cycle :: [a] - [a]
GHCi :t cycle testInput
cycle testInput :: [Char]

Using cycle on the testInput like this will give us an infinite input
that we can use to see if we have a streaming approach.

GHCi take 10 $ lines $ cycle testInput
[package name,package
version,file,file,...,file,,package
name,...,package name]

Success.  So if you like, you could use something like hGetContents
that reads a file lazily, run lines over the file and get a lazy
stream of the file lines.  Then you can use something like takeWhile
to take lines until you hit an empty line to build up your parsing
functions.

You could experiment with bytestrings, but in this particular
application I wouldn't expect to see a huge benefit.  Here I think you
can run in space proportional to the longest list of files that you
encounter in the input.

Hope that helps,
Jason
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] List and description of language extensions

2009-04-02 Thread Brandon S. Allbery KF8NH

On 2009 Apr 3, at 0:00, Michael Snoyman wrote:
It's been multiple times now that I've been confounded by something  
in Haskell which was then solved by a language extension (first  
FunctionalDependencies, most recently ScopedTypeVariables). I'm  
wondering if there is a list anywhere of all the language extensions  
supported by GHC and a brief description of them. I looked around,  
but couldn't find one. If there isn't one, would others be willing  
to fill one in on the Haskell wiki? I'll do what I can, but I  
obviously have a very limited knowledge of the extensions available.



http://www.haskell.org/ghc/docs/latest/html/users_guide/ghc-language-features.html

--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com
system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon universityKF8NH




PGP.sig
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wishful thinking: a text editor that expands function applications into function definitions

2009-04-02 Thread Michael Snoyman
On Fri, Apr 3, 2009 at 7:07 AM, Duane Johnson duane.john...@gmail.comwrote:

 I hadn't seen that feature in Excel before.  When I press F9 it seems to
 evaluate the expression, which isn't quite what I had in mind (Mac OS).  Is
 that the same as what you get?
 Duane


Yeah, it's the same feature. It's just that in Excel, the functions always
return a value, not an expression. For example, a VLOOKUP doesn't call other
Excel functions to return the result, it simply calculates what you're
looking for. Hope that made sense.

Michael
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe