Re: Haskell for non-Haskell's sake

2003-09-02 Thread Oliver Braun
* Hal Daume III <[EMAIL PROTECTED]> [2003-08-29 17:39 -0700]:
> If you use Haskell for a purpose *other than* one of those listed below,
> I'd love to hear.

I have written checkrdf[1], a tool for downloading and processing RSS
files from various newstickers. checkrdf uses HaXml for processing
RSS XML files. A shell script is used as wrapper and the XML files are
fetched by fetch(1) or wget(1).

I have developed Editor Combinators[2][3] together with Wolfram Kahl and
Jan Scheffczyk for my diploma thesis.

Currently, I am using Haskell for my PhD work where I use Haskell as
"Runtime Environment" for code generated by HOPS[4].

I have done statistical evaluation of medical datasets (sensitivity,
specitivity, predictive values and the like) in Haskell.

For small tasks (processing textfiles and the like) I also use Haskell
or zsh[5] scripts.

Regards,
 Olli

1. http://checkrdf.sourceforge.net/
2. http://www2-data.informatik.unibw-muenchen.de/EdComb/
3. http://www2-data.informatik.unibw-muenchen.de/People/obraun/diploma_thesis.ps.gz
4. http://www2-data.informatik.unibw-muenchen.de/kahl/HOPS/
5. http://www.zsh.org/
-- 
Oliver Braun -- obraun @ { unsane.org | FreeBSD.org | haskell.org }


pgp0.pgp
Description: PGP signature


Re: proving the monad laws

2003-09-02 Thread oleg

Steffen Mazanek posed a problem: given the monad:

