Re: [Haskell-cafe] FLTK GUI Binding in progress. Call for participation.

2013-09-08 Thread John Lask

On 9/09/2013 7:09 AM, aditya siram wrote:

Hi all,
I'm working on a FLTK [1] GUI binding [2]. The attraction of FLTK is that


there is an existing binding on hackage:

hs-fltk library: Binding to GUI library FLTK


which I understand is quite serviceable. Perhaps effort could be 
directed on making improvements (should they be required) to this rather 
than duplicating existing functionality.




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


[Haskell-cafe] searching the attic for lambada

2013-02-13 Thread John Lask


I'm interested in resurrecting the idl generator from lambada:

http://www.dcs.gla.ac.uk/mail-www/haskell/msg02391.html

is the code out there in anyone's attic?


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


[Haskell-cafe] Predictive parser combinators need four values to report errors

2012-08-18 Thread John Lask

I am unable to find a copy of the following paper:

Andrew Partridge, David Wright:
Predictive parser combinators need four values to report errors.
Journal of Functional Programming 6(2): 355-364, 1996

does any one have a copy of, that they could send me ?

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


Re: [Haskell-cafe] FreeSect -- generalised sections syntax extension

2012-03-01 Thread John Lask




On Wed, Feb 29, 2012 at 9:27 PM, Ras Farras...@gmail.com  wrote:

Hello,

I bit premature perhaps but I wanted to post it on a leap day...

http://fremissant.net/freesect

Thanks for eyebloom on #haskell for motivating me to finally implement
an old idea.  Thanks to the rest on #haskell for doing their best to
talk me out of it. ;)

I make no claims regarding the usefulness of the extension, but some
folks might find it interesting, or may just appreciate additional
examples of using HSE and SYB.  I regret that I am not a better
Haskell coder, but it is what it is!

Kind Reg'ds,
Andrew Seniuk (rasfar)





why couldn't you use standard brackets ( to delimit the extent ? I 
suppose that would have added complexity to the syntax analysis, however 
I think it would have been (in my mind) neater.



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


Re: [Haskell-cafe] Idris

2012-01-22 Thread John Lask

On 21/01/2012 5:45 AM, Ryan Ingram wrote:

