Re: [GHC] #4867: ghci displays negative floats incorrectly (was: Incorrect result from trig functions)

2011-02-06 Thread GHC
#4867: ghci displays negative floats incorrectly (was: Incorrect result from 
trig
functions)
---+
Reporter:  gwright |Owner:  gwright
Type:  bug |   Status:  new
Priority:  high|Milestone:  7.0.2  
   Component:  GHCi|  Version:  7.0.1  
Keywords:  | Testcase: 
   Blockedby:  |   Difficulty: 
  Os:  MacOS X | Blocking: 
Architecture:  x86_64 (amd64)  |  Failure:  Incorrect result at runtime
---+

Comment(by gwright):

 I was half right: rather than being missing, another piece of the OS X 64
 bit linker was just sketched in.  This code incorrectly calculated some of
 the less common relocations.  The fix was just to replace the erroneous
 code with a call to `relocateAddress`.

 Here's what happens now:
 {{{
 gwright-macbook inplace/bin/ghc-stage2 --interactive
 GHCi, version 7.0.1.20101221: http://www.haskell.org/ghc/  :? for help
 Loading package ghc-prim ... linking ... done.
 Loading package integer-gmp ... linking ... done.
 Loading package base ... linking ... done.
 Loading package ffi-1.0 ... linking ... done.
 Prelude -1.0
 --1.0
 Prelude
 }}}

 I don't yet understand the double minus sign in the result.  It's probably
 caused by the messing about I did with `Float.lhs` when trying to track
 down the bug.  I hope there isn't another real bug here, but you never
 know.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/4867#comment:25
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #4902: Create a primop for getting the size of an Array#

2011-02-06 Thread GHC
#4902: Create a primop for getting the size of an Array#
-+--
Reporter:  tibbe |Owner:  
Type:  feature request   |   Status:  patch   
Priority:  normal|Milestone:  
   Component:  Runtime System|  Version:  7.0.1   
Keywords:| Testcase:  
   Blockedby:|   Difficulty:  
  Os:  Unknown/Multiple  | Blocking:  
Architecture:  Unknown/Multiple  |  Failure:  None/Unknown
-+--
Changes (by tibbe):

 * cc: johan.tibell@… (added)


Comment:

 I've added a test to the test suite. All tests pass (for arrays of size
 [0..1000]). Please review.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/4902#comment:6
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #4867: ghci displays negative floats incorrectly (was: Incorrect result from trig functions)

2011-02-06 Thread GHC
#4867: ghci displays negative floats incorrectly (was: Incorrect result from 
trig
functions)
---+
Reporter:  gwright |Owner:  gwright
Type:  bug |   Status:  new
Priority:  high|Milestone:  7.0.2  
   Component:  GHCi|  Version:  7.0.1  
Keywords:  | Testcase: 
   Blockedby:  |   Difficulty: 
  Os:  MacOS X | Blocking: 
Architecture:  x86_64 (amd64)  |  Failure:  Incorrect result at runtime
---+

Comment(by altaic):

 Not sure if you had already discovered this, but it appears the bug is
 limited to `Double`, while `Float` appears to be fine:
 {{{
 Prelude -1.0 :: Float
 -1.0
 Prelude -1.0 :: Double
 -3.666940035476786e76
 }}}

 Oddly, the transform that's producing the garbage value is reversible
 (guessing there'd be loss of bits at extremes):
 {{{
 Prelude -1.0 :: Double
 -3.666940035476786e76
 Prelude -3.666940035476786e76 :: Double
 -1.0
 }}}

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/4867#comment:26
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #4852: cabal doesn't tell ./configure which gcc to use

2011-02-06 Thread GHC
#4852: cabal doesn't tell ./configure which gcc to use
+---
  Reporter:  kazu-yamamoto  |  Owner:  
  Type:  bug| Status:  closed  
  Priority:  highest|  Milestone:  7.0.2   
 Component:  libraries (other)  |Version:  7.1 
Resolution:  fixed  |   Keywords:  
  Testcase: |  Blockedby:  
Difficulty: | Os:  Unknown/Multiple
  Blocking: |   Architecture:  Unknown/Multiple
   Failure:  Other  |  
+---

Comment(by kazu-yamamoto):

 OK. I understand. I installed cabal-install again and confirmed that the
 following cabal-install can compile the network 2.3.0.1
 {{{
 cabal-install version 0.9.5
 using version 1.10.1.0 of the Cabal library
 }}}
 Thank you very much.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/4852#comment:29
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


System.Posix.Signals weirdness

2011-02-06 Thread Matthias Kilian
Hi,

I'd expect the following program (compiled with ghc and without any
specieal flags) to produce

Just (Exited ExitSuccess)
True

but it produces

Just (Exited ExitSuccess)
False

on Debian Lenny (ghc-6.8), OpenBSD-current (ghc-6.12.3), OpenBSD-current
(ghc=7.0 from the 7.0 branch).

module Main where

import Data.IORef
import System.Posix.Process
import System.Posix.Signals
import System.Posix.Unistd

main = do
caughtCHLD - newIORef False
installHandler sigCHLD (Catch $ writeIORef caughtCHLD True) 
Nothing
pid - forkProcess $ sleep 2  return ()
s - sleep 8
getProcessStatus False False pid = print
readIORef caughtCHLD = print

The sigCHLD handler is never called in this program. Is this expected
behaviour? If so, why?

Ciao,
Kili

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: Question about Haskell AST

2011-02-06 Thread Tim Chevalier
On Mon, Jan 10, 2011 at 9:21 AM, Jane Ren j2...@ucsd.edu wrote:
 Hi,

 I need to be able to take a piece of Haskell source code and get an 
 simplified, typed, intermediate representation of the AST, which means I need 
 to use compiler/coreSyn/CoreSyn.lhs

 So I'm first trying to get the desguaredModule of the source code with
        ...
        modSum - getModSummary $ mkModuleName ...
        p - parseModule modSum
        t - typecheckModule p
        d - desugarModule t

 Now I'm really stuck on figuring out how to connect the variable d of type 
 desugaredModule to compiler/coreSyn/CoreSyn.lhs to get Expr patterns like 
 App, Let, Case, etc.

 Also, is it correct to get the deguaredModule first?  At least CoreSyn.lhs 
 seems to suggest this.


Sorry for the very late reply, but have you considered using External Core?
http://www.haskell.org/ghc/docs/7.0.1/html/users_guide/ext-core.html
http://hackage.haskell.org/package/extcore

IMO, it's less pain than linking with the GHC library unless your
application really needs to get transformed Core back into the GHC
back-end.

Cheers,
Tim

-- 
Tim Chevalier * http://cs.pdx.edu/~tjc/ * Often in error, never in doubt
an intelligent person fights for lost causes,realizing that others
are merely effects -- E.E. Cummings

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


a compiled program is slower than byte code

2011-02-06 Thread 山本和彦
Hello, 

If I compile the attach code with GHC of the newest ghc-7.0 darcs
branch, the compiled program is much slower than byte code. This
phenomenon does not exist in GHC 6.12.3.

6.12.3  runghc   -- 6.23s user 0.59s system 98% cpu 6.912 total
ghc  -- 5.72s user 0.70s system 99% cpu 6.422 total
ghc -O   -- 5.70s user 0.67s system 99% cpu 6.376 total
ghc -O2  -- 5.69s user 0.67s system 99% cpu 6.373 total