> data Error a = Error String | Ok a
> data TI a = TI (Subst -> Int -> Error (Subst, Int, a))
> instance Monad TI where
>  return x   = TI (\s n -> Ok (s,n,x))
>  TI f >>= g = TI (\s n -> case f s n of
>Ok (s',m,x) -> let TI gx = g x in
>   gx s' m
>Error s->Error s)
>  fail s = TI (\_ _->Error s)

prove the associativity of bind:

> m@(TI mf) >>= (\a->f a >>= h) =
>  = TI (\s n -> case mf s n of
>   Ok (s',m,x) -> let TI gx = (\a->f a >>= h) x in
>gx s' m
>   Error s->Error s)  =  ...
>  = ((TI mf) >>= f) >>= h
> I was wondering, if it is possible to simplify: "let TI gx = f x >>=h in 
> ...".
> But the "a" may occur in "h"?

No, it may not. First of all, the third monadic law  specifically
disclaims such an occurrence. Indeed, if 'a' had occurred free in 'h', 
then ((TI mf) >>= f) >>= h would make no sense. 

Although (>>=) notation is better for practical programming, I
believe Filinski's notation is superior for manipulation. Filinski
defines a postfix operator "raised star", which is denoted 'st' below:

st:: (Monad m) => (a -> m b) -> m a -> m b
st f m = m >>= f

Indeed, st = flip (>>=)

In Filinski's notation, the third monadic law has an especially
appealing form:
st ((st f) . g) = (st f) . (st g)

Let us also define 
arun (TI f) s n = f s n

We can then write for our monad:

st f = \m -> TI $ \s n -> case arun m s n of
 Ok (s',m',x') -> arun (f x') s' m'
 Error s' -> Error s'

Let _m, _s and _n denote "fresh" values of the right type (so we can later
appeal to the universal generalization rule (closely related to eta-reduction)

Phase 1:

arun ((st ((st f) . g)) _m) _s _n
=>
case arun _m _s _n of
  Ok (s',m',x') -> arun ((st f) $ g x') s' m'  -- x' is not free in f, g
  Error s' -> Error s'
=>
case arun _m _s _n of
  Ok (s',m',x') -> case arun (g x') s' m' of
  Ok (s'',m'',x'') -> arun (f x'') s'' m''
  Error s'' -> Error s''
  Error s' -> Error s'


Phase 2:

arun (((st f) . (st g)) _m) _s _n
=>
arun (((st f) $ (st g) _m) _s _n
=>
case arun ((st g) _m) _s _n of
  Ok (s'',m'',x'') -> arun (f x'') s'' m''  -- x'' is not free in f, g
  Error s'' -> Error s''
=>
case (case arun _m _s _n of
  Ok (s',m',x') -> arun (g x') s' m'-- x' is not free in f, g
  Error s' -> Error s') of
  Ok (s'',m'',x'') -> arun (f x'') s'' m''  -- x'' is not free in f, g
  Error s'' -> Error s''
=> {see note below}
case arun _m _s _n of
  Ok (s',m',x') -> case arun (g x') s' m' of
   Ok (s'',m'',x'') -> arun (f x'') s'' m''
   Error s'' -> Error s''
  Error s' -> Error s'

Now, the results of Phase 1 and Phase 2 are identical.  Given that _m,
_s and _n were unique, fresh variables, by appealing to the universal
generalization rule and the Church-Rosser property of our reductions,
we conclude that

st ((st f) . g) = (st f) . (st g)

The critical step is the associativity of case:

  case (case x of C1 -> O1; C2 -> O2) of C1' -> O1'; C2' -> O2'
==>
  case x of 
 C1 -> case O1 of C1' -> O1'; C2' -> O2'
 C2 -> case O2 of C1' -> O1'; C2' -> O2'

provided that variables bound in C1 and C2 do not occur in C1', O1', C2', O2'
___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell


Re: Haskell for non-Haskell's sake

2003-09-02 Thread Andy Gill
The Timber group at OHSU/OGI are using Haskell to write their Timber 
compiler
and Timber VM executable specification.

Andy Gill

Hal Daume III wrote:

Hi fellow Haskellers,

I'm attempting to get a sense of the topology of the Haskell
community.  Based on the Haskell Communities & Activities reports, it
seems that the large majority of people use Haskell for Haskell's sake.
If you use Haskell for a purpose *other than* one of those listed below,
I'd love to hear.  I don't need a long report, anything from a simple "I
do" to a paragraph would be fine, and if you want to remain anonymous
that's fine, too.
Purposes which I consider "Haskell for Haskell's sake" include:

 - writing Haskell compilers/interpreters
 - developing libraries for Haskell
 - writing Haskell debuggers, tracers, profilers or other tools
 - more or less anything with matches /.*Haskell.*/, other than
   /in Haskell$/   :)
Thanks,

- Hal

--
Hal Daume III   | [EMAIL PROTECTED]
"Arrest this man, he talks in maths."   | www.isi.edu/~hdaume
___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell
 



___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell


Re: Haskell for non-Haskell's sake

2003-09-02 Thread Andrew J Bromage
G'day all.

On Fri, Aug 29, 2003 at 05:39:09PM -0700, Hal Daume III wrote:

> I'm attempting to get a sense of the topology of the Haskell
> community.

I used Haskell to write a compiler for the RenderMan shading language
for a former employer.  Unfortunately, the compiler never shipped.

I still own the IP, though, so it may yet end up open source.

Cheers,
Andrew Bromage
___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell


New address

2003-09-02 Thread jan . skibinski
I apologize to anyone who wrote me last week and did not get any response. For a 
reason unknown to me I can no longer access the email account which I used when 
subscribing to this list. I hope this address will remain stable enough.
Jan


___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell


Re: Haskell for non-Haskell's sake

2003-09-02 Thread Brett Letner
On Fri, Aug 29, 2003 at 05:39:09PM -0700, Hal Daume III wrote:

I'm attempting to get a sense of the topology of the Haskell

I work at Galois Connections  and much of the 
software we write (mostly government contracting) is written in 
Haskell.  I've written an ASN.1 parser prototype, a 
remote-procedure-call framework, and a secure web-server back-end.

--
Brett Letner
Galois Connections, Inc.
http://www.galois.com
mailto:[EMAIL PROTECTED]
phone:(503)626-6616 ext.110
___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell


Re: Haskell for non-Haskell's sake

2003-09-02 Thread Steffen Mazanek
Hello,

I am a student from Germany and I have used Haskell for several purposes 
as well:
- to implement and compare algorithms quickly, e.g. Travelling Salesman, 
Sorting, etc.
- to calculate state spaces and blocking probabilities in networks
- to solve some of our cryptography and computability excersises :-)
- to solve several programs of the online judge, although Haskell is 
currently not supported

Further on I have written an interpreter for RATH (exploring finite 
relation algebras using tools written in Haskell)
and in this time I use Haskell in my diplome thesis (but unfortunately 
for the sake of Haskell :-p).

Some time ago, we had some problems with our news server and installed a 
new inn. This
new inn was totally incompatible with the old one (or we were to clumsy 
to figure it out) and
so the old articles seem to be lost. So it was our task to write a 
script, which should transform the
backuped, old articles on the server into expect-scripts. I did this in 
Haskell and it worked
satisfactorily :-) I call it the "News-Reposter" *g*.

Haskell is my programming language of choice.
It is possible, to solve problems quickly and the algorithms look so 
beautiful. I miss
convenient and standardized libraries for gui-programming! I think, this 
is a serious problem.

Bye,
Steffen Mazanek
P.S.
I do my best to motivate other people to give Haskell a try, e.g. during 
a lecture about
document-description-languages I had provided a funny example, how 
useful HaXml is :-)
The program reads a xml-file with descriptions (age, iq, bust size *g*, 
all values are only estimated) of
some famous women (Britney, Madonna, etc.) and puts out a 
nicely-formatted html-file with a
final evaluation (value=iq*bustsize-100*|age-22|  *g*).
In case, that a woman is reading this list: One could easily invent a 
formula as well, which evaluates men.





___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell


Re: Haskell for non-Haskell's sake