Has anyone played with Idris (http://idris-lang.org/) at all?  It looks
interesting, and I'd love to play with it, but unfortunately I only have
windows machines up and running at the moment and the documentation seems
to imply it only builds on unixy systems.

I'm curious how difficult it would be to get a win32 implementation up and
running.

   -- ryan


Idris itself will compile straightforwardly (although there are some 
shell dependencies that needs to be bypassed), the os dependent stuff is 
contained in the library epic upon which idris depends, which wraps some 
c code which is os dependent (#defines and other cruft).


The long and short of it is, I have hacked it (both epic  idris) to 
compile on windows. However, I have not debugged it, so that it works 
properly (I have taken some liberties/shortcuts to get it to compile).


I have not had any time to progress this further and probably won't for 
the foreseeable future. I can make my hacked code available to you, 
together with my notes. I imagine it would require a couple of days 
effort to correct and ensure that it works properly, testing it etc 
(depending on how far you want to go).


Contact me off the email list if interested.

jvl

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


Re: [Haskell-cafe] black Wikipedia

2012-01-18 Thread John Lask




This bill cannot be fixed; it must be killed. - The EFF



yes the act is pernicious, and may cause the wholesale relocation of 
content out of the US, to friendlier places like China, perhaps!



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


Re: [Haskell-cafe] Generating Code

2011-12-11 Thread John Lask




It occurs to me that c2hs (or more appropriately the gtk2hsc2hs fork) is
intended to solve this problem; have you looked into it?




hdirect falls into this category as well

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


Re: [Haskell-cafe] How to implement digital filters using Arrows

2011-11-01 Thread John Lask



I can't comment on using ghci debugger to observe evaluation. I have in 
the past used hood (http://hackage.haskell.org/package/hood) and found 
it both convenient and useful when trying to observe evaluation order.


On 2/11/2011 7:00 AM, Captain Freako wrote:

Hi John,

I'm trying to use the GHCI debugger on this code:

  20 instance ArrowLoop SF where
  21 loop (SF f) = SF $ \as -
  22 let (bs, cs) = unzip (f (zip as (stream cs))) in bs
  23   where stream ~(x:xs) = x : stream xs
  24
  25 swap :: (a,b) -  (b,a)
  26 swap (x,y) = (y,x)

in order to watch the recursion of the `loop' function unfold.
However, when I single step through the code, I never stop on line 22
(where I could, presumably, peek in at `bs' and `cs', in order to see
them develop):



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


Re: [Haskell-cafe] How to implement digital filters using Arrows

2011-10-31 Thread John Lask

On 1/11/2011 1:35 AM, Captain Freako wrote:

you need to study ArrowLoop and understand that. In the code

rec (y,s')- arr f -  (x,s)
s- delay s0 -  s'

the state is 'captured' in the recursive binding. i.e. just like in real 
circuits the output state s is threaded back as an input.


The recursive binding is just sugar for the application of the loop 
combinator. The signature of the loop combinator is


loop :: arrow (input, feedback) (output, feedback) - arrow input output

with the loop combinator (with which recursive arrow bindings are 
defined) the function could have been defined as...


liftAu f s0 = loop (second (delay s0)  arr f )

the delay is neccessary to break the recursion. i.e. to calculate the 
next output and state the previous state is used.




liftAu :: ((x,FilterState s)-(y,FilterState s)) -  FilterState s -
FilterAu x y
liftAu f s0 = proc x -  do
   rec (y,s')- arr f -  (x,s)
   s- delay s0 -  s'
   returnA -  y



I think I understand how the `returnA' in the last line of your
`liftAu' function is getting translated by those instance definitions
into:

c where
c = Automaton ( arr id  arr (const c) )

and, furthermore, how that is passing the supplied `y' into the first
element of the resulting couple. However, I don't understand how the
recursively defined `c' is capturing the modified filter state and
preserving it for the next call. It seems like the Automaton being
referred to by `c' is a newly constructed entity, which knows nothing
about the current state of the running Automaton.

Any help in understanding this would be greatly appreciated.

Thanks!
-db





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


Re: [Haskell-cafe] How to implement a digital filter, using Arrows?

2011-10-20 Thread John Lask

On 21/10/2011 3:00 AM, David Barbour wrote:

the f in (Automaton f) is a pure funtion runAuto is deconstructing the 
arrow by pattern matching then applying the function to the input to 
obtain the result and the continuation.


i.e. runAuto takes an arrow and applies it to a value.


On Thu, Oct 20, 2011 at 5:19 AM, Captain Freakocapn.fre...@gmail.comwrote:


Hi David,

I was referring to the `f' in the `runAuto' function, not the `liftAu'
function.

-db



Ah, I see. You quoted one thing and spoke of another, and I got all
confused. Keep in mind that functions are arrows (instance Arrow (-)).


type FilterAu b c = Automaton (-) b c
runAuto :: FilterAu b c -  [b] -  [c]
runAuto a [] = []
runAuto (Automaton f) (x:xs) = let
   (y,a) = f x
   in y:runAuto a xs





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


Re: [Haskell-cafe] How to implement a digital filter, using Arrows?

2011-10-19 Thread John Lask

On 20/10/2011 5:11 AM, Captain Freako wrote:

for your use case then, the StateArrow seems more appropriate as it 
provides you with the final state. Ofcourse the Automaton arrow could 
also be used:


 liftAu' f s0 = proc x - do
rec (y,s') - arr f - (x,s)
s - delay s0 - s'
returnA - (y,s)

this explicitly returns the state with evry value. However, you then 
need to manually thread the state through.


note: the arrow plumbing is only used when you start composing 
filters, with arrow combinators. If your not doing any composition as

such then lifting your functions into the arrows is not buying you much.


John Lask wrote:


This is literate code. It expounds on your initial question and provides
two solutions based either on the StateArrow or Automaton
(Remainder omitted.)


John,

Thanks so much for your help!
I'm going to study your example code and try to understand how the
Automaton implicit plumbing is being used.
(I'm determined to get my head around this arrow concept, damn it! ;-) )

I wonder if I might pester you for the final piece of the puzzle here:
When the processing of the input stream through the filter is
complete, I need to pass the final filter state, along with the output
stream, back to the calling program.
(This is because the calling program is going to split the input
signal into conveniently sized chunks, calling my filter routine
several times, in order to process the entire input stream. It expects
to be able to pass an initial filter state into my routine, which is
just the final state of the filter that I passed back to it after the
previous call. In this way, we avoid inserting any edge artifacts at
the input stream segmentation boundaries.)

So, is it possible to `fetch' the final state out of that Automaton,
when it's finished processing the input list?

Thanks!
-db





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


Re: [Haskell-cafe] How to implement a digital filter, using Arrows?

2011-10-18 Thread John Lask


 {-# LANGUAGE Arrows #-}

This is literate code. It expounds on your initial question and provides
two solutions based either on the StateArrow or Automaton

 module Test where
 import Data.List ( mapAccumL )
 import Control.Arrow
 import Control.Arrow.Operations
 import Control.Arrow.Transformer
 import Control.Arrow.Transformer.State
 import Control.Arrow.Transformer.Automaton

this later formulation corresponds to Control.Arrow.Transformer.State

 data FilterState a = FilterState {
  as   :: [a] -- transfer function denominator coefficients
, bs   :: [a] -- transfer function numerator coefficients
, taps :: [a] -- current delay tap stored values
}


  -- Time domain convolution filter (FIR or IIR),
  -- expressed in direct form 2
 convT =  \(x, s) -
  let wk = (x - sum [a * t | (a, t)- zip (tail $ as s) (taps s)])
  newTaps = wk : ((reverse . tail . reverse) $ taps s)
  s' = s {taps = newTaps}
  y  = sum [b * w | (b, w)- zip (bs s) (wk : (taps s))]
  in (y, s')

we can construct the type of a Filter as a state arrow with state
(FilterState s) and base arrow type of (-)

 type FilterSt s b c = StateArrow (FilterState s) (-) b c

to lift the function convT to a state arrow it would be very
easy if the constructor were exported (ie. ST convT), however it is not. So
we define a custom lift to lift functions of the above type into the arrow

 liftSt :: ((x,FilterState s)-(y,FilterState s)) - FilterSt s x y
 liftSt f = proc x - do
s - fetch - ()
(y,s') - arr f - (x,s)
store - s'
returnA - y

then to fold the arrow over a list of inputs

 runFilterSt :: FilterSt s b c - (FilterState s) - [b] - 
(FilterState s , [c])

 runFilterSt f =  mapAccumL (curry (swap . runState f . swap))
   where
 swap (a,b) = (b,a)


 t1 = let
   s = FilterState [1,0,0] [0.7, 0.2, 0.1] [0, 0, 0]
  in snd $ runFilterSt (liftSt convT) s [1,0,0,0,0]


*Test t1
[0.7,0.2,0.1,0.0,0.0]


except I am not sure you want a state arrow as that propogates the state
through all arrows. eg in a  b, the state modified by a passes to b 
and so on.
This would only be any good if all your filters shared/modified the same 
state.


the initial suggestion was to use an automaton arrow which isolates the 
state

in each arrow.




 type FilterAu b c = Automaton (-) b c

 liftAu :: ((x,FilterState s)-(y,FilterState s)) - FilterState s - 
FilterAu x y

 liftAu f s0 = proc x - do
rec (y,s') - arr f - (x,s)
s - delay s0 - s'
returnA - y


runAutomaton is a bit cumbersome, so define a custom run function that
takes a list

 runAuto a [] = []
 runAuto (Automaton f) (x:xs) = let
   (y,a) = f x
   in y:runAuto a xs



 t2 = let
   s = FilterState [1,0,0] [0.7, 0.2, 0.1] [0, 0, 0]
  in runAuto (liftAu convT s) [1,0,0,0,0]



*Test t2
[0.7,0.2,0.1,0.0,0.0]


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


Re: [Haskell-cafe] How to implement a digital filter, using Arrows?

2011-10-17 Thread John Lask



your function corresponds with Control.Arrow.Transformer.Automaton. If 
you frame your function is such most of your plumbing is taken care of.


http://hackage.haskell.org/packages/archive/arrows/0.4.1.2/doc/html/Control-Arrow-Transformer-Automaton.html

On 18/10/2011 1:46 PM, Captain Freako wrote:

Hi all,

If I have a pure function, which maps `(input, initialState)' to `(output,
nextState)', what's the most succinct way of constructing a digital filter
from this function, using Arrows?

Thanks,
-db




___
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: mecha-0.0.5

2011-06-05 Thread John Lask

On 6/06/2011 3:58 AM, Tom Hawkins wrote:


Another goal of the project is to generate 2D prints from 3D models.
Any idea how hard is this going to be?  Basically it needs to identify
features (holes, edges, etc), then project these features to an
orthographic plane, alone with associated dimensions.




are you familiar with Jan Sabinski's solid modelling in Haskell 
http://web.archive.org/web/20010605003250/http://www.numeric-quest.com/haskell/


he implements 3D projects onto 2D plane (although no feature selection 
etc) and is more a proof of principle.


if you are interested in industrial strength solutions, I can recommend 
the openCascade (http://www.opencascade.org/) library. A Haskell binding 
would be very useful and something that I have thought about doing for 
some time, but alas had no time for.


jvl

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


Re: [Haskell-cafe] Status of Haskell + Mac + GUIs graphics

2011-05-19 Thread John Lask

On 19/05/2011 10:31 PM, Heinrich Apfelmus wrote:

my comments for what their worth:

(1) wx and ghci: I successfully run wx in ghci (albeit) on windows. I 
take an alternative path to that proscribed by the current build process 
- I think principally so that I am able to run it in ghci, although I 
can not now recall the exact reason why I took the different route.


The current build process links the haskell wxcore library against the 
wxwdigets libraries directly. Once upon a time, the wxlibraries were 
wrapped as a C (dll) library, and the haskell libraries linked against 
this. I choose this route, and have no problems loading wxwdigets 
applications in ghci (on windows) ... and using OpenGL with them.


(2) on the question of GUI libraries in general.

I remind readers that the discussion of a GUI for haskell is no new 
thing, (cf. GUI API Taskforce)


http://www.haskell.org/pipermail/haskell/2001-September/007960.html
http://comments.gmane.org/gmane.comp.lang.haskell.gui/7
... and many more ...

a lot of which has been said recently, has been said before (it does
not make it less relevant, though) ...

there are two very different responses, the tactical and the strategic, 
they generally have very different time frames and cost (effort) required.


A tactical response might be to ensure that one of the (many) currently 
existing libraries (wxHaskell, qtHaskell, hs-fltk...) built and operated 
problem free on all platforms.


Whereas, a strategic response might be to have a cross platform gui 
library binding to low level platform libraries (Win32, X11, Cocoa)


Of course there are all sorts of variants in between.

A general problem with strategic response is they underestimate the 
effort required due to the long range horizon and the uncertainties 
involved.


if the question is what will provide me with the tools that I need today 
or tomorrow, which is the more efficacious response?




Conal Elliott wrote:

Last I heard, wx still had the problem of crashing its host the second
time
one opens a window (which is typical in ghci). And last I heard, Jeremy
O'Donoghue (cc'd) was exploring solutions but had very little time to
pursue
them. - Conal


Last I remember, the latest problem is that ghci is unable to link
libstdc++. But the crash problem is probably still there.


Best regards,
Heinrich Apfelmus

--
http://apfelmus.nfshost.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] Open CV or alternate image processing library for Haskell on windows?

2011-05-18 Thread John Lask

On 18/05/2011 2:02 PM, Ville Tirronen wrote:

Hello,

I have successfully* built HOpenCV on windows with openCV 2.0 on windows 
(XP).


* by successfully, I mean compiled and linked, library and test.hs. The 
test did give

me an error:

test-hopencv.exe: user error (Failed to create camera)

which, I have not bothered to follow up any further.

The build process was as follows (your paths will differ):

1) I installed openCV to C:\apps\OpenCV2.0
2) I unzipped HOpenCV-0.1.2.2 to some directory
3) edited cabal file

edited the following entries to
  include-dirs: c:\apps\OpenCV2.0\include\opencv
  extra-lib-dirs: c:\apps\OpenCV2.0\lib

and also edited the extra-libraries to ...
  extra-libraries: highgui200, cv200, cxcore200

4) then

set Path=%PATH%;c:\apps\OpenCV2.0\bin
unless when installing OpenCV you added the install path to your path..

5) then

ghc Setup build --hsc2hs-options=-L -Wl,-(

the --hsc2hs-options=-L -Wl,-( option is neccessary in order to ovoid 
errors like


dist\ghc\6.12.3\build\AI\CV\OpenCV\CV_hsc_make.o:CV_hsc_make.c:(.text+0x85a): 
un

defined reference to `cvFree_'

for some reason (and I really can't understand why) gcc requires the 
highgui200, cv200, cxcore200
libraries after the object (normally dosn't) and the -L -Wl,-( 
instructs hsc2hs to pass -Wl,-C
to gcc, which in turn instructs gcc to pas -( to the linker which in 
turn tells the linker
to re-read the libraries to resolve the references. (somewhere something 
is going wrong)


6) run the test ...



Hi,

Yes, I understand that - but if there is some install or usage dependency,

or install procedure, I would hope to see it documented somewhere; perhaps I
missed that?




The only installation procedure I can document is how to do this in linux.
My guess is that it must be similar with windows.

1. Get the opencv library from opencv.willowgarage.com
2. Install it and make a note where it installs
3. cabal install CV. If this fails with missing C libraries, then,
(4). cabal install CV --with-extra-lib-dirs=where_the_opencv_libs_are
--with-extra-include-dirs=where_the_opencv_includes_are

However, wait few hours so I can push a new version to hackage. There are
few things I've already discovered that fail to work with other people and I
think I can fix them.

Disclaimer:
The CV package is something I threw together, originally in pre-cabal times.
Back then I arguably wasn't a very good haskell-programmer and the whole
thing was under an nda. Since then I've casually evolved the library to suit
my needs. After I saw CV-combinators library released I made a petition to
publish my codes in hopes that it would help other people doing similar
things.

In short, although CV package is very very useful for me, it is not a
perfect binding, and the implementation isn't really smart at places. I
would like to make it great, however.








___
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] GPL License of H-Matrix and prelude numeric

2011-01-25 Thread John Lask

On 26/01/2011 1:52 PM, Ivan Lazar Miljenovic wrote:



In which case, why not ask the author(s) directly rather than blindly
asking the mailing list?



others, such as I, may be interested in the answer.

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


[Haskell-cafe] getDirectoryContents and sort order

2011-01-24 Thread John Lask
I have noticed that on my windows box and ghc 6.12.3 I get the return 
list for System.Direcotry.getDirectoryContents in reverse sorted order. 
This is a change from previous observed behavior and I would consider it 
a bug. I would like to verify that it is not just me.


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


Re: [Haskell-cafe] Zipper with two focii for concurrent fun

2011-01-16 Thread John Lask



see http://okmij.org/ftp/continuations/Continuations.html, Zipper-based 
file server/OS, aka ZFS


where Oleg addresses concurrent operations on a shared data structure 
with multiple mutable cursors implemented via delimited continuations 
with varying isolation levels  ...


your issues are specifically addressed.

jvl



On 17/01/2011 5:20 PM, Yaakov M. Nemoy wrote:


Hey List,

So i've been pondering zippers in a concurrent situation, where more
than one thread has access to the same data structure, but with
different focal points. I've gotten a bit stuck though trying to
figure out how to do this using a zipper. The use case i'm thinking of
is slightly more complex, but using a basic example below should
suffice for an explanation.

Say we have a list of characters in a text file which we're using in
the form of a zipper to show the current user's cursor position in the
text file. This means a data type such as:

data ZipperList a = ZL [a] a [a]

where the second element is the current position of the cursor. Now as
long as one user is editing the text file, we're fine.

Now let's say we're working on a newfangled multipointer desktop where
two users have a keyboard and mouse each and want to work on the same
open file. We could have a list like this:

data ZipperList a = ZL [a] a [a] a [a]

which leaves us with a number of limitations. We're now limited to two
cursors rather than one, but once we start assuming multipointer, two
seems like a bigger limitation than just one cursor. Also, we can't
tell which user is at which focal point of the zipper easily.

We could replace the user with:

data User a = User String a

data ZipperList a = ZL [a] (User a) [a] (User a) [a]

but that gets into some ugly pattern matching. It still leaves us
stuck with a two user limit.

Say we create a zipper that can contain other zippers. Such as:

data ZipperList a = ZL (ZipperList a) a (ZipperList a) | L [a]

which lets us include as many users as we want. Now this creates a
very different problem. Each cursor in our fictional text editor has a
totally different data structure. This is how any calculation at any
cursor knows where in the text file it is. If one user edits the
character at the cursor, every other zipper-like data structure has to
be updated for each other users. Thus a huge concurrency issue.

This is where i hit a block. Am i totally crazy in thinking i can
solve this problem using a zipper? Or has someone thought about this
problem already and perhaps there's even a paper on it? Please advise.

-Yaakov

___
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 Directed Name Resolution

2010-11-11 Thread John Lask

On 11/11/2010 5:21 PM, Ketil Malde wrote:

Richard O'Keefeo...@cs.otago.ac.nz  writes:


it is often desirable to have the same field names
for many records in the same module.




very much so, this is currently possible, with the restriction that
the field names must have the same type modulo the record it is 
selecting on.


what is disirable is that this restriction be lifted.


I'm not sure that it is desirable to have many records in the
same module in the first place.




this should really be a choice of the programmer.


One possibility might be to allow mulitple module definitions in the
same file, making it easier to wrap each record in its own module
without running into a Java-like forest of files.



a module represents a compilation unit which happens to be a file, in 
haskell it also represents a name space and a means for control of that 
namespace. Compilation units and name space management are orthoganal 
issues although obviously connected. SML for example manages the name 
space with Functors and does not explicitly name the compilation units, 
haskell names the compilation units i.e. modules, but I have had some 
thoughts along the same lines, myself, more on this later ..



discussion of the haskell record system and syntax has a long history, 
just a quick search ...


http://www.mail-archive.com/hask...@haskell.org/msg17725.html
http://www.haskell.org/pipermail/haskell-prime/2006-March/000836.html
http://www.mail-archive.com/hask...@haskell.org/msg13394.html
http://www.mail-archive.com/hask...@haskell.org/msg20516.html

in 2003

http://research.microsoft.com/en-us/um/people/simonpj/Haskell/records.html

I quote

Haskell lacks a serious record system. (The existing mechanism for 
named fields in data types was always seen as a stop-gap measure.) At 
the 1999 Haskell Workshop, Mark Jones and Simon Peyton Jones proposed a 
more fully-fledged record system, closely modelled on the TRex system 
implemented in Hugs. But Simon never got around to implementing it in 
GHC. Why not? Mainly because the implementation cost turned out to be 
relatively high.


.. in the intervening years we have GADTS, type families, associated 
types tec ... but with respect to records what has changed ?



In my mind, the feature that I most wish for, and what haskell lacks is 
the ability to manage the module name space with respect to record label 
names. Yes, I often want to define a record with the same label name at 
a different type.


many languages have a construct with record which unqualifies the 
names introduced by the record definition, those names being implicitly 
qualified when defined. Haskell label names are implicitly unqualified.


I have often thought that a minimal extension to Haskell compatible with 
the current record system that could ameliorate the situation would be


data Foo = Foo { label1 :: Int, label2 :: String } qualified

where such a qualified data declaration would hide labels label1 and 
label2, making the available only as Foo.label1, Foo.label2., etc


where we have a qualified record we should be able to unqualify it as

import data Foo

or rename it

import data Foo qualified as Bar

which would introduces Bar.label1, Bar.label2

etc.

None of the above is incompatible with the current record system and 
introduces no new keywords. This proposal solely addresses the issue of 
name space management.




(I've proposed this before, and although I don't remember the specifics,
ISTR the response being mostly negative.)

-k


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


Better Records was Re: [Haskell-cafe] Type Directed Name Resolution

2010-11-11 Thread John Lask



 If the outcome of this discussion is a clamour for better records
 instead of TDNR, then that would certainly make me happy.

 Regards,
 Malcolm

well I certainly am clamouring for better records.


This motivated my original reply this post. The trouble is, what
constitutes better records? There are as many views as users of Haskell, 
I bet.


My main motivation is:

As mentioned in my original post: better name space management.

Surprisingly enough, I find the current record system is quite usable, 
bar one feature. My particular use case: commercial applications make 
heavy use of records (in connection with relational databases) and name 
clashes are inevitable.


As I tried to point out in my original post, issues of name space 
management are orthogonal to the type system, but obviously related as 
the type system in Haskell is used to distinguish names.


The thrust of discussion and work on the record system, in so far as 
Haskell has been concerned, has been at the type system level, an 
necessarily so: work on representing the has a relation, extensibility 
etc at the type level. Some relatively usable libraries have been 
developed that provide this support (eg HList).


none of this can address my particular issue: name space management, 
that is, managing the scope of record labels. The type system is not the 
solution to all problems. Hence my proposal.


I don't envisage that my issue will be addressed anytime soon, if at 
all. But by raising it I hope to broaden the focus of the discussion.


The trouble with any rework of the current record system: which way to 
take it ... the design space is large


what would users want ...

- light weight records (c.f. ML)
- first class labels (accessors and setters)
- extensible records
- sub-typing

or in my case

- better name space management

perhaps given the many avenues for exploration of type system support 
for record systems, we could make use of existing libraries with 
rebind-able syntax??


again quoting

http://research.microsoft.com/en-us/um/people/simonpj/Haskell/records.html

Haskell lacks a serious record system. (The existing mechanism for 
named fields in data types was always seen as a stop-gap measure.)


isn't it about time this changed?




___
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 Directed Name Resolution

2010-11-11 Thread John Lask

On 12/11/2010 9:22 AM, Richard O'Keefe wrote:


On 12/11/2010, at 2:17 AM, Michael Snoyman wrote:

So why would you ever need to reuse the same field name in the same
module?


data PetOwner
data FurnitureOwner

data Cat = Cat { owner :: PetOwner }
data Chair = Chair { owner :: FurnitureOwner }

Just the first thing that came to mind, this kind of thing comes up
often enough to be an irritant. I'm not sure whether or not TDNR is a
good solution to the problem, just pointing out a use case.


I'm afraid it's not a *convincing* use case.
It's not convincing because here owner *means different things*.



consider length ...

I have records with the attribute length, length can be given as an Int, 
Double, Float or maybe as a constructed type Length, length's use as a 
record selector would also clash with List.length. All these have the 
same denotation.


should I then seporate into int_length, float_length, or use 
rec1_length, rec2_length etc etc...


for proper name space management why should I have to define each record
that defines a length field with different representation in distinct 
modules, or with different names for the field label when they denote 
the same thing?


This is easily handled in C, Pascal, PL/1, Cobol why not in Haskell ?


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


Fwd: Re: [Haskell-cafe] Type Directed Name Resolution

2010-11-11 Thread John Lask




On 12/11/2010, at 2:16 PM, John Lask wrote:


On 12/11/2010 9:22 AM, Richard O'Keefe wrote:


I'm afraid it's not a *convincing* use case.
It's not convincing because here owner *means different things*.



consider length ...

I have records with the attribute length, length can be given as an Int, Double, Float or 
maybe as a constructed type Length, length's use as a record selector would 
also clash with List.length. All these have the same denotation.


All these have the same denotation?  I am extremely confused here.
AH!  You mean you call them all by the same name.  Well yes, that's
the problem, right there.

I remind readers once again that in SML record selectors *don't* clash with
names of functions.  I am not concerned here to argue either for or against
SML-style records and their selectors, only to point out that wanting
*record fields* whose significance depends on the record they select from
is *NOT* the same thing as TDNR in principle, so that arguments for that
don't even come close to being arguments for TDNR as such.



should I then seporate into int_length, float_length, or use rec1_length, 
rec2_length etc etc...


No, the differing result types are an epiphenomenon of their differing
semantics.

 The length of a piece of string is a physical length.


length of string measured in CM's, in MM, in Inches, as an Int, float
... they all denote the same thing modulo some theory.

You could argue that a length in CM's measured as a float is
semantically different to that of CM's as an Int, which it is, but
somewhere along the line those semantic differences become irrelevant to
the abstract domain of application, your model, and it is that model
that you wish to represent as a program, although you need to deal with
the concrete differences as an implementation detail.


 The length of a lecture is a time.
 The length of a queue is a natural number (counting people).
 The length of a book is a positive integer (counting say pages, or words)
 The length of a vowel is a relative time.

These quantities are measured differently, combined differently, and assessed
differently.  Calling them all length is a METAPHOR.  (There are at least
three metaphors in the list above: time-is-space, codex-is-scroll, and
a form of metonomy.)


for proper name space management why should I have to define each record
that defines a length field with different representation in distinct modules, 
or with different names for the field label when they denote the same thing?


But you just explained that while they may have the same denotation (the
identifier), what it DENOTES is NOT the same (otherwise they could not
be different types).



you are right


As SML proves, having record-sensitive field names is a *different*
question from Type Directed Name Resolution applied to plain function names.




agreed


This is easily handled in C, Pascal, PL/1, Cobol why not in Haskell ?


But it *isn't* handled *AT ALL* in any of those languages, let alone
handled easily.

In C, Pascal, PL/I, and COBOL field names are *not* values.
C, Pascal, and PL/I let you pass functions as parameters to functions.
But you cannot pass field names that way.  The only thing you can do
with a field name is apply it *immediately* to a record.  And those
languages don't have type variables, so when you apply a selector to
a record, you know then and there what the type is.

If what you want is some sort of record facility at least as good as
SML's, fine.  What I am arguing against is anything resembling Type
Directed Name Resolution (alias ad hoc overloading) being applied to
plain ordinary functions.


that's something like what I want. I am not argiung in favor of TDNR,
only that haskell record system needs improvement, particularly the
scoping of field labels.




(By the way, if the field names of a record type are visible outside its
module, I start wondering why.)




depends on what your using them for ..




___
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


Fwd: Re: [Haskell-cafe] Type Directed Name Resolution

2010-11-11 Thread John Lask

On Thu, Nov 11, 2010 at 8:16 PM, John Laskjvl...@hotmail.com  wrote:

consider length ...

I have records with the attribute length, length can be given as an Int,
Double, Float or maybe as a constructed type Length, length's use as a
record selector would also clash with List.length. All these have the same
denotation.

should I then seporate into int_length, float_length, or use rec1_length,
rec2_length etc etc...


class Lengthy a where
   type LengthType a
   length :: a -  LengthType a

This extends easily to lenses if you want setters.




to make use of the class Lengthy I still need to define record selectors
with different names, which is exactly the point I am making...

ie

data Record = RecLen { rec_length :: ... }

instance Lengthy Record where
  length = rec_length


This is easily handled in C, Pascal, PL/1, Cobol why not in Haskell ?


By this argument, Haskell should provide global mutable state and
allow side-effects universally.



no, but these languages have their strengths as well, for example Cobol
PIC strings format currency values very nicely and it would be great if
there were a Haskell library that could do the same. Not to mention
currency values!

The point is that languages are often constructed with a purpose in
mind, at which they tend to be particularly good. Haskell has
traditionally been a test bed for type system innovation, which is why
we all like it so much.

As and if, the usage of Haskell broadens, then domains of application
stray into areas of application for which it is not ideally suited, in
those circumstances why not consider features of other languages which
handle those use cases well. (for some definition of well)

By the way I am not arguing for TDNR, merely that all is not well with
haskell records.


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


Re: [Haskell-cafe] What is simplest extension language to implement?

2010-11-02 Thread John Lask

On 2/11/2010 9:05 PM, Steffen Schuldenzucker wrote:

On 11/02/2010 10:40 AM, Yves Parès wrote:

Because he would have either to recompile the whole program or to use
things like hint, both implying that GHC must be installed on the user
side (600Mo+ for GHC 6.12.3)

Isn't there a way to use some stripped-down version of ghc and the base
libraries, providing only what the user really needs, in versions which
are known to work, and supply that together with the application?



there is hugs, which is a small, fast haskell interpreter. It is 
embeddable ( exposes a C api for embedding - it is written in C), 
supports many language extensions and can be stripped down (in terms of 
libraries) as far as you like, but is now often forgotten, overlooked in 
so far as haskell implementations go.



I'd love to use haskell as a configuration language, provide some
combinators and effectively get the rest for free.
But it is not acceptable for a user to go through the mess of installing
a ghc environment on, say, Windows, only to change some settings.



2010/11/2 Lennart Augustsson lenn...@augustsson.net
mailto:lenn...@augustsson.net

I don't understand. Why don't you use Haskell as the scripting
language?

On Tue, Nov 2, 2010 at 7:04 AM, Permjacov Evgeniy
permea...@gmail.com mailto:permea...@gmail.com wrote:
 Let us think, that we need some scripting language for our pure
haskell
 project and configure-compile-run is not a way. In such a case a
 reasonably simple, yet standartized and wide known language
should be
 implemented. What such language may be?
 R(4/5/6)RS ?
 EcmaScript ?
 Some other ?
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org mailto:Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org mailto: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


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


Re: [Haskell-cafe] Will GHC 6.14 with LLVM use LLVM C compiler to compile external C Libraries

2010-09-09 Thread John Lask
I am not that familiar with LLVM, if anything it complicates matters, 
rather than making things easier.


The llvm-ld program has limited support for native code generation, 
when using the -native or -native-cbe options. Native code generation is 
performed by converting the linked bitcode into native assembly (.s) or 
C code and running the system compiler (typically gcc) on the result.


so it seems that the gcc support infrastructure that is currently 
integrated into ghc will still be required. Then the question arises 
what library formats will ghc use under the circumstances ?(.bc, .a) and 
how will the two be integrated?


On windows, most c/c++ public domain libraries are either compiled with 
ms-c or gcc which have their standard library formats. which in many 
cases come pre-compiled with the libraries. Becuase of this I would 
assume retention of the .a format, but perhaps compiling haskell to .bc 
would offer opportunities for link time optimisation?


In fact I would like a lot more information on what is being proposed 
with respect of a LLVM backend and any changes to the compiler tool chain.



Since GHC 6.14 will (hopefully) be use LLVM as a default backend, an
idea has occured to me

Should GHC also use the clang (C/C++-LLVM compiler) on external C
library sources which are used with certain Haskell packages (such as
gtk) when LLVM does become a default backend for GHC. The consensus is
that since Clang will also produce LLVM 'assembler', it can be very
easily linked with the LLVM 'assembler' produced by GHC's LLVM backend,
making the process of using external C sources a lot easier. Parts of
Clang required could even be integrated into GHC (although this may be
tricky since its coded in C++). It should also hopefully make using
Haskell packages on windows that use C sources less painful

Clang could also make using FFI with C++ much easier (for reasons stated
above)

Thoughts?



___
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] feasability of implementing an awk interpreter.

2010-08-20 Thread John Lask

On 20/08/2010 1:35 PM, Jason Dagit wrote:
fairly easy .. you might want to check out the following tutorial ...

http://www.crsr.net/Programming_Languages/SoftwareTools/ch5.html

he implements a basic grep tool, you might then want to check out one of
the regex packages as a basis for your implementation of awk.




On Thu, Aug 19, 2010 at 8:05 PM, Michael Litchard mich...@schmong.org
mailto:mich...@schmong.org wrote:

I'd like the community to give me feedback on the difficulty level of
implementing an awk interpreter. What language features would be
required? Specifically I'm hoping that TH is not necessary because I'm
nowhere near that skill level.


I'd love to have portable pure haskell implementations of the
traditional unix tools.  If it were done well, it would allow you to
'cabal install' yourself into a usable dev environment on windows :)
  I'd much rather do that than deal with cygwin/mingw.

Someone (was it Stephen Hicks?) was writing (or finished writing?) an sh
parser and I got really excited for the same reason.  It would be a cool
project, but I'm not sure I can justify to myself spending my spare
cycles on it.



An outline of a possible approach would be appreciated. I am using
http://www.math.utah.edu/docs/info/gawk_toc.html
as a guide to the language description.


I think this is a good opportunity for you to learn about monad
transformers.  To that end, I think you will like this paper (quite easy
for beginners to pick up):
http://www.grabmueller.de/martin/www/pub/Transformers.en.html

At least, that's how I first learned about them and I though it was easy
to read at the time :)

You might also want to read (and try) some of the tutorials that focus
on creating interpreters just to sort of get some practice in that area.
  I haven't read it, but I've heard good things about this one:
http://en.wikibooks.org/wiki/Write_Yourself_a_Scheme_in_48_Hours

You might also focus on the 'core' of awk.  Think about, what is the
minimal language and start from there.  Grow your implementation adding
features bit by bit.  It's also a good opportunity to do testing.  You
have a reference implementation and so you can write lots of tests for
each feature as you add them.

I hope that helps,
Jason



___
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] Embedded scripting Language for haskell app

2010-08-18 Thread John Lask

On 18/08/2010 12:20 PM, Stephen Sinclair wrote:

you could script in haskell by embedding hugs. Hugs exe + base lib ~ 1MB.


On Tue, Aug 17, 2010 at 6:05 AM, Hemanth Kapilasaihema...@gmail.com  wrote:

Hi,
Can some one please give me a suggestion on the best choice for an embedded
scripting Language for a haskell application?
I mean, something like guile/lua for c/c++ and groovy/jruby for java.
For quite some time, I've been using a lisp-like interpreter that I
implemented myself. But this is not going too well - going by this road, I
suspect I will end up with a mule. I am looking for a pony (a declarative
programming language). I am okay with a donkey too.
baskell[1] seems interesting. And there's hslua[2].
Can one use hint[3] like this ?


How about a tiny lisp or scheme interpreter?  Lots of those to choose
from, (including some written in Haskell) and with a few clever macros
you could easily provide a declarative DSL for users to work with.  I
see that you mentioned guile, but even tinyscheme would be pretty
powerful and only add a few K to your project.

This raises the question, what is the smallest (or most embeddable
anyway) Haskell interpreter that can be built?

Steve
___
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] new recursive do notation (ghc 6.12.x) spoils layout

2010-06-20 Thread John Lask

Whilst I have nothing against the change in syntax for recursive do aka

http://old.nabble.com/Update-on-GHC-6.12.1-td26103595.html

Instead of writing

  mdo
a - getChar
b - f c
c - g b
putChar c
return b

you would write

  do
a - getChar
rec { b - f c
  ; c - g b }
putChar c
return b

it does spoil the nice layout - it would be nice to just be able to 
write (which does not parse)


  do rec
a - getChar
b - f c
c - g b
putChar c
return b

I don't particularly care that the only recursive statements are #2,#3 - 
I just want my nice neat layout back. I have just spent an inordinate 
amount of time updating code when if the parser recognised do rec as a 
recursive group it would have been a drop in replacement and taken me 
one tenth of the time.


Why can't we have this?

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


Re: [Haskell-cafe] new recursive do notation (ghc 6.12.x) spoils layout

2010-06-20 Thread John Lask

On 20/06/2010 6:32 PM, Alexander Solla wrote:

in your example c will not be in scope in the expression (let b = c = 
return . f) - that's the purpose of the recursive do construct (mdo, now 
do .. rec ..)


jvl



On Jun 20, 2010, at 6:24 PM, Alexander Solla wrote:


do a - getChar
let b = c = return . f
let c = b = return . g
c = putChar
b



Correction: by your construction, f and g are already in the Kliesli
category, so you don't need the return compositions. I still don't know
if the construction is admissible though.



___
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] Wire GUI

2010-05-30 Thread John Lask

perhaps  the inblobs editor may be of some interest

http://haskell.di.uminho.pt/~jmvilaca/INblobs/

allows the editing of interaction nets (also available on hackage)


Andrew Coppin schrieb:

I'm looking at a project which involves a GUI where you can insert
components and wire up connections between them. Obviously the details
of what the components are and what code gets executed for them is
domain-specific, however the general idea of graphically wiring things
together is quite generic. Has anybody already put together a Haskell
library for doing this kind of thing?


There was some work of interfacing Haskell to PureData:
   http://claudiusmaximus.goto10.org/anglohaskell2007/AngloHaskell2007.xml
___
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] llvm on windows

2010-05-27 Thread John Lask

on the topic of llvm,

is anybody using llvm binding on windows ? The official llvm windows 
distro does not have a precompiled library which is required for the 
llvm bindings ?


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


Re: [Haskell-cafe] are forkIO threads event-driven?

2010-05-02 Thread John Lask
Re event library and merge into haskell base: has any thought gone into 
the windows version of the library. Last I looked it was very unix 
centric - the windows api is very different. I believe it will require 
major rework to abstract the commonalities and deal efficiently with the

differences.

I suspect any talk of a merge is premature.

On Sun, May 2, 2010 at 8:45 PM, Aran Donohue aran.dono...@gmail.com 
mailto:aran.dono...@gmail.com wrote:


That's very interesting. I only brought it up because I'm thinking
about the upcoming problems of real-time web application servers. 


I'm sure many people have seen this blog post and Dons's replies:

http://www.codexon.com/posts/debunking-the-erlang-and-haskell-hype-for-servers


http://www.codexon.com/posts/debunking-the-erlang-and-haskell-hype-for-serversThe
Haskell code codexon used isn't the best Haskell can do. But I think
it's the clearest, most obvious code---the most like what someone
learning from the ground up would try first. Ideally, it should run
fast by default, and it's too bad that you need to learn about
bytestrings (and choose between lazy vs. strict), the various utf8
encoding options, and a new event library to make it perform.


The Haskell Network.Socket module uses Strings to represent binary data. 
This is wrong as String is an abstract data type representing a sequence 
of Unicode code points, not bytes. Arguably the Network.Socket module 
should have used [Word8] instead of String. However, String and [Word8] 
are both represented as linked lists which is not a very efficient 
representation for large blocks of binary data. bytestring is simply a 
more efficient encoding of [Word8] and should be use anywhere you want 
to represent binary data.


It's too late to change Network.Socket to use ByteStrings instead of 
Strings as it would break too much code. I wrote network-bytestring so 
that you can use ByteStrings instead of Strings when doing socket I/O. 
The network-bytestring package will most likely be merged into the 
network package at some point.


While you can use the event library explicitly this is not how we 
intended the majority of users to use it. The goal is to integrate it 
into GHC 6.14 and as replace the current I/O manager. That means that 
you will be able to write standard forkIO based code (like in the linked 
article) and expect around 20,000 requests/second on one core (depending 
on your hardware).
 


Since I'm basically a beginner to Haskell, if I were to set out to
test out a WebSocket server in Haskell, my first pass code would
probably look a lot like the codexon template. I certainly wouldn't
want to go multi-process nor explicitly manage cores within a single
process. I would want forkIO to just work.


If we reach our GHC 6.14 goal you will.

Cheers,
Johan




___
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] are forkIO threads event-driven?

2010-05-02 Thread John Lask
As I said, it is very unix centric. The backend methods rely upon file 
descriptors which in the windows world are specific to the C rts. It is 
the backend that requires the abstraction from os specific 
structures/handling.



The event library has a pluggable interface, with multiple backends, and
is entirely portable as a result. You just swap in your 'select'
mechanism:

http://github.com/tibbe/event/blob/master/src/System/Event/EPoll.hsc

http://github.com/tibbe/event/blob/master/src/System/Event/Poll.hsc

http://github.com/tibbe/event/blob/master/src/System/Event/KQueue.hsc

Now, if you can implement the Backend methods,

http://github.com/tibbe/event/blob/master/src/System/Event/Internal.hs

You'll be good to go -- and we already know GHC can do threads on
Windows, so the same mechanism should work faily easily.

jvlask:
Re event library and merge into haskell base: has any thought gone into  
the windows version of the library. Last I looked it was very unix  
centric - the windows api is very different. I believe it will require  
major rework to abstract the commonalities and deal efficiently with the

differences.

I suspect any talk of a merge is premature.

On Sun, May 2, 2010 at 8:45 PM, Aran Donohue aran.dono...@gmail.com  
mailto:aran.dono...@gmail.com wrote:


That's very interesting. I only brought it up because I'm thinking
about the upcoming problems of real-time web application servers. 


I'm sure many people have seen this blog post and Dons's replies:

http://www.codexon.com/posts/debunking-the-erlang-and-haskell-hype-for-servers


http://www.codexon.com/posts/debunking-the-erlang-and-haskell-hype-for-serversThe
Haskell code codexon used isn't the best Haskell can do. But I think
it's the clearest, most obvious code---the most like what someone
learning from the ground up would try first. Ideally, it should run
fast by default, and it's too bad that you need to learn about
bytestrings (and choose between lazy vs. strict), the various utf8
encoding options, and a new event library to make it perform.


The Haskell Network.Socket module uses Strings to represent binary 
data. This is wrong as String is an abstract data type representing a 
sequence of Unicode code points, not bytes. Arguably the Network.Socket 
module should have used [Word8] instead of String. However, String and 
[Word8] are both represented as linked lists which is not a very 
efficient representation for large blocks of binary data. bytestring is 
simply a more efficient encoding of [Word8] and should be use anywhere 
you want to represent binary data.


It's too late to change Network.Socket to use ByteStrings instead of  
Strings as it would break too much code. I wrote network-bytestring so  
that you can use ByteStrings instead of Strings when doing socket I/O.  
The network-bytestring package will most likely be merged into the  
network package at some point.


While you can use the event library explicitly this is not how we  
intended the majority of users to use it. The goal is to integrate it  
into GHC 6.14 and as replace the current I/O manager. That means that  
you will be able to write standard forkIO based code (like in the 
linked article) and expect around 20,000 requests/second on one core 
(depending on your hardware).
 


Since I'm basically a beginner to Haskell, if I were to set out to
test out a WebSocket server in Haskell, my first pass code would
probably look a lot like the codexon template. I certainly wouldn't
want to go multi-process nor explicitly manage cores within a single
process. I would want forkIO to just work.


If we reach our GHC 6.14 goal you will.

Cheers,
Johan




___
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] installing Network on windows

2010-03-23 Thread John Lask

it is easier if you use msys
then in msys window, run ghc setup configure

after that you can run ghc setup build etc in normal dos window without 
further recourse to msys



Neil Mitchell wrote:

Hi,

I managed this with the following sequence of commands:
http://www.haskell.org/pipermail/libraries/2010-February/013038.html

Thanks, Neil

On Wed, Mar 17, 2010 at 9:44 PM, Niklas Larsson nikl...@ymail.com wrote:

Hi!

It needs some shell, if you install MSYS from mingw and do the cabal install
from there it will work just fine.

Here is the download for MSYS:
http://sourceforge.net/projects/mingw/files/MSYS%20Base%20System/msys-1.0.11/MSYS-1.0.11.exe/download

// Niklas L.

From: gladst...@gladstein.com gladst...@gladstein.com
To: haskell-cafe@haskell.org
Sent: Wed, March 17, 2010 9:11:00 PM
Subject: [Haskell-cafe] installing Network on windows

I need some advice on the most straightforward way to install the Network
package on Windows. I can install Cywgin if that's what it takes. Thanks in
advance.

cabal install network
Resolving dependencies...
Configuring network-2.2.1.7...
cabal: Error: some packages failed to install:
network-2.2.1.7 failed during the configure step. The exception was:
sh: runGenProcess: does not exist (No such file or directory)


___
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] Computer Graphics and Haskell - Radiosity Methods

2010-02-28 Thread John Lask

you could have a look at these ...

bjpop-ray - search on web
hray - http://users.elis.ugent.be/~kehoste/Haskell/HRay/



Hello cafe,

While I was studying for my computer graphics test I have tomorrow I 
realized that maybe some of the major problems I've read so far about 
Radiosity Rendering Algorithms may be reduced significantly if it was 
implemented in Haskell and taking advantage of the lazy evaluation so 
that only what can be seen from the viewer's perspective point of view 
is calculated, and the rest of the scene just remains as thunks waiting 
for them to be calculated in case they are needed.


I guess that probably most of the people on this list doesn't really 
work on the computer graphics area, but if anybody out there actually 
does I'd really like if he or she could explain me more of why what I'm 
saying could be really useful and what has already been done (or why I'm 
so lost that I'm probably gonna fail my exam tomorrow hahaha)...


One of the things I'm studying is the Monte Carlo Radiosity Methods 
which takes advantages of non-determinism to create stochastic 
algorithms, I guess this is more difficult to implement in Haskell, 
please if you know any of this Monte Carlo Methods for Radiosity 
Algorithms share that knowledge with me (and the list).


Thank you,

Hector Guilarte




___
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: pexports Was: Re: [Haskell-cafe] binding to C libraries on Windows was Low Level Audio - Writing bytes to the sound card?

2009-12-09 Thread John Lask


I think it would be a usefull addition to the haskell windows tool 
chain, and help facilitate the creation of bindings to  libraries on 
windows where no appropriate import library exists.


I am sure if you put it out there in whatever form, someone will find 
a use for it and perhaps build upon it.


jvl

Stephen Tetley wrote:

Hi All,

Would a pure Haskell version of pexports be useful to the Haskell community?

For a Sunday afternoon hack that turned out to take a bit more effort
(its now Wednesday), I thought I'd code up a tool that extracts
function symbols from .dll's (also when I first looked at the C
pexports it seemed somewhat unadopted, though checking today it
appears to in MinGW, so my local MinGW must be out-of-date).

If there are compelling uses that aren't covered by pexports and would
ease Haskell C binding problems on Windows, I don't mind polishing up
my tool, but otherwise I've exhausted my natural interest.

Best wishes

Stephen
___
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] Natural Language Processing

2009-12-09 Thread John Lask

maybe this helps ...
see http://www.cs.chalmers.se/~aarne/GF/

I quote from the web site: GF is

a categorial grammar formalism, like ACG, CCG, but different and 
equipped with different tools


it compiles with at least GHC 6.8.2

Is Parsec capable of parsing a mildly context sensitive language? In 
particular does it parse a combinatory categorial grammar? Does Haskell 
have such tools in its shed? What sort of facilities does Haskell have 
for natural language processing?
 
 





___
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] binding to C libraries on Windows was Low Level Audio - Writing bytes to the sound card?

2009-12-05 Thread john lask

I think there are some misapprehensions here:-

many haskell packages binding to c libraries will compile with ghc 
without problems on windows - without cygwin, without mingw/msys system.

Some such packages build out of the box on windows, like the zlib 
package which contains the c source for the c zlib library. GHC is able 
to compile and build this packages without any other c 
compiler/libraries/unix emulators etc because ghc itself contains part 
of the gcc c compiler tool chain and comes with all c standard headers, 
c++ headers and c/c++ runtime libraries.

Other packages such as SDL package are relatively straightforward to 
build on windows - all that is required is to have an import library 
corresponding to your dll (or static lib) and the headers. You then 
update the library path field in the cabal file and include path. There 
is only one gotch-ya - you need to have a import library for the gcc 
tool chain (thats what ghc uses) i.e. a .a library and not the native 
windows .LIB import library. If you don't have .a import library 
but have the dll then the '.a' import library be built for any dll 
relativley easily.

The correct '.a' import libraries and the libraries themselves for many
standard unix/gnu packages can be found under the gnuwin32 project. Many 
unix libraries provide a windows build based on the mingw port of the 
gcc tool chain which will contain the correct import library.

the bigest problem hamperring cleaner builds of haskell packages on 
windows is the lack of any standardised scheme for the installation of 
c-libraries and header files (and of course the availability of a 
suitable build of the library)

Another problem hampering the install of haskell packages on windows is 
the use of the unix autoconf build system (./configure) , for which 
there is no substitute on windows other than cygwin and to lesser extent 
msys/mingw, this problem could be obviated by the provision of a 
standard win32 conf (forgetting about win64 for the moment) - package 
writters note!


 Date: Sat, 5 Dec 2009 20:58:14 +
 Subject: Re: [Haskell-cafe] Low Level Audio - Writing bytes to the sound card?
 From: stephen.tet...@gmail.com
 To: Haskell-Cafe@haskell.org
 CC: 
 
 Hi Andrew
 
 
 
 2009/12/5 Andrew Coppin andrewcop...@btinternet.com:
 
  I don't think it should be necessary to install a Unix emulator just so that
  I can write Windows programs. Maybe others disagree.
 
 
 ...
 
 
  I'm by no means an expert here, but isn't it usual for C libraries on
  Windows to be supplied as a compiled DLL and a header file for using it? I
  don't quite understand why you need a C compiler.
 
 The thing is, all the bindings on Hackage (or at least something most
 likely above 95%) are to Unix C libraries so you need a C compiler
 and a Unix emulator to use them. I do have have some sympathy with
 your point though - it is possible to get things to compile once you
 have Cygwin, but deployment on any other machine Windows thereafter is
 'challenging' to say the least.
 
 
 
 
  Apparently there is some talk of removing OpenGL from the Haskell Platform.
  And if this happens, it'll be one more thing I can't use on Windows. :-(
 
 
 I didn't realise until I looked today that OpenGL was in the Haskell
 Platform. If the proposal to remove it is from Sven Panne then fair
 enough, otherwise it would be a bit disappointing - it always just
 worked when it was part of GHCs extralibs...
 
 Best wishes
 
 Stephen
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe
  
_
If It Exists, You'll Find it on SEEK Australia's #1 job site
http://clk.atdmt.com/NMN/go/157639755/direct/01/___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


RE: [Haskell-cafe] Machine Learning Library (SVM)

2009-11-24 Thread john lask


look at: http://www.cs.utah.edu/~hal/SVMseq/

this works but is a little slow and would benefit by being updated to 
use the bytestring library.

and generic data clustering ...

http://www.cs.utah.edu/~hal/GDC/

 From: ke...@malde.org
 To: hector...@gmail.com
 Subject: Re: [Haskell-cafe] Machine Learning Library (SVM)
 Date: Wed, 25 Nov 2009 07:56:08 +0100
 CC: haskell-cafe@haskell.org
 
 Hector Guilarte hector...@gmail.com writes:
 
  Ketil, has any progress been made on that library? Specially in the
  SVM part which is what I'm really looking for... 
 
 No, the SoC ticket was not funded, and I am not aware of any other
 Haskell implementation of SVMs (and if there is one, I'm sure it will be
 pointed out on this list).
 
 -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
  
_
For more of what happens online Head to the Daily Blob on Windows Live
http://windowslive.ninemsn.com.au/blog.aspx___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell2Xml

2009-08-07 Thread John Lask

the paper:

Scripting XML with Generic Haskell

Frank Atanassow, Dave Clarke and Johan Jeuring

October 14, 2003



describes a translation from XML Schema to Haskell data types (like 
dtd2haskell) in generic haskell, I believe that the code for the tool 
described may also be available, how hard it would be to migrate over to 
vanilla haskell+generics is another question



- Original Message - 
From: Dmitry Olshansky

To: Haskell cafe
Sent: Friday, August 07, 2009 7:31 PM
Subject: Re: [Haskell-cafe] Haskell2Xml


Like in Keith proposal I need it for working with web-services, maybe Xml 
transformations and so on.
And I tried to make it by self with a partial success. To work with xml I 
only used xml package (Text.XML.Light).



Now I am going to work a little (?) on this task to provide more standard 
and regular tool than I have now. So it is very interesting for me to learn 
any ideas (if exists) on this thing from community.







___
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] Haskell2Xml

2009-08-07 Thread John Lask
link to paper: http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.1.7362

  - Original Message - 
  From: Dmitry Olshansky 
  To: Haskell cafe 
  Sent: Friday, August 07, 2009 7:31 PM
  Subject: Re: [Haskell-cafe] Haskell2Xml


  Like in Keith proposal I need it for working with web-services, maybe Xml 
transformations and so on. 
  And I tried to make it by self with a partial success. To work with xml I 
only used xml package (Text.XML.Light). 


  Now I am going to work a little (?) on this task to provide more standard and 
regular tool than I have now. So it is very interesting for me to learn any 
ideas (if exists) on this thing from community. 





--


  ___
  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] funct.prog. vs logic prog., practical Haskell

2009-08-02 Thread John Lask
I would have thought that a major motivation for the study of haskell,or for 
that matter ML, Clean, would be their type systems: statically typed higher 
order parametric polymorphism which is certainlly different enough from that 
of prolog to warrant study. So from the perspective of type systems and 
associated gaurantees functional programming languages probably represent 
the best environment in which to study these concepts.


- Original Message - 
From: Petr Pudlak d...@pudlak.name

To: Haskell Cafe haskell-cafe@haskell.org
Sent: Sunday, August 02, 2009 8:25 PM
Subject: [Haskell-cafe] funct.prog. vs logic prog., practical Haskell



   Hi all,

I'd like to convince people at our university to pay more attention to
functional languages, especially Haskell. Their arguments were that

   (1) Functional programming is more academic than practical.
   (2) They are using logic programming already (Prolog); why is Haskell
better than Prolog (or generally a functional language better than a
logic programming language)?

(1) is easier to answer, there are a lots of applications at HaskellWiki, 
or

elsewhere around the Internet, written in Haskell, OCaml, etc.  Still, I
welcome comments on your experience, for example, if you have written some
larger-scale application in Haskell (or another a functional language) 
that is
not at HaskellWiki, and perhaps if/why you would recommend doing so to 
other

people.

(2) is harder for me, since I've never programmed in Prolog or another 
language
for logic programming. I'd be happy if anyone who is experienced in both 
Prolog

and Haskell could elaborate the differences, pros  cons etc.

   Thanks,
   Petr
___
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] lifting restrictions on defining instances

2009-07-17 Thread John Lask
Can anyone explain the theoretical reason for this limitation, ie other than 
it is a syntactical restriction, what would it take to lift this restriction 
?



- Original Message - 
From: Stefan Holdermans ste...@cs.uu.nl

To: Petr Pudlak d...@pudlak.name
Cc: haskell-cafe@haskell.org
Sent: Saturday, July 18, 2009 5:25 AM
Subject: Re: [Haskell-cafe] an instance in other than the last type 
parameters




Petr,

If I want to make it a functor in the last type variable (b), I can  just 
define



instance Functor (X a) where
 fmap f (X a b) = X a (f b)


But how do I write it if I want X to be a functor in its first type 
variable?


Short answer: you can't. Easiest way to workaround is to define a  newtype 
wrapper around your original datatype:


newtype X' b a = X' {unX' :: X a b}

instance Functor (X' b) where
  fmap g (X' (X a b)) = X' (X b (g a))

Cheers,

  Stefan
___
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] hiding instance definitions in imported modules or redefining them, can it be done?

2009-07-03 Thread John Lask
Is there a way to hide instance definitions when importing a module for 
instance


I want to import Data.Monoid but wish to redefine the instance of Monoid for 
( a-b)


I don't suppose this is possible?

Specifically, I wish to define a specialised instance of Monoid for 
String-Int, but it seems overlapping instances will not give me what I 
want, as this option seems to need to be applied at the definition site (aka 
Data.Monoid module, looking for confirmation of this?).


The easy fix is just to do newtype M a b = M (a-b) etc..., but I was 
hopping to avoid this. I've encountered this issue several times. Why can't 
we redefine instances? I can't of thought that there are any seriouse 
technical issues in doing so? If so what are they?



jvl 


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


Re: [Haskell-cafe] Cross platform getProcessID

2009-06-22 Thread John Lask

The short anser is...you need to make a ffi call to getCurrentProcessId

unfortunately there is no binding to this function in System.Win32.Process
which is the natural home for it.

Perhaps you could submit a patch for Win32 package, once you have created 
the binding the signature for the function is quite simple, so there should 
be no problem with the ffi call


DWORD GetCurrentProcessId(VOID)


- Original Message - 
From: John Van Enk vane...@gmail.com

To: Haskell Cafe haskell-cafe@haskell.org
Sent: Monday, June 22, 2009 1:43 PM
Subject: [Haskell-cafe] Cross platform getProcessID



In the unix package, we have getProcessID. Is there a corresponding
method for finding the process ID in Windows?

/jve
___
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] GHCI Curl under Windows

2009-06-03 Thread John Lask

The issue you are experiencing is the result of ghci not using import
libraries to resolve external symbols. Just a bit of explanation for
reference, which will also help you understand the solution to your problem.

Take for example the function declared as

   int myexport(int x){...}

when creating a dll the exported definitions will be included in the dll,
if your using mingw to create the dll, as

   _myexport

or, if your using ms visual c:

   myexport

The import libraries (.a,.lib) will contain

   _myexport
   __imp__myexport

in the case of mingw .a lib, and also .lib for ms visual c. These
entries enable the compiler to resolve the linkage.

A client of the library will, generally speaking, have the following 
declaration


__declspec(dllimport) int myexport(int x);

the object file created will reference __imp__myexport
obviously if you have an object file with __imp__myexport
and no import file you will not be able to resolve __imp__myexport to 
_myexport (or myexport) in the dll
and ghci does not use import libraries but just searches for the symbols 
defined directly. It
would be nice if ghci could directly resolve symbols decorated like __imp__ 
.


what to do? Notice that the import libraries (for compilation) contain both 
symbols
_myexport and __imp__myexport, therefore if you can get the haskell modules 
to reference the _myexport
rather than __imp__myexport all will be ok both for ghci and also ghc 
compilation.


so how did the __imp__ get there in the first place?
notice the curl has the cabal option via-C, consequently the curl headers 
will be

read in ...

#if (defined(WIN32) || defined(_WIN32))  !defined(CURL_STATICLIB)
...
#define CURL_EXTERN  __declspec(dllimport)
...

i.e. by default curls sais link me to the dynamic library, if in the
cabal file you define an option

 cc-options: -DCURL_STATICLIB

then the
but retain the link to the dynamic library

 Extra-libraries: curl

where libcurl is the name of the dynamic import library ie libcurl.a (you 
need to rename libcurl.dll.a, libcurldll.a
or whatever your import is called) as it needs to match the dll name as 
otherwise ghci will not find it eg libcurl.dll


and that's it - all should work fine now!

AN EXTRA NOTE ON IMPORT LIBRARIES

on my system I like to have both the static import and the dynamic import 
libraries

which are named

libcurl.a (static)
libcurl.dll.a (dynamic import)

to make this work with both GHC and GHCI you need to do the following

cabal ...

 Extra-libraries: curl.dll
 -- reference the dynamic import library, whatever name you have

after building the package and installing (your versions will be different)

ghc-pkg unregister curl-1.3.2.1

edit the dist\installed-pkg-config and add
extra-ghci-libraries: libcurl, or whatever the name of your .dll file is.
Then run

ghc-pkg update dist\installed-pkg-config

what this will do, is tell ghci the dll name to search for, rather
than relying on the name that you have specified with Extra-libraries: 
curl.dll

the benefit of this process is that it will enable you to leave the names
of your import libraries and dll files for curl untouched, which
could otherwise break other dependencies you may have.

The long and the short of it is --- much work still needs to be
done to ensure that building and maintaining packages on windows
platforms via cabal and ghc is painless - so far every
package I have used that relied on external libraries has required
some tweaking (and not just setting library paths).

- Original Message - 
From: Sigbjorn Finne sigbjorn.fi...@gmail.com

To: Martin Huschenbett hus...@gmx.org
Cc: haskell haskell-cafe@haskell.org
Sent: Thursday, June 04, 2009 12:59 AM
Subject: Re: [Haskell-cafe] GHCI  Curl under Windows


On Wed, 03 Jun 2009 05:27:53 -0700, Martin Huschenbett hus...@gmx.org 
wrote:



Hi Haskellers,

I've installed the newest Haskell Platform under Vista and downloaded a 
pre compiled version of curl-7.19.4 for MinGW. After changing the build 
type in curl.cabal to Simple and supplying the needed paths I could even 
build and install curl for haskell.


If I write a program using curl and compile it with GHC everything works 
fine. But if I try to execute the main function of my program in GHCI I 
always get the following error message:


Loading package curl-1.3.5 ... linking ... interactive: 
C:\Devel\Haskell\curl-1.3.5\ghc-6.10.3\HScurl-1.3.5.o: unknown symbol 
`__imp__curl_easy_getinfo': unable to load package `curl-1.3.5'


Did anybody have the same problem and knows how to fix it?



Hi Martin,

perhaps you already have, but did you go through this writeup

  http://haskell.forkio.com/Home/curl-win32

and see if there are useful pointers there that might help?

--sigbjorn

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe




[Haskell-cafe] ghc - force library search order

2009-05-29 Thread John Lask
I need to force a library to be searched for unresolved symbols after all 
other libraries have been searched, and I would rather not resort to 
constructing the linker command line directly. Is there a way to do this?


i.e. I want for example -lfoo to appear after all other haskell libraries 
and before system libraries (for example -lmsvcrt) once ghc has constructed 
the link command. i.e. how is it possible to coerce ghc into respecting 
dependencies between the libraries. GHC does a good job in general with 
native libraries, but there are allways corner cases.


I have a feeling this is not possible, but it dosn't hurt to ask.

jvl 


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


Re: [Haskell] Re[2]: [Haskell-cafe] Is Haskell a Good Choice for WebApplications? (ANN: Vocabulink)

2009-05-07 Thread John Lask
Well this is interesting. So what you are saying is that if your haskell 
application requires a peek memory utilisation of (for example) 1GB, after 
the memory intesive computation has completed and the GC has run (assuming 
all references have been dropped) the GHC RTS will retain the 1GB allocated 
to the process. Does this occur on both windows and posix platforms, does 
anyone know ? If so then this is a real issue. It would be reasonable to 
expect that the RTS release resources to the OS when not explicitly 
required.


jvl

- Original Message - 
From: Bulat Ziganshin bulat.zigans...@gmail.com

To: FFT fft1...@gmail.com
Cc: Chris Forno je...@jekor.com; hask...@haskell.org; 
haskell-cafe@haskell.org

Sent: Thursday, May 07, 2009 6:18 AM
Subject: [Haskell] Re[2]: [Haskell-cafe] Is Haskell a Good Choice for 
WebApplications? (ANN: Vocabulink)




Hello FFT,

Wednesday, May 6, 2009, 11:59:53 PM, you wrote:


I've heard it's hard to contain a long-running Haskell application in
a finite amount of memory


not exactly. you may alloc fixed pool of memory to application (say, 1gb)
if you know that it never need more memory. but as far as you don't do
it, memory usage grows with each major GC. ghc just don't provide
any way to return memory to OS (there is a ticket on it, you can add
yourself to CC list to vote for its resolution)

--
Best regards,
Bulatmailto:bulat.zigans...@gmail.com

___
Haskell mailing list
hask...@haskell.org
http://www.haskell.org/mailman/listinfo/haskell



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


Re: [Haskell-cafe] GC [Is Haskell a Good Choice for Web Applications?]

2009-05-07 Thread John Lask

for what its worth, I second this suggestion.

- Original Message - 
From: Andrew Coppin andrewcop...@btinternet.com

To: haskell-cafe@haskell.org
Sent: Friday, May 08, 2009 6:01 AM
Subject: [Haskell-cafe] GC [Is Haskell a Good Choice for Web Applications?]



Simon Marlow wrote:

http://hackage.haskell.org/trac/ghc/ticket/698


I presume that the reason for this is to avoid handing memory back only 
to immediately need it again? (I.e., we don't want to be constantly 
asking the OS to allocate and deallocate memory. Allocate it once and 
then let the RTS handle it.)


How hard would it be to add a function to ask the RTS to shrink the 
allocated memory? E.g., you do something that you know consumes lots of 
RAM, you finish doing it, you know that your live set has probably gone 
way down now, so you ask the RTS to release some RAM if possible. Would 
that be difficult?


(I might be talking moonshine, but isn't the parallel GC based around a 
block-structured heap? Does that affect the difficulty of the problem 
one way or the other?)


We already have System.Mem, which currently contains a single function 
to suggest to the RTS that right now might be a good moment to perform 
some GC. I'd like to see some other functions added here - suggesting to 
the RTS that it should have a go at shrinking RAM usage is one, but it 
would be nice to at least be able to query how much RAM is allocated 
too. (I presume finding out how much we've allocated from the OS is 
fairly easy; finding out how much is live data is presumably far 
harder...) Maybe access to various interesting GC information - I don't 
know if the RTS actually records this stuff when not built for profiling 
though. (?)


Just my thoughts... :-)

___
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] GC

2009-05-07 Thread John Lask
on the other hand a function to release pool memory to the OS down to the 
current active level should (I hope) be easily implementable, and quickly 
incorporated into application where required, whereas arriving at one or 
more automatic deallocation policies would most likely require some 
analysis/trial and error.



- Original Message - 
From: wren ng thornton w...@freegeek.org

To: haskell-cafe@haskell.org
Sent: Friday, May 08, 2009 9:33 AM
Subject: Re: [Haskell-cafe] GC



Daniel Fischer wrote:

Am Donnerstag 07 Mai 2009 22:01:11 schrieb Andrew Coppin:
 Simon Marlow wrote:
  http://hackage.haskell.org/trac/ghc/ticket/698
 I presume that the reason for this is to avoid handing memory back only
 to immediately need it again? (I.e., we don't want to be constantly
 asking the OS to allocate and deallocate memory. Allocate it once and
 then let the RTS handle it.)

 How hard would it be to add a function to ask the RTS to shrink the
 allocated memory? E.g., you do something that you know consumes lots of
 RAM, you finish doing it, you know that your live set has probably gone
 way down now, so you ask the RTS to release some RAM if possible. Would
 that be difficult?

Another idea, I have no idea how hard or sensible it is:
What if the GC detects how much memory is currently used (it does already 
do that, doesn't it?) and how much is allocated from the OS, and if less 
than a third or a quarter of the allocated memory is used, return the 
memory that exceeds twice the used memory to the OS?

Behaviour might be configurable by an RTS flag.


+1 (assuming the GC does detect current usage).

I think this behavior (with flags to tune the multiples, or to disable it) 
is nicely high-level and easy for users to reason about.


For users with intimate knowledge of the GC and their program's behavior 
it could be helpful to have the alternative proposal of an impure function 
to give hints to the RTS, but in general this seems like far too low-level 
of an approach to solve the general problem.


--
Live well,
~wren
___
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] swish - semantic web in Haskell

2009-05-01 Thread John Lask
you might like to change the name of the package slightly and thereby avoid 
confusion with swish the text indexing engine.


jvl

- Original Message - 
From: Doug Burke doug_j_bu...@yahoo.com

To: Vasili I. Galchin vigalc...@gmail.com
Cc: haskell-cafe@haskell.org
Sent: Friday, May 01, 2009 11:15 PM
Subject: Re: [Haskell-cafe] swish - semantic web in Haskell





--- On Thu, 4/30/09, Vasili I. Galchin vigalc...@gmail.com wrote:


From: Vasili I. Galchin vigalc...@gmail.com
Subject: [Haskell-cafe] swish - semantic web in Haskell
To: haskell-cafe@haskell.org haskell-cafe@haskell.org
Cc: Galchin Vasili vigalc...@gmail.com
Date: Thursday, April 30, 2009, 6:39 PM
Hello,

 http://www.ninebynine.org/Software/swish-0.2.1.html
 I am trying
to get permission from the author of Swish to move it into
Hackage. I will
write cabalize it get up to current Haskell
standards. Before I go to this
effort is anybody attempting to do this?

Kind regards, Vasili


Vasili,

I recently downloaded the code and started looking at it, but I am 
*exceedingly* unlikely to have time to do this any time soon. So, if you 
have the time and the permission to do it, I'll be happy :-)


Doug




___
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] ghc: Var/Type length mismatch message - what does it mean?

2009-03-30 Thread John Lask

consider the following types (from the paper:
Stream Fusion From Lists to Streams to Nothing at All)


data Stream a = forall s. Stream ( s -(Step a s)) s



data Step a s =
  Done
  | Yield a s
  | Skip s


an instance of this data type is:


stream0 :: Stream ()
stream0 = Stream (\ s - Yield () s) ()


now consider:


data StreamM m a = forall s. StreamM ( s -m (Step a s)) s


and the following instance:


stream0IO :: StreamM IO ()
stream0IO = StreamM (\ s - return (Yield () s)) () 


loads ok, but as soon as we introduce the following constraint:


data Monad m = StreamM' m a = forall s. StreamM' ( s -m (Step a s)) s



stream0IO' :: StreamM' IO ()
stream0IO' = StreamM' (\ s - return (Yield () s)) () 


we get the following message when we load into ghci (6.8.2)

Var/Type length mismatch:
   []
   [base:GHC.Base.(){(w) tc 40}]

is this a bug? if not, what is this message telling us ? 
___

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


[Haskell-cafe] New System.Process

2008-10-03 Thread john lask


Something that has irked me in the past about System.Process is the inability 
to obtain an OS system handle from the haskell Process handle. Such a facility 
would greatly enhance the interoperabity of c and haskell libraries.

Provision is made (although not standardised) to obtain OS specific handles 
from haskell File Handles which is very useful. The same should be provided for 
Haskell Process handles. The main barrier to such a facility is the variability 
between OS representations of such a type (aka windows Handles, unix PID).

comments anyone.
_

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


[Haskell-cafe] (no subject)

2008-08-24 Thread john lask

Hi

has anyone had any success in running a recent version of hs-plugins on a 
windows platform. I refer to this post to the haskell list in December last 
year. The current version of hs-plugins dosn't appear to work either. Same 
problem ...


http://www.haskell.org/pipermail/haskell/2007-December/020043.html


jvl

_
Meet singles near you. Try ninemsn dating now!
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fdating%2Eninemsn%2Ecom%2Eau%2Fchannel%2Findex%2Easpx%3Ftrackingid%3D1046247_t=773166080_r=WL_TAGLINE_m=EXT___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


RE: [Haskell-cafe] Scripting COM Components from Haskell - GreenCard on Hackage

2008-08-05 Thread john lask

Gunther

Hdirect can be found at: http://www.haskell.org/hdirect/

the Hdirect library was conceived prior to the finalisation of the haskell ffi, 
consequently some work would be required to adapt it to the current ffi. 

What you want is just the automation library which is only part of the overall 
package (the package includes ihc, the interface generator, from memory ), the 
automation library could easily be seporated from the rest of the package, 
stripping away the hdirect marshalling utils to make use of the current ffi 
functions and marshalling utils. This would be a relatively straight forward 
task, for someone that way inclined.


you might also want to have a look at hugs.net:

http://www.galois.com/~sof/hugs98.net/

John.

 Date: Tue, 5 Aug 2008 15:30:49 +0200
 From: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: Re: [Haskell-cafe] Scripting COM Components from Haskell - GreenCard 
 on Hackage
 CC: haskell-cafe@haskell.org

 No! Greencard is another story. The paper describes HDirect.

 On Tue, Aug 5, 2008 at 3:02 PM, GüŸnther Schmidt  wrote:
 Hi,

 does anybody know if the Greencard package / lib is the same software that
 is mentioned in the paper Scripting COM Components from Haskell?

 http://research.microsoft.com/~simonpj/papers/com.ps.gz

 I managed to install the hackage Greencard package on XP with GHC 6.8.3 but
 it seems to be quite different from what the paper describes.

 Günther

 ___
 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

_
Meet singles near you. Try ninemsn dating now!
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fdating%2Eninemsn%2Ecom%2Eau%2Fchannel%2Findex%2Easpx%3Ftrackingid%3D1046247_t=773166080_r=WL_TAGLINE_m=EXT___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Question on declaring an instance

2008-05-18 Thread john lask


Consider the data type:

  Foo i o a = ...

we want to declare an instance of Monad and Arrow for Foo without using a 
newtype (repackaging).
The effect we want is to be able to construct an expression like:

   ( f g ) ( h i )

where f, g, h, i :: Foo i o a, for some i o a

it is easy to declare

  instance Monad (Foo i o) where
 ...

but how do we declare instance Arrow (Foo ... ), this instance takes a kind * 
- * - *

it is easy to declare

  instance Arrow (Bar a) where
...

where Bar a i o is a flipping of the order of the arguments to Foo

  i.e. Bar = ((flip . (flip .)) Foo

Can Foo be declared an instance of both Arrow and Monad ?

_
It's simple! Sell your car for just $30 at CarPoint.com.au
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fsecure%2Dau%2Eimrworldwide%2Ecom%2Fcgi%2Dbin%2Fa%2Fci%5F450304%2Fet%5F2%2Fcg%5F801459%2Fpi%5F1004813%2Fai%5F859641_t=762955845_r=tig_OCT07_m=EXT___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] FW: containers-0.1.0.1

2008-03-27 Thread john lask

who is maintainer of containers package ...


 From: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: containers-0.1.0.1
 Date: Wed, 12 Mar 2008 23:48:33 +
 
 
 
 containers-0.1.0.1 will not build with ghc-6.6, the lines
 
#include Typeable.h
INSTANCE_TYPEABLE1(Set,setTc,Set)
 
 cause a parsing error, due no doubt to Typeable.h being different to 6.8 
 version
 _
 What are you waiting for? Join Lavalife FREE

_
Are you paid what you're worth? Find out: SEEK Salary Centre
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fninemsn%2Eseek%2Ecom%2Eau%2Fcareer%2Dresources%2Fsalary%2Dcentre%2F%3Ftracking%3Dsk%3Ahet%3Asc%3Anine%3A0%3Ahot%3Atext_t=764565661_r=OCT07_endtext_salary_m=EXT___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] isFunction

2008-01-04 Thread john lask


Oleg provided the following code to test whether a is a function, this code 
will not type check in hugs, due to the overlapping instances in 

 IsFunction (x-y) f
 IsFunction x f

and the functional dependency | a- b

ERROR isfunction.lhs:43 - Instances are not consistent with dependencies
*** This instance: IsFunction a b
*** Conflicts with   : IsFunction (a - b) c
*** For class: IsFunction a b
*** Under dependency : a - b

is there a way to acheive the same effect in hugs ?


 data HTrue
 data HFalse
 
 class IsFunction a b | a - b
 instance TypeCast f HTrue = IsFunction (x-y) f
 instance TypeCast f HFalse = IsFunction x 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
_
New music from the Rogue Traders - listen now!
http://ninemsn.com.au/share/redir/adTrack.asp?mode=clickclientID=832referral=hotmailtaglineOct07URL=http://music.ninemsn.com.au/roguetraders___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] RE: simple function: stack overflow in hugs vs none in ghc

2007-09-24 Thread john lask

I agree with your analysis.

if the following is tried in hugs then ghc you will obtain two different 
results..


return (repeat 'a') = \ x - print $ span (const True) x

with hugs you will get a stack error, in ghc it executes in constant space, 
i.e. indefinitely. In essenece the above example does exactly the same as my 
ealier code.


_
Advertisement: Need a Hand? Use Yellow.com.au 
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fadsfac%2Enet%2Flink%2Easp%3Fcc%3DPAS075%2E5683%2E0%26clk%3D1%26creativeID%3D73753_t=765559690_r=Hotmail_email_tagline_sept07_m=EXT


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


Re: [Haskell-cafe] RE: simple function: stack overflow in hugs vs nonein ghc

2007-09-24 Thread john lask

afraid not

the given example is too strict, the requirement is to generate the matched 
portion lazilly, and return the tail (unconsumed portion).


In principle the function should be capable of being written to run in 
constant space which the given example dose not.



From: Claus Reinke [EMAIL PROTECTED]
To: john lask 
[EMAIL PROTECTED],[EMAIL PROTECTED],haskell-cafe@haskell.org
Subject: Re: [Haskell-cafe] RE: simple function: stack overflow in hugs vs 
nonein ghc

Date: Mon, 24 Sep 2007 13:05:24 +0100


return (repeat 'a') = \ x - print $ span (const True) x

with hugs you will get a stack error, in ghc it executes in constant 
space, i.e. indefinitely. In essenece the above example does exactly the 
same as my ealier code.


this thread might be relevant:

http://www.haskell.org/pipermail/hugs-bugs/2007-June/001815.html
http://www.haskell.org/pipermail/hugs-bugs/2007-June/001816.html
http://www.haskell.org/pipermail/hugs-bugs/2007-June/001817.html

claus



_
Advertisement: Love Footy?  Get AFL, NRL, Rugby live scores and video now!  
http://ninemsn.com.au/share/redir/adTrack.asp?mode=clickclientID=819referral=hotmailtaglineURL=http://sports.ninemsn.com.au 


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


Re: [Haskell-cafe] RE: simple function: stack overflow in hugs vsnonein ghc

2007-09-24 Thread john lask

nope.

it is true that in the case of an infinite list it exibits the desired 
behaviour but ...


return (replicate 100 'a') = \x-print $ spant (const True) x

ERROR - Garbage collection fails to reclaim sufficient space

i.e. as the function unfold, the thunk representing the second term builds 
up on the heap. (not sure why it works for an infinite list, hugs must drop 
the reference to the tail ?)


to obtain a function that will properly operate in constant space, for every 
unfolding of the first term we need to enforce evaluation of the second 
term.



From: Claus Reinke [EMAIL PROTECTED]
To: john lask [EMAIL PROTECTED]
CC: haskell-cafe@haskell.org
Subject: Re: [Haskell-cafe] RE: simple function: stack overflow in hugs 
vsnonein ghc

Date: Mon, 24 Sep 2007 16:20:42 +0100


afraid not

the given example is too strict, the requirement is to generate the 
matched portion lazilly, and return the tail (unconsumed portion).


ah yes, without optimisations, Prelude.span builds up stack,
while the continuation-based alternative i mentioned is too
strict for some uses.

In principle the function should be capable of being written to run in 
constant space which the given example dose not.




return (repeat 'a') = \ x - print $ span (const True) x


how about the old spec, then?

   span p l = (takeWhile p l,dropWhile p l)

since takeWhile takes forever, here, it isn't even inefficient!-)

claus

with hugs you will get a stack error, in ghc it executes in constant 
space, i.e. indefinitely. In essenece the above example does exactly the 
same as my ealier code.


this thread might be relevant:

http://www.haskell.org/pipermail/hugs-bugs/2007-June/001815.html
http://www.haskell.org/pipermail/hugs-bugs/2007-June/001816.html
http://www.haskell.org/pipermail/hugs-bugs/2007-June/001817.html





_
Get more out of your e-mail. Update to Windows Live Hotmail today! 
http://ninemsn.com.au/share/redir/adTrack.asp?mode=clickclientID=778referral=HotmailTaglineURL=http://g.msn.com/8HMBEN/14811??PS= 


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