ghc-7.0 runghc   -- 6.43s user 0.10s system 99% cpu 6.593 total
ghc  -- 9.20s user 0.09s system 99% cpu 9.302 total
ghc -O   -- 9.20s user 0.09s system 99% cpu 9.298 total
ghc -O2  -- 9.38s user 0.09s system 99% cpu 9.478 total

Is this a bug?

My environment is Mac which runs Snow Leopard.

--Kazu


import System.IO

n :: Int
n = 1

main :: IO ()
main = withFile /dev/null WriteMode $ \h -
hPutStr h . foldr1 (++) . replicate n . replicate n $ 'a'


___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Dictionaries and full laziness transformation

2011-02-06 Thread Akio Takano
Hi,

I'm using GHC 7.0.1. I found that recursive overloaded functions tend
to leak memory when compiled with full-laziness optimization on. Here
is a simple case.

-- TestSub.hs
{-# LANGUAGE BangPatterns #-}
module TestSub where

{-# NOINLINE factorial #-}
factorial :: (Num a) = a - a - a
factorial !n !acc = if n == 0 then acc else factorial (n - 1) (acc * n)

-- main.hs
import TestSub

factorial1 :: Int - Int - Int
factorial1 = factorial

main = do
n - readLn
print $ factorial1 n 1

main

This program should run in constant space, and compiled with -O0 or
-O2 -fno-full-laziness, it does. However with -O2, it takes a linear
amount of memory. The core for factorial looks like this:

TestSub.factorial =
  \ (@ a_ajm) ($dNum_slz :: GHC.Num.Num a_ajm) -
let {
  a_slA :: GHC.Classes.Eq a_ajm
  [LclId]
  a_slA = GHC.Num.$p1Num @ a_ajm $dNum_slz } in
let {
  lvl2_slC :: a_ajm - a_ajm - a_ajm
  [LclId]
  lvl2_slC = TestSub.factorial @ a_ajm $dNum_slz } in
...

The problem is that lvl2_slC closure is created whenever factorial is
applied to a Num dictionary, and kept alive until that application is
GCed. In this program it never happens, because an application to the
Num Int dictionary is referred to by the factorial1 CAF, and it
recursively keeps the whole chain of closures alive.

I know that full laziness transformation *sometimes* causes a space
leak, but this looks like a bad result to me, because:

- It looks like there is no point building a lot of equivalent
closures, instead of one.
- A lot of code can suffer from this behavior, because overloaded
recursive functions are fairly common.
  For example, unfoldConvStream function from the latest iteratee
package suffers from this problem, if I understand correctly.

Does anyone have an idea on whether this can be fixed in GHC, or how
to work around this problem?

Regards,

Takano Akio

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


[Haskell] SLE 2011 - 2nd Call for papers

2011-02-06 Thread João Fernandes



 2nd CALL FOR PAPERS

 SLE 2011
4th International Conference on Software Language Engineering

   Braga, Portugal, 3-6 July 2011

   http://planet-sl.org/sle2011/

 Co-located with the 4th Summer School on Generative and
 Transformational Techniques in Software Engineering
 (GTTSE 2011)

=

IMPORTANT DATES

* 2011:
Paper submission: April 08 (midnight Apia Samoa time)
Author notification: May 13
Paper submission for online proceedings: June 17
Conference: July 03-06
Camera-ready copy submission for post-proceedings: August 29

-

Software language engineering is devoted to topics related
to artificial languages in software engineering. The foremost
mission of the International Conference on Software Language
Engineering (SLE) is to encourage and organize communication
between communities that traditionally have looked at soft-
ware languages from different, more specialized, and yet
complementary perspectives. Thus, technologies, methods,
experiments and case studies from modelware, grammarware,
and ontologyware serving the objectives of software languages
are of particular relevance to SLE.

We invite high-quality submissions to all conference tracks.
Submissions must be PDF files following the Springer LNCS
style and will be managed using the EasyChair submission system.
Please check the conference web site for further information.

SLE 2011 will include a Doctoral Symposium that will provide a
supportive yet questioning setting in which PhD students can
present their work, including goals, methods, and preliminary
results. The Symposium aims to provide students with useful
guidance and feedback on various aspects of their research from
established researchers and the other student attendees.

Please forward this call to anyone who might be interested.

http://planet-sl.org/sle2011/

-
PAPER SUBMISSION

Submitted papers must be original work and must not be
previously published in, currently submitted to, or currently
in consideration for any journal, book, conference, or
workshop. Each submitted paper will be reviewed closely by
at least three members of the program committee. Accepted
papers will be distributed at the conference via the online
proceedings as well as published in the post-proceedings,
which will appear in the Springer Lecture Notes in Computer
Science (LNCS) series. Authors will have the opportunity
to revise their accepted paper(s) for the pre- and post-
proceedings. For an accepted paper to appear in the proceedings,
at least one author must attend the event and present the work.

-
RESEARCH PAPERS

Research papers should report a substantial research contribution
to SLE and/or a successful application of SLE techniques.  We
solicit high-quality contributions in the area of SLE ranging
from theoretical and conceptual contributions to tools, techniques,
and frameworks that support the aforementioned lifecycle activities.
We list examples of tools, techniques, applications, and problems of
interest to clarify the types of contributes that we seek:

* Formalisms used in designing and specifying languages and
tools that analyze such language descriptions
* Language implementation techniques
* Program and model transformation tools
* Composition, integration, and mapping tools for managing
different aspects of software languages or different
manifestations of a given language
* Transformations and transformation languages between
languages and models
* Language evolution
* Approaches to elicitation, specification, or verification
of requirements for software languages
* Language development frameworks, methodologies, techniques,
best practices, and tools for the broader language lifecycle
covering phases such as analysis, testing , and documentation.
* Design challenges in SLE
* Applications of languages including innovative domain-specific
languages or little languages

The preceding list is neither exclusive nor exhaustive.  Visit
the conference web site for more information about the scope
and topics of interest of SLE, or contact the program co-chairs
with questions.

Page limit: 20

-
SHORT PAPERS

Short papers may describe interesting or thought-provoking
concepts that are not yet fully developed or evaluated, make
an initial contribution to challenging research issues in SLE,
or discuss and analyze controversial issues in the field.

Page limit: 10

-
TOOL DEMONSTRATION PAPERS

Because of SLE's ample interest in tools, we seek papers
that present software tools related to the field of SLE.
These papers will 

[Haskell] ANN: monad-control-0.1

2011-02-06 Thread Bas van Dijk
Dear all,

Several attempts have been made to lift control operations (functions
that use monadic actions as input instead of just output) through
monad transformers:

MonadCatchIO-transformers[1] provided a type class that allowed to
overload some often used control operations (catch, block and
unblock). Unfortunately that library was limited to those operations.
It was not possible to use, say, alloca in a monad transformer. More
importantly however, the library was broken as was explained[2] by
Michael Snoyman. In response Michael created the MonadInvertIO type
class which solved the problems. Then Anders Kaseorg created the
monad-peel library which provided an even nicer implementation.

monad-control is a rewrite of monad-peel that uses CPS style
operations and exploits the RankNTypes language extension to simplify
and speedup most functions. A very preliminary and not yet fully
representative, benchmark shows that monad-control is on average about
2.6 times faster than monad-peel:

bracket:  2.4 x faster
bracket_: 3.1 x faster
catch:1.8 x faster
try:  4.0 x faster
mask: 2.0 x faster

Note that, although the package comes with a test suite that passes, I
still consider it highly experimental.


API DOCS:

http://hackage.haskell.org/package/monad-control


INSTALLING:

$ cabal update
$ cabal install monad-control


TESTING:

The package contains a copy of the monad-peel test suite written by
Anders. You can perform the tests using:

$ cabal unpack monad-control
$ cd monad-control
$ cabal configure -ftest
$ cabal test


BENCHMARKING:

$ darcs get http://bifunctor.homelinux.net/~bas/bench-monad-peel-control/
$ cd bench-monad-peel-control
$ cabal configure
$ cabal build
$ dist/build/bench-monad-peel-control/bench-monad-peel-control


DEVELOPING:

The darcs repository will be hosted on code.haskell.org ones that
server is back online. For the time being you can get the repository
from:

$ darcs get http://bifunctor.homelinux.net/~bas/monad-control/


TUTORIAL:

This short unpolished tutorial will explain how to lift control
operations through monad transformers. Our goal is to lift a control
operation like:

foo ∷ M a → M a

where M is some monad, into a transformed monad like 'StateT M':

foo' ∷ StateT M a → StateT M a

The first thing we need to do is write an instance for the
MonadTransControl type class:

class MonadTrans t ⇒ MonadTransControl t where
  liftControl ∷ (Monad m, Monad n, Monad o)
  ⇒ (Run t n o → m a) → t m a

If you ignore the Run argument for now, you'll see that liftControl is
identical to the 'lift' method of the MonadTrans type class:

class MonadTrans t where
lift ∷ Monad m ⇒ m a → t m a

So the instance for MonadTransControl will probably look very much
like the instance for MonadTrans. Let's see:

instance MonadTransControl (StateT s) where
liftControl f = StateT $ \s → liftM (\x → (x, s)) (f run)

So what is this run function? Let's look at its type:

type Run t n o = ∀ b. t n b → n (t o b)

The run function executes a transformed monadic action 't n b' in the
non-transformed monad 'n'. In our case the 't' will be a StateT
computation. The only way to run a StateT computation is to give it
some state and the only state we have lying around is the one from the
outer computation: 's'. So let's run it on 's':

instance MonadTransControl (StateT s) where
liftControl f =
StateT $ \s →
  let run t = ... runStateT t s ...
  in liftM (\x → (x, s)) (f run)

Now that we are able to run a transformed monadic action, we're almost
done. Look at the type of Run again. The function should leave the
result 't o b' in the monad 'n'. This 't o b' computation should
contain the final state after running the supplied 't n b'
computation. In case of our StateT it should contain the final state
s':

instance MonadTransControl (StateT s) where
liftControl f =
StateT $ \s →
  let run t = liftM (\(x, s') → StateT $ \_ → return (x, s'))
(runStateT t s)
  in liftM (\x → (x, s)) (f run)

This final computation, StateT $ \_ → return (x, s'), can later be
used to restore the final state. Now that we have our
MonadTransControl instance we can start using it. Recall that our goal
was to lift foo ∷ M a → M a into our StateT transformer yielding the
function foo' ∷ StateT M a → StateT M a.

To define foo', the first thing we need to do is call liftControl:

foo' t = liftControl $ \run → ...

This captures the current state of the StateT computation and provides
us with the run function that allows us to run a StateT computation on
this captured state.

Now recall the type of liftControl ∷ (Run t n o → m a) → t m a. You
can see that in place of the ... we must fill in a value of type 'm
a'. In our case this will be a value of type 'M a'. We can construct
such a value by calling foo. However, foo expects an argument of type
'M a'. Fortunately we can provide one if we convert the supplied 't'

[Haskell] ANN: case-insensitive-0.1

2011-02-06 Thread Bas van Dijk
Dear all,

I had this old module laying around that I wrote some time ago. I
dusted it off and uploaded it to Hackage:

http://hackage.haskell.org/package/case-insensitive-0.1

The package provides the module Data.CaseInsensitive which exports the
CI type constructor which can be parameterised by a string-like type
like: String, ByteString, Text, etc.. Comparisons of values of the
resulting type are then insensitive to cases.

It is my hope that one day packages like snap-core[1], http-types[2]
or wai[3] all use this common way of making strings case insensitive.

Regards,

Bas

[1] 
http://hackage.haskell.org/packages/archive/snap-core/latest/doc/html/Data-CIByteString.html
[2] 
http://hackage.haskell.org/packages/archive/http-types/0.3.0/doc/html/Network-HTTP-Types.html#t:CIByteString
[3] 
http://hackage.haskell.org/packages/archive/wai/latest/doc/html/Network-Wai.html#v:CIByteString

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


[Haskell] ANNOUNCE: pwstore 1.0 (Secure password storage)

2011-02-06 Thread Peter Scott
Hi everyone,

If you need to store and verify passwords, the usual advice is to use
bcrypt. It neatly handles all the security issues, with a simple API. But
Haskell doesn't have bcrypt bindings, so people are tempted to roll their
own password storage methods, and perhaps get it wrong. I decided to fix
that. The pwstore library handles all the details of password storage for
you, in a way that should be so easy to use that there's no reason not to
use it.

WHAT IT DOES

You hash and salt passwords with one function, and verify user input against
these password hashes with another function. For more information, see the
API docs:

http://hackage.haskell.org/packages/archive/pwstore-fast/1.0/doc/html/Crypto-PasswordStore.html


HOW IT WORKS

The basic algorithm is this:

* Combine the user's password with a randomly-generated salt.

* Hash this slowly. By iterating SHA-256 a few thousand times, we make
brute-force guessing a lot less practical.

* Store this has along with the salt.

This scheme is essentially an implementation of the PBKDF1 key derivation
function (as specified in RFC 2898) with some convenience code around it to
make it easy to use and really hard to mess up.


WHERE TO GET IT

There are two packages on Hackage, which you can get with cabal-install:

1. pwstore-fast is the preferred version.

2. pwstore-purehaskell has the same API, but only pure Haskell dependencies.
It's usable, but about 25 times slower than pwstore-fast.

http://hackage.haskell.org/package/pwstore-fast
http://hackage.haskell.org/package/pwstore-purehaskell

The source code is on GitHub:

https://github.com/PeterScott/pwstore/

Any comments, questions, or patches are welcome.

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


Re: [Haskell] ANNOUNCE: pwstore 1.0 (Secure password storage)

2011-02-06 Thread Mark Wotton
If you're going to use C anyway, why not bind bcrypt?

mark

On 07/02/2011, at 2:13 PM, Peter Scott wrote:

 Hi everyone,
 
 If you need to store and verify passwords, the usual advice is to use bcrypt. 
 It neatly handles all the security issues, with a simple API. But Haskell 
 doesn't have bcrypt bindings, so people are tempted to roll their own 
 password storage methods, and perhaps get it wrong. I decided to fix that. 
 The pwstore library handles all the details of password storage for you, in a 
 way that should be so easy to use that there's no reason not to use it.
 
 WHAT IT DOES
 
 You hash and salt passwords with one function, and verify user input against 
 these password hashes with another function. For more information, see the 
 API docs:
 
 http://hackage.haskell.org/packages/archive/pwstore-fast/1.0/doc/html/Crypto-PasswordStore.html
 
 
 HOW IT WORKS
 
 The basic algorithm is this:
 
 * Combine the user's password with a randomly-generated salt.
 
 * Hash this slowly. By iterating SHA-256 a few thousand times, we make 
 brute-force guessing a lot less practical.
 
 * Store this has along with the salt.
 
 This scheme is essentially an implementation of the PBKDF1 key derivation 
 function (as specified in RFC 2898) with some convenience code around it to 
 make it easy to use and really hard to mess up.
 
 
 WHERE TO GET IT
 
 There are two packages on Hackage, which you can get with cabal-install:
 
 1. pwstore-fast is the preferred version.
 
 2. pwstore-purehaskell has the same API, but only pure Haskell dependencies. 
 It's usable, but about 25 times slower than pwstore-fast.
 
 http://hackage.haskell.org/package/pwstore-fast
 http://hackage.haskell.org/package/pwstore-purehaskell
 
 The source code is on GitHub:
 
 https://github.com/PeterScott/pwstore/
 
 Any comments, questions, or patches are welcome.
 
 -Peter
 ___
 Haskell mailing list
 Haskell@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell

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


Re: [Haskell] ANNOUNCE: pwstore 1.0 (Secure password storage)

2011-02-06 Thread Thomas Davie

On 7 Feb 2011, at 03:23, Mark Wotton wrote:

 If you're going to use C anyway, why not bind bcrypt?

Better yet, bind the password storage API on platforms where it exists (e.g. 
keychain access on OS X)

Tom Davie


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


Re: Announce: ~Haskell 2011

2011-02-06 Thread Ian Lynagh
On Fri, Jan 07, 2011 at 06:39:11PM +, Malcolm Wallace wrote:

  (b) this delta will be applied to the 2010 Report to form a new  
 baseline;

Did this happen? If so, where is it?

I only found:
http://darcs.haskell.org/haskell-prime-report/
which hasn't had a patch since Jul 21 2009, and:
http://darcs.haskell.org/haskell98-report/
http://darcs.haskell.org/haskell2010-report/
which are for older versions of the standard.

  (a) we wish to accept the NoDatatypeContexts proposal
  http://hackage.haskell.org/trac/haskell-prime/wiki/NoDatatypeContexts

Shouldn't
http://hackage.haskell.org/trac/haskell-prime/ticket/139
be state accepted and closed now, then?


Thanks
Ian


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


Re: [Haskell-cafe] Byte Histogram

2011-02-06 Thread Bernie Pope
On 6 February 2011 02:40, Andrew Coppin andrewcop...@btinternet.com wrote:

 Then again, if you could actually single-step through a Haskell program's
 execution, most strictness issues would become quite shallow.

You can single-step through a Haskell program's execution with the
GHCi debugger. It can provide considerable insight into evaluation
order.

A proper stack tracer would make it even more useful.

Cheers,
Bernie.

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


Re: [Haskell-cafe] Byte Histogram

2011-02-06 Thread Roel van Dijk
On 5 February 2011 16:21, Andrew Coppin andrewcop...@btinternet.com wrote:
 I didn't think Clean supported laziness at all? I thought it was a strict
 language.

CLEAN is a practical applicable general-purpose lazy pure functional
programming language suited for the development
of real world applications. [1]

Haskell en Clean are very much alike. You can even compile Haskell 98
code with the latest (experimental) Clean compiler and having it
interact with Clean code and vice-versa [2]. The main difference is
Clean's use of uniqueness typing.


1 - http://clean.cs.ru.nl/download/Clean20/doc/CleanLangRep.2.1.pdf
2 - 
http://www.cs.ru.nl/~thomas/publications/groj10-exchanging-sources-between.pdf

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


Re: [Haskell-cafe] community server hasktags learned recursing into directories

2011-02-06 Thread Mark Wotton
On Sat, Feb 5, 2011 at 6:43 AM, Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com wrote:
 On 5 February 2011 10:14, Luke Palmer lrpal...@gmail.com wrote:
 I host all my modules on github.  It is a very supportive environment
 for spontaneous collaborative development.  c.h.o is a nice place, but
 lacks in maturity in comparison.  As long as there is a complete, free
 place like github around, why not use it?

 1) Github uses git, not darcs.

Git is good enough for serious use.

 2) I know who runs/controls c.h.o, but not github (so if something
 goes wrong...)

If something goes wrong, the maintainer of c.h.o can commiserate with
you about it being down.
I suspect he/she doesn't have a large team of dedicated sysadmins to
put it right, or a set of redundant servers.

 3) Maturity? I can put darcs repos there, how mature does it need to be?

integrated pull requests, commenting systems, notifications of
updates, issue trackers...

if you particularly want to use something else for each of these,
that's fine, but it's nice to have a reasonable default.

mark

-- 
A UNIX signature isn't a return address, it's the ASCII equivalent of a
black velvet clown painting. It's a rectangle of carets surrounding a
quote from a literary giant of weeniedom like Heinlein or Dr. Who.
        -- Chris Maeda

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


Re: [Haskell-cafe] community server hasktags learned recursing into directories

2011-02-06 Thread Ivan Lazar Miljenovic
On 6 February 2011 22:43, Mark Wotton mwot...@gmail.com wrote:
 On Sat, Feb 5, 2011 at 6:43 AM, Ivan Lazar Miljenovic
 ivan.miljeno...@gmail.com wrote:
 On 5 February 2011 10:14, Luke Palmer lrpal...@gmail.com wrote:
 I host all my modules on github.  It is a very supportive environment
 for spontaneous collaborative development.  c.h.o is a nice place, but
 lacks in maturity in comparison.  As long as there is a complete, free
 place like github around, why not use it?

 1) Github uses git, not darcs.

 Git is good enough for serious use.

As, I believe, is darcs.

 2) I know who runs/controls c.h.o, but not github (so if something
 goes wrong...)

 If something goes wrong, the maintainer of c.h.o can commiserate with
 you about it being down.
 I suspect he/she doesn't have a large team of dedicated sysadmins to
 put it right, or a set of redundant servers.

There's also the data ownership issue, in that I'm more likely to
trust others in the Haskell community than I am from people that make
money from the website I'm using.

 3) Maturity? I can put darcs repos there, how mature does it need to be?

 integrated pull requests, commenting systems, notifications of
 updates, issue trackers...

 if you particularly want to use something else for each of these,
 that's fine, but it's nice to have a reasonable default.

*shrug* I don't see the advantage, but admittedly I don't have use for
any of these.  I more use c.h.o as a place to have a place to store
the code for others to look at if they need so, and so I can work both
at uni and at home on the same codebase.

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com

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


[Haskell-cafe] ANN: monad-control-0.1

2011-02-06 Thread Bas van Dijk
Dear all,

Several attempts have been made to lift control operations (functions
that use monadic actions as input instead of just output) through
monad transformers:

MonadCatchIO-transformers[1] provided a type class that allowed to
overload some often used control operations (catch, block and
unblock). Unfortunately that library was limited to those operations.
It was not possible to use, say, alloca in a monad transformer. More
importantly however, the library was broken as was explained[2] by
Michael Snoyman. In response Michael created the MonadInvertIO type
class which solved the problems. Then Anders Kaseorg created the
monad-peel library which provided an even nicer implementation.

monad-control is a rewrite of monad-peel that uses CPS style
operations and exploits the RankNTypes language extension to simplify
and speedup most functions. A very preliminary and not yet fully
representative, benchmark shows that monad-control is on average about
2.6 times faster than monad-peel:

bracket:  2.4 x faster
bracket_: 3.1 x faster
catch:1.8 x faster
try:  4.0 x faster
mask: 2.0 x faster

Note that, although the package comes with a test suite that passes, I
still consider it highly experimental.


API DOCS:

http://hackage.haskell.org/package/monad-control


INSTALLING:

$ cabal update
$ cabal install monad-control


TESTING:

The package contains a copy of the monad-peel test suite written by
Anders. You can perform the tests using:

$ cabal unpack monad-control
$ cd monad-control
$ cabal configure -ftest
$ cabal test


BENCHMARKING:

$ darcs get http://bifunctor.homelinux.net/~bas/bench-monad-peel-control/
$ cd bench-monad-peel-control
$ cabal configure
$ cabal build
$ dist/build/bench-monad-peel-control/bench-monad-peel-control


DEVELOPING:

The darcs repository will be hosted on code.haskell.org ones that
server is back online. For the time being you can get the repository
from:

$ darcs get http://bifunctor.homelinux.net/~bas/monad-control/


TUTORIAL:

This short unpolished tutorial will explain how to lift control
operations through monad transformers. Our goal is to lift a control
operation like:

foo ∷ M a → M a

where M is some monad, into a transformed monad like 'StateT M':

foo' ∷ StateT M a → StateT M a

The first thing we need to do is write an instance for the
MonadTransControl type class:

class MonadTrans t ⇒ MonadTransControl t where
  liftControl ∷ (Monad m, Monad n, Monad o)
  ⇒ (Run t n o → m a) → t m a

If you ignore the Run argument for now, you'll see that liftControl is
identical to the 'lift' method of the MonadTrans type class:

class MonadTrans t where
lift ∷ Monad m ⇒ m a → t m a

So the instance for MonadTransControl will probably look very much
like the instance for MonadTrans. Let's see:

instance MonadTransControl (StateT s) where
liftControl f = StateT $ \s → liftM (\x → (x, s)) (f run)

So what is this run function? Let's look at its type:

type Run t n o = ∀ b. t n b → n (t o b)

The run function executes a transformed monadic action 't n b' in the
non-transformed monad 'n'. In our case the 't' will be a StateT
computation. The only way to run a StateT computation is to give it
some state and the only state we have lying around is the one from the
outer computation: 's'. So let's run it on 's':

instance MonadTransControl (StateT s) where
liftControl f =
StateT $ \s →
  let run t = ... runStateT t s ...
  in liftM (\x → (x, s)) (f run)

Now that we are able to run a transformed monadic action, we're almost
done. Look at the type of Run again. The function should leave the
result 't o b' in the monad 'n'. This 't o b' computation should
contain the final state after running the supplied 't n b'
computation. In case of our StateT it should contain the final state
s':

instance MonadTransControl (StateT s) where
liftControl f =
StateT $ \s →
  let run t = liftM (\(x, s') → StateT $ \_ → return (x, s'))
(runStateT t s)
  in liftM (\x → (x, s)) (f run)

This final computation, StateT $ \_ → return (x, s'), can later be
used to restore the final state. Now that we have our
MonadTransControl instance we can start using it. Recall that our goal
was to lift foo ∷ M a → M a into our StateT transformer yielding the
function foo' ∷ StateT M a → StateT M a.

To define foo', the first thing we need to do is call liftControl:

foo' t = liftControl $ \run → ...

This captures the current state of the StateT computation and provides
us with the run function that allows us to run a StateT computation on
this captured state.

Now recall the type of liftControl ∷ (Run t n o → m a) → t m a. You
can see that in place of the ... we must fill in a value of type 'm
a'. In our case this will be a value of type 'M a'. We can construct
such a value by calling foo. However, foo expects an argument of type
'M a'. Fortunately we can provide one if we convert the supplied 't'

Re: [Haskell-cafe] Concurrency best practices?

2011-02-06 Thread Sterling Clover
On Feb 5, 2011, at 2:37 PM, Evan Laforge wrote:

 
 I recall reading that clojure has a concept of associative
 combination.  If you can declare that certain operations are
 associative then the runtime doesn't have to care if they get out of
 order.

I think that you're thinking about the commute operation: 
http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/commute

There's more discussion elsewhere on the web, including here: 
http://squirrel.pl/blog/2010/07/13/clojure-alter-vs-commute/

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


[Haskell-cafe] Snap 0.4 Released!

2011-02-06 Thread Gregory Collins
The Snap team is proud to announce the release of Snap 0.4,
containing a whole bunch of nifty new features. Here is what we've
been up to:

New Features


-   Heist now uses the brand new xmlhtml HTML5 parser for parsing
and rendering templates. This eliminates our dependency on XML and
makes it possible to include inline javascript/css in templates.
Check out Chris Smith's blog post for more information about
xmlhtml.

-   Along with the change to xmlhtml, we decided to convert Heist
to use Text instead of ByteString. This is a backwards-incompatible
change which breaks old code, but which we feel is the right thing
to do.

-   Snap now has support for file uploads (!) and the
multipart/form-data content type. Snap's file upload support uses
iteratees to stream uploaded data and comes with a convenience
function to writeuploaded files to a temporary directory. We put
significant effort into preventing denial of service attacks and
providing policy controls for things like maximum allowable file
size, upload timeouts, minimum upload speed, etc.

-   The web server now uses blaze-builder in the output response
body Enumerator. Besides being significantly faster for most
workloads than ByteString enumeration, this allowed us to save
several copies within the server code, giving us a moderate
performance improvement. However, this will break any existing code
making direct use of the output enumerator rather than using
convenience functions like writeBS. We encourage users who are
building up large responses out of lots of little bytestring chunks
to consider switching their code to using Builder and writeBuilder
to get a speed boost.

-   The development mode of projects built using our snap project
starter is now quite a bit smarter. The 0.3 version used hint to
interpret web handlers on-the-fly, but it re-interpreted the code
on each request, making keeping in-memory state between requests
impossible. The development mode now only rebuilds the project when
files actually change. State will now be preserved across requests
as long as the project files are not changed on disk.

-   Our file serving code has been substantially
improved/rewritten. The new code can automatically generate
stylable/themable directory indexes, provides configurable lists of
index files, and allows the user to plug in dynamic handlers. These
handlers can be used to perform arbitrary transformations based on
file type or file content on the fly. The new code also correctly
handles trailing slashes for relative path resolution.

-   It is now possible for user handlers to modify socket timeouts,
using the setTimeout function. This (finally) makes it possible to
have long-running request handlers.


Bugfixes/Improvements
-

-   Debugging support in snap-core is now turned off by default, as
it involves too much of a performance impact. Turning on debug
support results in a ~25% performance penalty. To turn debugging
output back on, pass the -f debug flag when installing snap-core.

-   Bugfix: we no longer log spurious thread killed messages in
the simple backend under HTTP/1.0.

-   Added catchFinishWith function.

-   Changed cookie interface to expose cookies in the response as a
map for easier manipulation.

As always, please let us know if you find any issues with the release.

Thanks!
-- 
Gregory Collins g...@gregorycollins.net

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


Re: [Haskell-cafe] Byte Histogram

2011-02-06 Thread Johan Tibell
On Sat, Feb 5, 2011 at 4:16 PM, Andrew Coppin
andrewcop...@btinternet.com wrote:
 Random fact: Data.Map.insertWith' exists. Data.IntMap.insertWith' does *not*
 exist.

The containers library is a mess. For example, Data.Map has 10+
functions (e.g. adjust) that don't have strict counterparts even
though the strict version is most likely what you want. Some functions
do allow you to force the value before it's inserted into the map just
because you can piggy-back on the evaluation of a constructor e.g.

update :: Ord k = (a - Maybe a) - k - Map k a - Map k a

f = update g someKey someMap
  where g = (\ v - let v' = v + 1 in v' `seq` Just v')

Since the implementation must evaluate the result of g to decide
whether to remove the element or not.

Johan

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


Re: [Haskell-cafe] Byte Histogram

2011-02-06 Thread Gábor Lehel
On Thu, Feb 3, 2011 at 11:40 PM, Richard O'Keefe o...@cs.otago.ac.nz wrote:

 On 4/02/2011, at 10:10 AM, Andrew Coppin wrote:

 The important obsevation is this: One tiny, almost insignificant change can 
 transform a program from taking 50 seconds and 400 MB of RAM into one that 
 takes 0.02 seconds and 0.1 MB of RAM. And, at least in this case, the 
 simpler version is the slow one.

 To say that Haskell is slow is both a little bit vague, and not really 
 backed up by facts. In about 5 minutes flat, I managed to write a Haskell 
 program that's very simple, and yet faster than a comparably simple C++ 
 program (and C++ is supposed to be fast). So it's not that Haskell is 
 slow. It's that Haskell is *tricky*. Tiny, tiny little changes that look 
 innocuous can have vast effects on performance. And this is a nice little 
 example of that effect.

 This seems to me to be the heart of the message, so maybe this reply is 
 on-topic.

 Back in the days when systems other than Wintel and maybe sort of intel Linux 
 were
 supported by Clean, I used to really love one of the features of the Clean 
 compiler.
 One simple command line switch and the compiler would list the names of all 
 your
 top level functions together with their types, and the types included 
 strictness.
 (Also uniqueness, not relevant to Haskell.)

 The GHC documentation says the information is in the interface files,
 but they are binary now, and I can't find it there.

 That got me thinking... What would happen if, instead of Integer, we had 
 two types, evaluated Integer and possibly unevaluated Integer? What if 
 the strictness or otherwise of a data structure were exposed at the type 
 level?

 Oh, you mean like !Int and Int in Clean?  I used to find bang *types* 
 rather easier to deal with
 than I now do bang *patterns*.

 Currently, if you want a strict list, you have to implement one yourself. 
 But is that strict in the spine, or the elements, or what?

 Spine strict: ![t].
 Spine and element strict: ![!t].

This does seem like a very appealing idea (to me), especially if
evaluation were to happen implicitly wherever the types require it.
Are there any major obstacles or philosophical objections to it other
than available time and manpower?



 I have no idea what the syntax for that would look like,

 Clean?



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




-- 
Work is punishment for failing to procrastinate effectively.

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


Re: [Haskell-cafe] Byte Histogram

2011-02-06 Thread Andrew Coppin

On 06/02/2011 09:13 AM, Roel van Dijk wrote:


Haskell en Clean are very much alike.


From what I could determine from a basic Clean introduction, Clean is 
very *unlike* Haskell, having a far more verbose and low-level syntax. 
(E.g., the compiler can't even determine whether a binding is recursive 
or not for itself. You have to say that manually.) It seems a very 
unecessarily complicated and messy language - which makes the name 
rather ironic.



You can even compile Haskell 98
code with the latest (experimental) Clean compiler and having it
interact with Clean code and vice-versa [2]. The main difference is
Clean's use of uniqueness typing.


As I say, I thought the main difference is that Clean is strict (which 
is why you can get good performance). Uniqueness typing is an 
interesting idea, that looks like it might be useful for more than mere I/O.


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


Re: [Haskell-cafe] Byte Histogram

2011-02-06 Thread Andrew Coppin

Random fact: Data.Map.insertWith' exists. Data.IntMap.insertWith' does *not*
exist.


The containers library is a mess.


I'm inclined to agree.

In particular, I get strange looks from people in the OOP community when 
I say I'm using a language that doesn't have any abstractions at all for 
dealing polymorphically with containers. In general, it's almost 
impossible to write a Haskell function that will work with a list, an 
(immutable) array, a hash table or a map, polymorphically.


I guess it's the case that containers has been there so long now that 
changing it would break everything. Still, I find myself hungry for 
something better.


Than again, the Prelude itself leaves several things to be desired...

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


Re: [Haskell-cafe] Byte Histogram

2011-02-06 Thread Stephen Tetley
On 6 February 2011 19:41, Andrew Coppin andrewcop...@btinternet.com wrote:
. (E.g., the
 compiler can't even determine whether a binding is recursive or not for
 itself. You have to say that manually.) It seems a very unecessarily
 complicated and messy language - which makes the name rather ironic.


Erm - nope. Sure you haven't mixed OCaml and Clean to get OCClaeman?

Clean is a very clean language. The only thing I got tripped up on
were uniqueness and strict annotations (thanks to Richard O'Keefe
above in the thread, for useful clarification).

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


Re: [Haskell-cafe] Byte Histogram

2011-02-06 Thread Johan Tibell
On Sun, Feb 6, 2011 at 8:48 PM, Andrew Coppin
andrewcop...@btinternet.com wrote:
 In particular, I get strange looks from people in the OOP community when I
 say I'm using a language that doesn't have any abstractions at all for
 dealing polymorphically with containers. In general, it's almost impossible
 to write a Haskell function that will work with a list, an (immutable)
 array, a hash table or a map, polymorphically.

 I guess it's the case that containers has been there so long now that
 changing it would break everything. Still, I find myself hungry for
 something better.

 Than again, the Prelude itself leaves several things to be desired...

I'm working on a new map data type at the moment, which is 2x faster
than Data.Map for all key types I've tried (i.e. Ints, Strings, and
ByteStrings). As part of that work I might try to define a map class
using associated data types. Data.Map can be made an instance of that
class without breaking any old code.

I think one reason we haven't seen a type class for containers is that
it isn't easy to create one using vanilla type classes (see Simon PJ's
paper on the topic.)

Johan

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


Re: [Haskell-cafe] Byte Histogram

2011-02-06 Thread Alexey Khudyakov

On 06.02.2011 23:29, Johan Tibell wrote:

On Sun, Feb 6, 2011 at 8:48 PM, Andrew Coppin
andrewcop...@btinternet.com  wrote:

In particular, I get strange looks from people in the OOP community when I
say I'm using a language that doesn't have any abstractions at all for
dealing polymorphically with containers. In general, it's almost impossible
to write a Haskell function that will work with a list, an (immutable)
array, a hash table or a map, polymorphically.


I think one reason we haven't seen a type class for containers is that
it isn't easy to create one using vanilla type classes (see Simon PJ's
paper on the topic.)

Well Foldable and Traversable provide set of generic operations for 
containers. Although they are quite limited, containter must be 
polymorphic (e.g. no IntMap) and parameter must be of any type (e.g. no 
unboxed vectors) both are still quite useful.


Also there is a container-classes package which provide set of type 
class for containers.


[1] http://hackage.haskell.org/package/container-classes

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


Re: [Haskell-cafe] Byte Histogram

2011-02-06 Thread Johan Tibell
On Sun, Feb 6, 2011 at 10:12 PM, Alexey Khudyakov
alexey.sklad...@gmail.com wrote:
 Well Foldable and Traversable provide set of generic operations for
 containers. Although they are quite limited, containter must be polymorphic
 (e.g. no IntMap) and parameter must be of any type (e.g. no unboxed vectors)
 both are still quite useful.

I looked into providing instances for these but IIRC the performance
was really bad. Someone need to look at inlining/specialization for
these.

 Also there is a container-classes package which provide set of type class
 for containers.

I'd like to avoid MPTC and fundeps if possible.

Johan

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


Re: [Haskell-cafe] Byte Histogram

2011-02-06 Thread Ivan Lazar Miljenovic
On 7 February 2011 08:12, Alexey Khudyakov alexey.sklad...@gmail.com wrote:
 Also there is a container-classes package which provide set of type class
 for containers.

 [1] http://hackage.haskell.org/package/container-classes

Don't use that package: it's broken.  I did start on a re-write that
works (and there are similar libraries around that I believe do work),
but gave up because it was a) too fiddly, and b) I decided that the
use case I had for them wasn't worth it (as it would just make that
library more complicated and difficult to use, possibly also less
efficient).  If anyone wants it I can certainly send them what I've
got though.

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com

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


Re: [Haskell-cafe] Byte Histogram

2011-02-06 Thread Alexey Khudyakov

On 07.02.2011 00:37, Johan Tibell wrote:

Also there is a container-classes package which provide set of type class
for containers.


I'd like to avoid MPTC and fundeps if possible.

I think haskell2010's type system is just not expressive enough to 
create interface generic enough. It's not possible to create type class 
which will work for both ByteStrings (or IntSet) and lists.



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


Re: [Haskell-cafe] Byte Histogram

2011-02-06 Thread Richard O'Keefe

On 6/02/2011, at 4:21 AM, Andrew Coppin wrote:
 I didn't think Clean supported laziness at all? I thought it was a strict 
 language.

Absolutely not.  Back in the Good Old Days the one thing that
used to keep on tripping me up is that
Haskellif e0 then e1 else e2
 =Clean  if e0 e1 e2

Now, in what kind of language can 'if' be a perfectly ordinary function?


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


[Haskell-cafe] ANN: case-insensitive-0.1

2011-02-06 Thread Bas van Dijk
Dear all,

I had this old module laying around that I wrote some time ago. I
dusted it off and uploaded it to Hackage:

http://hackage.haskell.org/package/case-insensitive-0.1

The package provides the module Data.CaseInsensitive which exports the
CI type constructor which can be parameterised by a string-like type
like: String, ByteString, Text, etc.. Comparisons of values of the
resulting type are then insensitive to cases.

It is my hope that one day packages like snap-core[1], http-types[2]
or wai[3] all use this common way of making strings case insensitive.

Regards,

Bas

[1] 
http://hackage.haskell.org/packages/archive/snap-core/latest/doc/html/Data-CIByteString.html
[2] 
http://hackage.haskell.org/packages/archive/http-types/0.3.0/doc/html/Network-HTTP-Types.html#t:CIByteString
[3] 
http://hackage.haskell.org/packages/archive/wai/latest/doc/html/Network-Wai.html#v:CIByteString

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


[Haskell-cafe] Building doc for yesod-json

2011-02-06 Thread Magnus Therning
Michael,

I've now gotten part of the way through the *long* list of dependencies
for yesod 0.7.0, and I'm stuck on yesod-json.  It's the documentation
that fails actually, but I'm not sure why it would:

dist/build/tmp20668/Yesod/Json.hs:4:6:
parse error on input `-- ^ Convert from a JSON value'

It's the very first bit in that file:

module Yesod.Json
( -- ^ Convert from a JSON value
  defaultLayoutJson

Do you have any clue as to why this would fail?

I should probably mention that I'm compiling this on a system with GHC
6.12.3.

/M

-- 
Magnus Therning  OpenPGP: 0xAB4DFBA4
email: mag...@therning.org   jabber: mag...@therning.org
twitter: magthe   http://therning.org/magnus



signature.asc
Description: OpenPGP digital signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Building doc for yesod-json

2011-02-06 Thread Daniel Fischer
On Monday 07 February 2011 01:11:47, Magnus Therning wrote:
 Michael,

 I've now gotten part of the way through the *long* list of dependencies
 for yesod 0.7.0, and I'm stuck on yesod-json.  It's the documentation
 that fails actually, but I'm not sure why it would:

 dist/build/tmp20668/Yesod/Json.hs:4:6:
 parse error on input `-- ^ Convert from a JSON value'

 It's the very first bit in that file:

 module Yesod.Json
 ( -- ^ Convert from a JSON value
   defaultLayoutJson

 Do you have any clue as to why this would fail?

If I remember correctly, you can't have a `-- ^' comment in the export 
list, there you can only have `-- *' (multiple *s allowed) and `-- $text', 
or haddock will choke.


 I should probably mention that I'm compiling this on a system with GHC
 6.12.3.

 /M


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


Re: [Haskell-cafe] Building doc for yesod-json

2011-02-06 Thread Ivan Lazar Miljenovic
On 7 February 2011 11:11, Magnus Therning mag...@therning.org wrote:
 Michael,

 I've now gotten part of the way through the *long* list of dependencies
 for yesod 0.7.0, and I'm stuck on yesod-json.  It's the documentation
 that fails actually, but I'm not sure why it would:

 dist/build/tmp20668/Yesod/Json.hs:4:6:
    parse error on input `-- ^ Convert from a JSON value'

 It's the very first bit in that file:

 module Yesod.Json
    ( -- ^ Convert from a JSON value
      defaultLayoutJson

You want -- * for section headers: -- ^ is only used to annotate
constructors.

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com

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


Re: [Haskell-cafe] Byte Histogram

2011-02-06 Thread wren ng thornton

On 2/6/11 4:53 PM, Ivan Lazar Miljenovic wrote:

On 7 February 2011 08:12, Alexey Khudyakovalexey.sklad...@gmail.com  wrote:

Also there is a container-classes package which provide set of type class
for containers.

[1] http://hackage.haskell.org/package/container-classes


Don't use that package: it's broken.  I did start on a re-write that
works (and there are similar libraries around that I believe do work),
but gave up because it was a) too fiddly, and b) I decided that the
use case I had for them wasn't worth it (as it would just make that
library more complicated and difficult to use, possibly also less
efficient).  If anyone wants it I can certainly send them what I've
got though.


Any chance you could push a 0.0.0.1 version which tells people this, so 
that they know to avoid it?


--
Live well,
~wren

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


Re: [Haskell-cafe] Byte Histogram

2011-02-06 Thread Ivan Lazar Miljenovic
On 7 February 2011 12:30, wren ng thornton w...@freegeek.org wrote:
 On 2/6/11 4:53 PM, Ivan Lazar Miljenovic wrote:

 On 7 February 2011 08:12, Alexey Khudyakovalexey.sklad...@gmail.com
  wrote:

 Also there is a container-classes package which provide set of type class
 for containers.

 [1] http://hackage.haskell.org/package/container-classes

 Don't use that package: it's broken.  I did start on a re-write that
 works (and there are similar libraries around that I believe do work),
 but gave up because it was a) too fiddly, and b) I decided that the
 use case I had for them wasn't worth it (as it would just make that
 library more complicated and difficult to use, possibly also less
 efficient).  If anyone wants it I can certainly send them what I've
 got though.

 Any chance you could push a 0.0.0.1 version which tells people this, so that
 they know to avoid it?

Didn't think about that; I'll try to do so tonight.

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com

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


Re: [Haskell-cafe] Byte Histogram

2011-02-06 Thread Richard O'Keefe

On 7/02/2011, at 8:41 AM, Andrew Coppin wrote:

 On 06/02/2011 09:13 AM, Roel van Dijk wrote:
 
 Haskell en Clean are very much alike.
 
 From what I could determine from a basic Clean introduction, Clean is very 
 *unlike* Haskell, having a far more verbose and low-level syntax. (E.g., the 
 compiler can't even determine whether a binding is recursive or not for 
 itself. You have to say that manually.)

I have no idea what you are talking about here.
Clean is _very_ Haskell-like, including typeclasses.

Here's the first few lines of code from a Clean file I wrote in 1998.

// This is a 'data' declaration.
  :: ArrTree a
   = ArrEmpty
   | ArrLeaf a
   | ArrNode a (ArrTree a) (ArrTree a)

// The parentheses were not necessary
  empty :: (ArrTree a)
  empty = ArrEmpty

  asize :: (ArrTree a) - Int
  asize (ArrEmpty)  = 0
  asize (ArrLeaf _) = 1
  asize (ArrNode _ l r) = 1 + asize l + asize r

// In Haskell it would be Int - (ArrTree a) - Bool.
// Leaving the first arrow out means that both arguments
// must be present in each rule.
// 'if' is a function.
  known :: Int (ArrTree a) - Bool
  known i ArrEmpty= False
  known i (ArrLeaf _) = i == 1
  known i (ArrNode x l r) = i == 1 || known (i/2) (if (i mod 2 == 0) l r)

  fetch :: Int (ArrTree a) - a
  fetch i (ArrLeaf x) | i == 1 = x
  fetch i (ArrNode x l r) | i == 1 = x
  | i mod 2 == 0 = fetch (i/2) l
  | otherwise= fetch (i/2) r

As for the compiler being unable to determine whether a binding is recursive,
I cannot find any such restriction in the Clean 2.1.1 manual and don't remember
one in Clean 1.  Here's an example straight out of the manual:

primes :: [Int]
primes = sieve [2..]
  where
sieve :: [Int] - [Int]
sieve [pr:r] = [pr:sieve (filter pr r)]

filter :: Int [Int] - [Int]
filter pr [n:r]
  | n mod pr == 0 = filter pr r
  | otherwise = [n:filter pr r]

Clean uses [head : tail] where Haskell uses (head : tail).
sieve and filter are both recursive (local) bindings, and the
compiler manages just FINE.

 It seems a very unecessarily complicated and messy language - which makes the 
 name rather ironic.

It would be if true.  There _are_ complexities in Clean, just as there are in
Haskell.  For the most part, they are the same complexities (laziness, type 
classes,
type inference, generic programming).

 As I say, I thought the main difference is that Clean is strict

Wrong.

 (which is why you can get good performance). Uniqueness typing is an 
 interesting idea, that looks like it might be useful for more than mere I/O.

It has been much used for arrays and records...


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


[Haskell-cafe] coding style vs. foreign interfaces

2011-02-06 Thread Donn Cave
I just noticed a handful of spelling errors, in a package that isn't
all that obscure.  Enums from a C interface -

data AlarmingNews =
   --  ALARM_STUFF_WENT_WRONG
   AlarmStufWentWrong | ...

(oops, should have been Stuff, not Stuf.)

Who can blame the guy, after all, because this renaming work is not
only kind of a mind-numbing and trivial job, it's quite gratuitous.

Of the people who are apt to be interested, a sizeable percentage
already will be familiar with ALARM_STUFF_WENT_WRONG, and as the
nice Haskell spelling offers no practical advantage at all, it's
purely a waste of their time to translate from one to the other.
Is screenflicker_frequency() going to be screenFlickerFrequency,
or screenflickerFrequency?  gah!

I know it's enshrined in many years of convention by now, but if
anyone might ever consider the matter again, my vote would be,
when adopting foreign interfaces essentially unchanged, that the
spellings also be preserved to whatever extent practicable.

thanks!
Donn Cave

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


Re: [Haskell-cafe] Building doc for yesod-json

2011-02-06 Thread Michael Snoyman
On Mon, Feb 7, 2011 at 2:36 AM, Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com wrote:
 On 7 February 2011 11:11, Magnus Therning mag...@therning.org wrote:
 Michael,

 I've now gotten part of the way through the *long* list of dependencies
 for yesod 0.7.0, and I'm stuck on yesod-json.  It's the documentation
 that fails actually, but I'm not sure why it would:

 dist/build/tmp20668/Yesod/Json.hs:4:6:
    parse error on input `-- ^ Convert from a JSON value'

 It's the very first bit in that file:

 module Yesod.Json
    ( -- ^ Convert from a JSON value
      defaultLayoutJson

 You want -- * for section headers: -- ^ is only used to annotate
 constructors.

Of all things to mess up... ok, I've uploaded yesod-json-0.0.0.1.
Hopefully that should work.

Michael

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


Re: [Haskell-cafe] Extending GHCi

2011-02-06 Thread C K Kashyap


 $ ghci
 GHCi, version 6.12.3: http://www.haskell.org/ghc/  :? for help
 Loading package ghc-prim ... linking ... done.
 Loading package integer-gmp ... linking ... done.
 Loading package base ... linking ... done.
 Loading package ffi-1.0 ... linking ... done.
 Prelude :m +Data.IORef Control.Concurrent Control.Monad
 Prelude Data.IORef Control.Concurrent Control.Monad msg - newIORef
 Hello
 Prelude Data.IORef Control.Concurrent Control.Monad let echo =
 forever $ readIORef msg = putStrLn  threadDelay 300
 Prelude Data.IORef Control.Concurrent Control.Monad t - forkIO echo
 Hello
 Prelude Data.IORef Control.Concurrent Control.Monad Hello
 Hello
 writeIORefHello msg World
 Prelude Data.IORef Control.Concurrent Control.Monad World
 World


Thanks ... this is the possibility I was looking for. Btw, I am thinking I'd
need to use STM to synchronize right?
Regards,
Kashyap
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Extending GHCi

2011-02-06 Thread C K Kashyap



 What part of that doesn't already work? You can forkIO threads in GHCi,
 you can listen on the network. If you have written the server so it can be
 controlled from another thread, you can run those controlling functions
 at the prompt while the server is working.


 Thanks Brandon  .. I was looking for a confirmation.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Review request for platform independent interactive graphics with VNC

2011-02-06 Thread C K Kashyap

 After pulling in your changes and recompilation, your application runs
 as expected. Thanks a lot!


I look forward to some feedback on this.

Also, I am thinking in the lines of changing the image representation in a
list  to a mutable array - would that be the right approach?

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


Re: [arch-haskell] Upgrading text?

2011-02-06 Thread Magnus Therning
On 05/02/11 23:50, Magnus Therning wrote:
 Rémy  Vesa,

 I've just spent some time working out whether we can upgrade yesod in
 ArchHaskell or not.  Currently we can not, and it comes down to two
 packages:

 - dbus-core (in ArchHaskell so I won't discuss it more here)

The recently released version of dbus-core removed it as a blocker.
Now it's only text in [extra] that is holding us back.

/M

-- 
Magnus Therning  OpenPGP: 0xAB4DFBA4
email: mag...@therning.org   jabber: mag...@therning.org
twitter: magthe   http://therning.org/magnus



signature.asc
Description: OpenPGP digital signature
___
arch-haskell mailing list
arch-haskell@haskell.org
http://www.haskell.org/mailman/listinfo/arch-haskell