2003-09-02 Thread William Lee Irwin III
On Fri, Aug 29, 2003 at 05:39:09PM -0700, Hal Daume III wrote:
> I'm attempting to get a sense of the topology of the Haskell
> community.  Based on the Haskell Communities & Activities reports, it
> seems that the large majority of people use Haskell for Haskell's sake.
> If you use Haskell for a purpose *other than* one of those listed below,
> I'd love to hear.  I don't need a long report, anything from a simple "I
> do" to a paragraph would be fine, and if you want to remain anonymous
> that's fine, too.
> Purposes which I consider "Haskell for Haskell's sake" include:
>   - writing Haskell compilers/interpreters
>   - developing libraries for Haskell
>   - writing Haskell debuggers, tracers, profilers or other tools
>   - more or less anything with matches /.*Haskell.*/, other than
> /in Haskell$/   :)

I use Haskell interpreters as a "more expressive calculator", also
do basic scripting such as vast numbers regularly improvised log
processing scripts (usually for logs of debugging output and other
similar dumps), as well as some somewhat less frequently improvised
network "scripts" or script-like things (both clients and servers).
i.e. where others use perl and expect. Haskell's faster for me to write.

-- wli
___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell


Re: Haskell for non-Haskell's sake

2003-09-02 Thread Satnam Singh
I use Haskell to design and verify circuits that are used at my company and
by our customers.
A Haskell-based methodology for producing circuits has proved to be
successful in some situations when a conventional flow based on Java or
hardware description languages (VHDL and Verilog) was not able to deliver a
solution of suitably high quality (speed or area).

Some information at http://www.xilinx.com/labs/lava
A public release will be made available before the end of the year.

Cheers,

Satnam

Hal Daume III wrote:

> Hi fellow Haskellers,
>
> I'm attempting to get a sense of the topology of the Haskell
> community.  Based on the Haskell Communities & Activities reports, it
> seems that the large majority of people use Haskell for Haskell's sake.
>
> If you use Haskell for a purpose *other than* one of those listed below,
> I'd love to hear.  I don't need a long report, anything from a simple "I
> do" to a paragraph would be fine, and if you want to remain anonymous
> that's fine, too.
>
> Purposes which I consider "Haskell for Haskell's sake" include:
>
>   - writing Haskell compilers/interpreters
>   - developing libraries for Haskell
>   - writing Haskell debuggers, tracers, profilers or other tools
>   - more or less anything with matches /.*Haskell.*/, other than
> /in Haskell$/   :)
>
> Thanks,
>
>  - Hal
>
> --
>  Hal Daume III   | [EMAIL PROTECTED]
>  "Arrest this man, he talks in maths."   | www.isi.edu/~hdaume
>
> ___
> Haskell mailing list
> [EMAIL PROTECTED]
> http://www.haskell.org/mailman/listinfo/haskell

___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell


RE: Type class problem

2003-09-02 Thread Simon Peyton-Jones

| > b) at the moment dictionaries have the property that you can always
| > evaluate them using call-by-value; if they could be recursively
| > defined (as you suggest) that would no longer be the case
| >
| > Mind you, GHC doesn't currently take advantage of (b), so maybe it
| > should be ignored.  Adding the current goal as an axiom would not be
| > difficult, but I don't have time to do it today!  Is anyone else
| > interested in such a feature?
| 
| I would like to try making this change, but I couldn't puzzle out
enough
| of the type class system the last time I looked. I would appreciate
| advice, references, or even just a list of the relevant modules.

If you want to try fiddling with GHC, try the -fdicts-strict flag, and
look for where it is used in the source (opt_DictsStrict).  The
predicate Type.isStrictPred is also relevant.

| Allowing implications in contexts even allows us to derive instances
for
| some irregular types:
| 
| data Twice f x = T (f (f x))
| data Growing f = G (f (Growing (Twice f)))
| data Id x = Id x
| 
| Suppose we want to define instances that will imply Show (Growing Id).
| Growing Id is an irregular type so allowing irregular derivations
isn't
| enough, but the following instances are acceptable
| 
| instance (forall a.Show a => Show f a,Show x) => Show (Twice f x)
where
|   show (T ffx) = show "T "++show ffx

Indeed so. That's exactly what the "Deriving type classes" paper points
out, and Valery's Haskell Workshp 2003 paper "Simulating quantified
class constraints" is also highly relevant.

Simon


___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell


RE: Type class problem

2003-09-02 Thread Simon Peyton-Jones
| I'm wondering if the general method of avoiding non-termination can be
| made to work in these more complex cases.
| 
| Incidentally, the constraint solver stack overflow problem can be
| turned to our advantage. The typechecker's exhausting the stack should
| be considered a failure to match the instance -- and so the
| typechecker should mark the current instance inappropriate and try
| another one, if any.

Ultimately, this boils down to solving the halting problem, I believe.
Stack-overflow isn't a proof that the thing isn't soluble.  I can
believe that it woks nicely in practice, but it's a bit of a hack!

Simon


___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell