[Haskell-cafe] POSA

2013-10-07 Thread
Hi all,

Michael Snoyman, Andreas Voellmy and I are invited to write an article
about Warp to "The Performance of Open Source Applications":

http://aosabook.org/en/index.html

It is now open to the public including our article.

http://aosabook.org/en/posa/warp.html

Enjoy!

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


[Haskell-cafe] dns library version 1.0.0

2013-09-12 Thread
Hi all,

I have released dns library version 1.0.0.

This version provides new APIs. Thus, version is now 1.0.0. The design
and implementation was done by Michael Orlitzky based on his
experience. 

Enjoy!

--Kazu

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


Re: [Haskell-cafe] ghc-mod v3.0.0

2013-09-06 Thread
Alan,

> Is this backward compatible with older versions of Cabal? I am considering
> whether to migrate HaRe to use this, I would prefer not to have it then
> fail to work on older systems that are constrained not to be able to update
> Cabal.

The sandbox is a feature of cabal-install, not Cabal lib.

I carefully implemented this version not using Cabal 1.18.

--Kazu

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


[Haskell-cafe] ghc-mod v3.0.0

2013-09-05 Thread
Hi all,

I have just uploaded ghc-mod v3.0.0 to Hackage. In this version,
ghc-mod supports the sandbox feature of "cabal-install". Instead, it
stopped supporting "cabal-dev".

If you want to use ghc-mod v3.0.0, I would recommand to install
cabal-install 1.18. The sandbox in your package is automatically
detected by ghc-mod if exists.

--Kazu

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


Re: [Haskell-cafe] ghc-mod v2.0.1

2013-05-20 Thread
Hi,

> While we're on topic of ghc-mod, why does the emacs front-end give
> `Cannot guess type' when the point is on the very first letter of the
> function?
> 
> foo 5 = 2
> ^
> foo x = 3
> 
> Is this a feature or a bug? It does fine on the second (or any) letter
> after that point.

I think this is a spec of GHC API.

But if you want, Emacs front-end can adjust it. Please register an
issue on github if necessary.

--Kazu

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


Re: [Haskell-cafe] ghc-mod v2.0.1

2013-05-20 Thread
Hi Niklas,

> Just one note: The "emacs" link on the left is "not found".

Fixed. Thank you.

--Kazu

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


[Haskell-cafe] ghc-mod v2.0.1

2013-05-20 Thread
Hi cafe!

I have released ghc-mod v2.0.1. From this version, ghc-mod provides
the ghc-mod library in addition to the ghc-mod command:

http://hackage.haskell.org/package/ghc-mod
http://mew.org/~kazu/proj/ghc-mod/en/

Enjoy!

--Kazu

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


Re: [Haskell-cafe] ANN: psqueue-benchmarks - benchmarks of priority queue implementations

2013-04-12 Thread
Hi,

> See here:
> 
> https://github.com/nh2/psqueue-benchmarks/blob/db89731c5b4bdd2ff2ef81022a65f894036d8453/QueueBenchmark.hs#L44
> 
> If I fromList 100 entries into the queue, it stack space overflows.

Are you sure that this is a bug of GHC PSQ?

I think that "replicateM _GHC_CRASH_N" causes "Stack space overflow".

If you compile it with -rtsopts and run it +RTS -K100M, I guess you
don't see the problem.

--Kazu

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


Re: [Haskell-cafe] ANN: psqueue-benchmarks - benchmarks of priority queue implementations

2013-03-29 Thread
Hi Niklas,

> No, it does not stack overflow, and it seems to perform slightly better
> than the other implementations; it also doesn't suffer from the toList
> slowness problem as does listlike.

Thanks. It's nice.

> However, it is probably not as generally usable as it hardcodes the
> priorities to be Doubles.

I think that you can import the tips of GHC PSQ to original PSQ.

P.S.

If you need test cases, you can find some properties for Heap
(priority queue) here:

https://github.com/kazu-yamamoto/llrbtree/blob/master/test/Heap.hs

You can add some properties relating dilatation to them.

--Kazu

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


Re: [Haskell-cafe] ANN: psqueue-benchmarks - benchmarks of priority queue implementations

2013-03-28 Thread
Hi Niklas,

> * PSQueue throws a stack space overflow if you try to put in 10
> * Ints

A slightly different implementation is used in GHC:

https://github.com/ghc/packages-base/blob/master/GHC/Event/PSQ.hs

Could you test it? If this code also has the same problem, I need to
fix it.

--Kazu

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


Re: [Haskell-cafe] ghc-mod and cabal targets

2013-02-13 Thread
> Nope :).  I have one ‘ghc’, and this is my ‘ghc-pkg list’:
> .  ‘ghci -package wl-pprint’ runs just fine.

Uhhhm. Are you using sandbox?

--Kazu

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


Re: [Haskell-cafe] ghc-mod and cabal targets

2013-02-13 Thread
> Now I get another error:
> 
>Error:: cannot satisfy -package wl-pprint
> 
> even if ‘wl-pprint’ is installed, and ‘cabal configure; cabal build’ runs 
> fine.

It seems to me that you installed multiple GHCs and wl-pprint is not
installed for one of them. Is my guess corrent?

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


Re: [Haskell-cafe] ghc-mod and cabal targets

2013-02-12 Thread
Francesco,

> I can confirm that 1.11.1 works.

I think I fixed this problem.
Would you try the master branch?

https://github.com/kazu-yamamoto/ghc-mod

--Kazu

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


Re: [Haskell-cafe] ghc-mod and cabal targets

2013-02-08 Thread
> Well installing it has the big problem that each time I make a
> change to the interface I have to manually re-install, and this
> happens often since I’m in an early stage...

I'm not saying that you should install it. But I just want to know
your situation.

> Right, but this is surely doable since cabal handles the situation fine.  In
> general it seems that ghc-mod should work with cabal when it can.

Yes. This is a bug of the current ghc-mod. This behavior change was
introduced by another guy, I guess. I need to look into his code.

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


Re: [Haskell-cafe] ghc-mod and cabal targets

2013-02-08 Thread
> The ‘kant’ package is the package I’m developing and using ghc-mod on. 

Yes. I understand it.

> It includes both a library and an executable.  The executable target
> has ‘kant’ as a dependency.

What I asked is whether or not the "kant" library is installed by
cabal.

To edit a Haskell file for the "kant" executable, the current ghc-mod
needs to find the "kant" library in global or user.

I guess this bug does not exist in ghc-mod v1.11.1.

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


Re: [Haskell-cafe] ghc-mod and cabal targets

2013-02-08 Thread
Hi,

> When I have a cabal file with a library and an executable depending on the
> library (for example here
> ), ghc-mod is not 
> happy,
> complaining in every file that
> 
> Error:: cannot satisfy -package kant
>
> Where ‘kant’ is the package that the cabal file defines with the library that
> the executable needs.  Note that if I issue ‘cabal configure; cabal build’,
> everything goes smoothly.

I guess you don't install the "kant" library, right?

If so, I will think how to treat this kind problem.

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


Re: [Haskell-cafe] Why does not zipWith' exist

2013-02-01 Thread
> Right, I'm not arguing that it's impossible to produce a difference,
> but I think that if you're defining the sequence of fibs, the most
> likely scenario might be that you're actually interested in a prefix,
> and more importantly, you can still, from the outside, force the
> prefix even if you're only interested in a particular element. 

Three topics are repeatedly discussed among beginners in Japan:

1) fibs implemented with zipWith
2) simple quicksort
3) sieve of eratosthenes

Some people use 1) with "!!" and say "it's slow, why?".

Some people say 2) is not a true quicksort because it is not in-place.

Some people say 3) is not the sieve of eratosthenes at all because,
for example, 7 is divided by 5.

These three examples are mis-leading. In my opinion, if we use them,
we should

- use them as is, but describe such opinions OR
- use better implementations

I don't know translations work well but you can find such discussions
here:

http://d.hatena.ne.jp/kazu-yamamoto/20100624
http://d.hatena.ne.jp/nishiohirokazu/20100622/1277208908
http://d.hatena.ne.jp/mkotha/20100623/1277286946

--Kazu

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


Re: [Haskell-cafe] Why does not zipWith' exist

2013-02-01 Thread
Hi,

> zipWith' would [I haven't tested, but I'm rather confident] make a difference 
> if 
> you benchmarked
> 
> bench "name" (whnf (fibs !!) 10)
> 
> etc.

Yes. fibs is slow if used with "!!".

--Kazu

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


[Haskell-cafe] Why does not zipWith' exist

2013-01-31 Thread
Hello,

Many texts explain the following Fibonacci code:

fibs :: [Integer]
fibs = 0 : 1 : zipWith (+) fibs (tail fibs)

But this code is very slow because evaluation of (+) is done
lazily. If we have the following strict zipWith', the code above
becomes much faster.

zipWith' f (a:as) (b:bs) = x `seq` x : zipWith' f as bs
  where
x = f a b
zipWith' _ _ _ = []

Data.List defines foldl' against foldl. But it does not define
zipWith'. I'm curious why zipWith' does not exist in the standard
libraries.

--Kazu

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


Re: [Haskell-cafe] Up-front Unit Testing in Haskell

2013-01-20 Thread
> Where can we find it, Kazu? =)

Oops. Thank you for pointing out.
Here it is:


https://github.com/kazu-yamamoto/unit-test-example/blob/master/markdown/en/tutorial.md

--Kazu

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


[Haskell-cafe] Up-front Unit Testing in Haskell

2013-01-20 Thread
#Resending due to the lack of URL.

Hello cafe,

Just FYI:

I wrote an tutorial, "Up-front Unit Testing in Haskell". It is about
how to use doctest, hspec and Cabal.


https://github.com/kazu-yamamoto/unit-test-example/blob/master/markdown/en/tutorial.md

Enjoy!

--Kazu

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


[Haskell-cafe] Up-front Unit Testing in Haskell

2013-01-20 Thread
Hello cafe,

Just FYI:

I wrote an tutorial, "Up-front Unit Testing in Haskell". It is about
how to use doctest, hspec and Cabal.

Enjoy!

--Kazu

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


[Haskell-cafe] DIY vs as-a-Service with MemCachier

2013-01-16 Thread
Hello,

The following blog post by Joyent is worth reading:

http://joyent.com/blog/diy-vs-as-a-service-with-memcachier

"We don't really believe in Node.js (Go & Haskell are our
choices), so that is a small concern to us, but everyone has
their failings."

--Kazu

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


[Haskell-cafe] Monaris

2013-01-02 Thread
Happy new year from Japan.

A young talented guy, @fumieval, has released Monaris, a Tetoris clone based
on OpenGL. You can install it:

% cabal install Monaris

To my surprise, this game is implemented with free Monad. ;-)

Regards,

--Kazu

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


[Haskell-cafe] Haskell Advent Calendar in Japan

2012-12-12 Thread
Hello,

This is just for your information.

Haskell Advent Calendar is going on in Japanese Haskell Community: 

http://partake.in/events/45a01d39-af5e-42f1-91c7-e8fcc91db244

One article is evaluated lazily but other articles are in time. :-)

--Kazu

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


Re: [Haskell-cafe] non-uniform recursive Trie

2012-10-29 Thread
Andres,

> The code you've listed shows how to go from an already existing
> instance of class FiniteMap to an instance for the same class that
> adds a trie structure on top of the underlying finite map
> implementation. You have to add a "base instance" to the code so that
> it can work. For example, by importing Data.Map and adding an
> "instance FiniteMap Data.Map.Map Char" with the appropriate
> definitions.

Thank you.

I added the following:

instance FiniteMap Map Char where
empty = M.empty
look = M.lookup
bind = M.insert

> You'll also need to add extra type information to "empty" in your
> example expression so that GHC can know which instance you actually
> want.

Is the follwing what you mean?

> look "bar" $ bind "bar" 1 $ (empty :: Trie (Map Char) String Int)
Just 1

P.S.

FiniteMap uses another finite map, Data.Map in this case. I wonder why
we can call it bootstrapping...

--Kazu

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


[Haskell-cafe] non-uniform recursive Trie

2012-10-29 Thread
Hello cafe,

I'm now studying Trie in Okasaki's "Purely Functional Data Structure".
Attached is the program in its appendix. I cannot understand how to
use "empty", "look" and "bind". For instance, if I type 'look "" empty',
I got an error:

> look "" empty
:2:1:
No instance for (FiniteMap m0 [Char])
  arising from a use of `look'
Possible fix: add an instance declaration for (FiniteMap m0 [Char])
In the expression: look "" empty
In an equation for `it': it = look "" empty

I have no idea how to determine the parameter 'm'. Suggestions would
be appreciated.

--Kazu

{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances #-}

class FiniteMap m k where
empty :: m k v
look :: k -> m k v -> Maybe v
bind :: k -> v -> m k v -> m k v

data Trie m ks v = Trie (Maybe v) (m (Trie m ks v))

instance FiniteMap m k => FiniteMap (Trie (m k)) [k] where
empty = Trie Nothing empty

look [] (Trie b _) = b
look (k:ks) (Trie _ m) = look k m >>= look ks

bind [] x (Trie _ m) = Trie (Just x) m
bind (k:ks) x (Trie b m) = Trie b (bind k t' m)
  where
t = case look k m of
Just a  -> a
Nothing -> empty
t' = bind ks x t

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


Re: [Haskell-cafe] forkProcess, forkIO, and multithreaded runtime

2012-10-15 Thread
> My understanding is that System.Process avoids these problems by doing
> all the setup around forking a command in C code. I've banished
> forkProcess from my code base entirely, except for a double fork I need
> to daemonize, and I don't even trust that call. :/

I think you are right. forkProcess is necessary to deamonize a process
but I don't know other usage.

daemonize :: IO () -> IO ()
daemonize program = ensureDetachTerminalCanWork $ do
detachTerminal
ensureNeverAttachTerminal $ do
changeWorkingDirectory "/"
void $ setFileCreationMask 0
mapM_ closeFd [stdInput, stdOutput, stdError]
program
  where
ensureDetachTerminalCanWork p = do
void $ forkProcess p
exitSuccess
ensureNeverAttachTerminal p = do
void $ forkProcess p
exitSuccess
detachTerminal = void createSession

--Kazu


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


Re: [Haskell-cafe] forkProcess, forkIO, and multithreaded runtime

2012-10-15 Thread
Michael,

> Having looked through the code for the process package a bit, my
> initial guess is that this is being caused by a signal being sent to the child
> process, but I'm not familiar enough with the inner workings to confirm or
> disprove this guess.

To remove that comment for finally, you need the following:

_ <- installHandler sigCHLD Ignore Nothing

Put this line into the beginning of the main. And import necessary
things from System.Posix.Signals.

--Kazu

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


Re: [Haskell-cafe] simple servers

2012-09-20 Thread
Hello,

> Non-threaded RTS would block FFI to C code. But it does not block file
> descriptors and sockets because the scheduler uses select(). To my
> experience, *simple* network programming with non-threaded RTS also
> works well except the case where we reach the limit of file
> descriptors for the process.

I need to correct the last sentence. It should be "we reach the limit
of select(), 1,024 file descriptors".

--Kazu

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


Re: [Haskell-cafe] simple servers

2012-09-19 Thread
>> All system calls issued from the network package use non-blocking.
>> You don't have to worry about blocking at all.
> 
> Almost.  Especially when interfacing with C code you should include the
> "-threaded" option to GHC to link against the multi-threaded run-time
> system.  Otherwise your Haskell code will block your C code and
> vice-versa.  Also some concurrency features don't work properly in the
> single-threaded run-time.

Non-threaded RTS would block FFI to C code. But it does not block file
descriptors and sockets because the scheduler uses select(). To my
experience, *simple* network programming with non-threaded RTS also
works well except the case where we reach the limit of file
descriptors for the process.

Anyway, I recommend to specify the "-threaded" option to GHC for
network programming if you don't have special reasons.

--Kazu

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


Re: [Haskell-cafe] simple servers

2012-09-19 Thread
Hi,

> Is it true that writing a simple server using forkIO now integrates
> native event loops implicitly? 

Yes.

IO manager handles event driven stuff. Thanks to this, we can enjoy
(light) thread programming using forkIO.

> One last question. When writing C code, using epoll apis explicitly
> can impose some blocking. Is the same to be said for GHC.Event?

I don't understand your question.

All system calls issued from the network package use non-blocking.
You don't have to worry about blocking at all.

P.S.

This article would help:

http://www.iij.ad.jp/en/company/development/tech/mighttpd/

--Kazu

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


[Haskell-cafe] The Architecture of the Mighttpd High-Speed Web Server

2012-09-10 Thread
Hello from Copenhagen,

In last may, I wrote an article about Mighttpd in Japanese because a
PR staff of IIJ asked me to do so. Since this article got popular in
Japan, the PR staff decided to translate it into English. The English
version is now open to the public:

http://www.iij.ad.jp/en/company/development/tech/mighttpd/

# Mighttpd is based on Yesod's Warp but I did touch it to make the
# article simple.

I guess that we can use this article to explain why Haskell is suitable
for network programming to other programming language communities.

FYI, the original Japanese article can be found:

http://www.iij.ad.jp/company/development/tech/activities/mighttpd/

Regards,

--Kazu

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


[Haskell-cafe] MIN_VERSION_base

2012-08-09 Thread
Hello,

The stable branch of the network library includes the following code:

#if !(MIN_VERSION_base(4,6,0))

I cannot compile the stable branch with HP 2011.4.0.0 on Linux 2:

Preprocessing library network-2.3.0.14...
BSD.hsc:115:23: error: missing binary operator before token "("
BSD.hsc:115:23: error: missing binary operator before token "("
BSD.hsc:115:23: error: missing binary operator before token "("
compiling dist/build/Network/BSDhsc_make.c failed (exit code 1)
command was: /usr/bin/gcc -c dist/build/Network/BSD_hsc_make.c -o 
dist/build/Network/BSD_hsc_make.o -fno-stack-protector -fno-stack-protector 
-DGLASGOW_HASKELL_=700 -Dlinux_BUILD_OS -Dlinux_HOST_OS -Di386_BUILD_ARCH 
-Di386_HOST_ARCH -Iinclude -DCALLCONV=ccall 
-I/ghc7.0.4/lib/ghc-7.0.4/unix-2.4.2.0/include 
-I/ghc7.0.4/lib/ghc-7.0.4/bytestring-0.9.1.10/include 
-I/ghc7.0.4/lib/ghc-7.0.4/base-4.3.1.0/include 
-I/ghc7.0.4/lib/ghc-7.0.4/include -I/ghc7.0.4/lib/ghc-7.0.4/include 
-I/ghc7.0.4/lib/ghc-7.0.4/include/

"dist/build/autogen/cabal_macros.h" defines MIN_VERSION_base but
"dist/build/Network/BSD_hsc_make.c" does not include it.

If you guys know why this happens, please let me know.

For more information, please refer to:
https://github.com/haskell/network/issues/43

--Kazu

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


Re: [Haskell-cafe] haskell.org is so fragile

2012-07-12 Thread
Hello,

> The issue is unfortunately more to do with sysadmin resources than
> server hardware; there's noone with the time to actively manage the
> server and make sure that it's running well. Any ideas for improving the
> situation would be gratefully received.

I don't know about the current architecture of Hackage. But what about
this: the main server concentrates on registration/uploading and
mirrors serve queries/downloading.

Yesterday some Japanese Haskellers used a mirror server:
http://hackage.haskell.biz/

--Kazu



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


Re: [Haskell-cafe] how to check thunk

2012-07-01 Thread
Hello,

> vacuum allow that and much more though I don't know if it still works
> correctly on GHC 7.4. Anyway your isThunk is
> 
>> isThunk a = fmap GHC.Vacuum.ClosureType.isThunk GHC.Vacuum.closureType

Great. I confirmed that this works with GHC 7.4.
# I removed the "a" parameter.

Thank you very much!

--Kazu

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


[Haskell-cafe] how to check thunk

2012-07-01 Thread
Hello,

Are there any ways to see if a value is a thunk or memorized?
I would like to have a function like:
  isThunk :: a -> IO Bool

I'm implementing some data structures described in "Purely Functional
Data Structures" and want to check my implementation is correct.
E.g.

https://gist.github.com/2987425

Thanks.

--Kazu

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


[Haskell-cafe] RawFilePath vs System.FilePath

2012-06-13 Thread
Hello,

After releaseing new Haskell Platform, many people can now use
RawFilePath (e.g. ByteString) for System.*. However, there is no
System.FilePath.ByteString which manipulates RawFilePath.

How do you guys manipulate RawFilePath as file path?
Is there a plan to implement System.FilePath.ByteString?

# I know the system-filepath package. But I would like to know
# answers to the questions above.

Regards,

--Kazu

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


[Haskell-cafe] Two parallel libraries from Japan

2012-06-07 Thread
Hello cafe,

I would like to announce two parallel libraries from Japan.

- Paraiso (http://hackage.haskell.org/package/Paraiso)

The purpose of this library is to design a high-level language for
implementing explicit partial-differential equations solvers on
supercomputers as well as today's advanced personal computers.

Muranushi-san is also known as the author of Monadius and one of
the two translators of "Learn you".

- GTALib (http://hackage.haskell.org/package/GTALib)

This package provides the core functionalities of the GTA
(Generate, Test, and Aggregate) programming framework on Haskell
See "Test, and Aggregate - A Calculation-based Framework for
Systematic Parallel Programming with MapReduce" for more
information.

Regards,

--Kazu

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


[Haskell-cafe] Haskell Day 2012 (in Japan)

2012-05-22 Thread
Hello Cafe,

This is just FYI.

We Hasekell community in Japan will have an event called Haskell Day
2012 on 27th May to cerebrate the publication of the Japanese version
of "Learn you". 180+ people have already registered:

# This page is written in Japanese.

http://partake.in/events/ab7f77b4-7541-47a4-867d-21a096ca883c

P.S.

The Japanese version of "Learn you" was on sale yesterday and already
sold out in many bookstores. :-)

--Kazu

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


[Haskell-cafe] Mighttpd 2.6.0 has been released

2012-05-20 Thread
Hello cafe,

I have released Mighttpd 2.6.0:

http://mew.org/~kazu/proj/mighttpd/en/

Some users started using Mighttpd 2 and I was requested to implement
missing features for real world operation. So, I implemented the
following features in Mighttpd 2.6.0:

- Route file reloading
- Graceful shutdown for upgrading
- URL rewriting (with HTTP redirection)

For more information, please read the homepage above.

I would like to thank Michael Snoyman for merging the necessary patch
to warp.

Regards,

--Kazu

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


Re: [Haskell-cafe] Learn you

2012-05-05 Thread
Hello,

> Could you please answer my concerns about the license under which LYAH
> is distributed? (see my initial reply to the thread)
> Additionally, under what license is your translation work re-distributed?

What I know is:

- The Japanese publisher bought the translation license from the
  publisher of the original.
- The original author knows this.
- Translation is based on the original published book, not on the
  online version. They are different because editors modified much.
- I don't think the Japanese publisher open the translated book
  on line.

P.S.

I'm not a translater of this book. I'm the translator of "Programming
in Haskell". :-)

--Kazu

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


Re: [Haskell-cafe] Learn you

2012-05-03 Thread
Hello,

> I think the Japanese title is in a similar spirit as the original one.
> Breaking it down:
> 
> Sugoi Haskell tanoshiku manabou!
> 
> sugoi - "awesome" (rather colloquial)
> tanoshiku - "while having fun"
> manabou - "let's learn"

Yes, exactly.

"Sugoi" is a frank word which we cannot use in thesis.

> In formal grammar it should be "Sugoi Haskell tanoshiku WO manabou!" -
> this WO is a particle identifying the object and this omission is
> normal in colloquial, spoken Japanese.

"Sugoi Haskell tanoshiku manabou!" is perfect Japanese. If we want to
add "WO", it should be "Sugoi Haskell WO tanoshiku manabou!".  This
is good Japanese for writing but I think many Japanese including me
speak without "WO".

> How does the Japanese title sound to native speakers? I'm curious myself :)

It sounds cute as if a little boy or girl is speaking. If we add "WO",
it breaks the good rhythm.

The translators and me knew the original title is not proper English. 
So, we decided to translate it freely while maintaining its tone.

P.S.

The translated book is No 1 sale in technical books on Amazon in Japan
in this week. :-)

--Kazu

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


Re: [Haskell-cafe] twitter election on favorite programming language

2012-05-02 Thread
Hello Leon,

> Out of curiousity,  was this a plurality election (vote for one),  or an
> approval election (vote for many)?

Vote for one.

This application requires "twitter login".

--Kazu

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


[Haskell-cafe] Learn you

2012-05-02 Thread
Hello cafe,

Translating "Learn You a Haskell for Great Good" into Japanese was
finished and will be published on 22 May. I guess it's worth watching
its cover page:


http://www.amazon.co.jp/%E3%81%99%E3%81%94%E3%81%84Haskell%E3%81%9F%E3%81%AE%E3%81%97%E3%81%8F%E5%AD%A6%E3%81%BC%E3%81%86-Miran-Lipova%C4%8Da/dp/4274068854

There are two translators: Tanaka is the author of "peggy" and Muranushi is
the author of "Monadius".

Regards,

--Kazu

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


[Haskell-cafe] twitter election on favorite programming language

2012-04-30 Thread
Hello,

A twitter election on favorite programming language was held in Japan
and it appeared that Heskell is No. 10 loved language in Japan. :-)

http://twisen.com/election/index/654

Regards,

--Kazu

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


[Haskell-cafe] ghc-mod: Expanding Template Haskell

2012-02-26 Thread
Hello,

I have released ghc-mod v1.10.10. With this version, you can
expnad Template Haskell by using C-cC-e on Emacs.

http://mew.org/~kazu/proj/ghc-mod/en/

Enjoy!

--Kazu

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


Re: [Haskell-cafe] Data.IntMap union complexity

2012-02-23 Thread
Hello,

> Looking at IntMap's left-biased 'union' function [1], I noticed that the
> complexity is O(n+m) where n is the size of the left map, and m is the size of
> the right map.
> 
> Since insertion [2] is O(min(n, W)) [ where W is the number of bits in an Int
> ], wouldn't it be more efficient to just fold 'insert' over one of the lists
> for a complexity of O(m*min(n, W))? This would degrade into O(m) in the worst
> case, as opposed to the current O(n+m).

Interesting.

I would point out that the original paper "Fast Mergeable Integer
Maps" says that merge is O(n+m). 

I don't know which one is correct.

--Kazu

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


Re: [Haskell-cafe] Test suite sections of cabal

2012-02-19 Thread
Hello Felipe,

> If we have separate directories, then you can "build-depends:
> own-package".  This means that on the test suite's build-depends you
> need to list only the dependencies that the test-suite needs, not
> every dependency.  Also, you don't need to constrain the version of
> any duplicated dependency.

This worked well. Thank you very much!

--Kazu

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


Re: [Haskell-cafe] Test suite sections of cabal

2012-02-16 Thread
>> 2) build-dependency
>>
>>  I need to repeat all build-dependency of a library section to
>>  a test suite section. Specifying the library itself to
>>  build-dependency of a test suite section does not work.
>>  This violates the DRY philosophy.
> 
> You may specify the same library as a dependency given that you use
> different "hs-source-dirs".  For example, see skein's Cabal file [1].
> Of course, you won't be able to directly test any internal function.

Do you mean that if we separate directories for src and test,
build-depends of test-suite works, and if we don't separate, it does
not work?

--Kazu

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


[Haskell-cafe] Vim plugin for ghc-mod

2012-02-16 Thread
Hello,

eagletmt implemented a Vim plugin for ghc-mod:

https://github.com/eagletmt/ghcmod-vim

Happy Haskell programming on Vim!

--Kazu

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


[Haskell-cafe] Test suite sections of cabal

2012-02-15 Thread
Hello,

I recently started using test suite sections of cabal but it soon
appeared very inconvenient to me.

1) test data files

  If I want to include test data files into package, I have to
  enumerate all test files since the usage of '*' is restricted.
  I just want to specify the top directory of test data files.

  Why does this restriction exist?

2) build-dependency

  I need to repeat all build-dependency of a library section to
  a test suite section. Specifying the library itself to 
  build-dependency of a test suite section does not work.
  This violates the DRY philosophy.

  Any ideas to avoid this?

Thanks.

--Kazu

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


[Haskell-cafe] ghc-mod v1.10.3

2012-02-12 Thread
Hello,

I have just released ghc-mod v1.10.3. C-cC-t of this version was
powered by Hideyuki Tanaka. 

The old implementation just show the type of the current expression on
Emacs. Howver, the new implementation first show the type of the
current expression and the expression is highlighted. If you type
C-cC-t again, the region is enlarged to its upper expression, and its
type is displayed.

# I don't know well but this is called "annot" in the OCaml community

Enjoy!

--Kazu

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


Re: [Haskell-cafe] proper way to generate a random data in criterion

2011-10-19 Thread
Greg,

> The code looks ok to me -- you've deepseq'ed the list, and forcing it
> to whnf should force the deepseq. Also, criterion runs your benchmark
> many times, if your code was measuring the RNG time it would only
> happen once. This would show up in the criterion output as an
> unusually large outlier.

Thank you for your review. 

Because my benchmark seems OK, I need to think why the algorithm works
slower against random data. :)

--Kazu

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


[Haskell-cafe] proper way to generate a random data in criterion

2011-10-19 Thread
Hello,

I'm measuring performance of the insertion operation of red-black
trees. For input, three kinds of [Int] are prepared: the increasing
the order, decreasing order, and random.

The random case is 4 or 5 times slower than the others. I'm afraid
that my program also measured the cost of random Int generation.

My benchmark code can be found:


https://github.com/kazu-yamamoto/llrbtree/blob/master/bench/insert/Bench.hs

Does anyone kindly take a look and tell me whether or not my criterion
code measures the cost of random Int generation? If so, would you
suggest how to avoid it?

Background infromation can be found:
Purely Functional Left-Leaning Red-Black Trees
http://www.mew.org/~kazu/proj/red-black-tree/

--Kazu

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


Re: [Haskell-cafe] Binding a socket to all interfaces

2011-09-28 Thread
Hello,

Sorry for the delay but I made a patch and sent a pull request:

https://github.com/haskell/network/pull/18

After consideration, I realized that Johan's opinion is better.
Please read the comment of this request above.

When the next network package will be released, this problem will
disappear, I hope. We don't have to change Warp at all.

--Kazu

> Hi,
> 
>> We should consider how we fix this. Right now N.S.listen just wraps the
>> underlying system call. Is that the right place to set socket options? 
>> Perhaps
>> we should set them when creating the socket instead?
> 
> Yes, of course.
> 
> If I remember correctly, this option works only between socket() and
> listen(). I need to check that this option is effective to all sockets
> or only to listing sockets. Anyway, I will try this in the next week.
> 
> I used to be an expert of IPv6 but I forget many things recently...
> I should remember.
> 
> --Kazu
> 
> ___
> 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] Binding a socket to all interfaces

2011-09-21 Thread
Hi,

> We should consider how we fix this. Right now N.S.listen just wraps the
> underlying system call. Is that the right place to set socket options? Perhaps
> we should set them when creating the socket instead?

Yes, of course.

If I remember correctly, this option works only between socket() and
listen(). I need to check that this option is effective to all sockets
or only to listing sockets. Anyway, I will try this in the next week.

I used to be an expert of IPv6 but I forget many things recently...
I should remember.

--Kazu

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


Re: [Haskell-cafe] Binding a socket to all interfaces

2011-09-21 Thread
Hello,

My fix intended that Haskell code behaves the same in various
environments. That is, one socket catches both IPv4 and IPv6. And the
fix works even in both IPv4-only env and IPv6-only env.

Johan's observation is correct. Network.listenOn is alreay fixed but
Network.Socket.listen, which Warp relies on, is not fixed yet. I will
try to fix it. When the next version of the network library will be
released, the problem will disappear, I hope.

--Kazu

> Hi Michael,
> 
> Kazu recently fixed this (in the stable branch on GitHub) in Network.listenOn
> but perhaps the more basic Network.Socket.listen should also be changed. Lets
> discuss what's the right thing to do in this thread.
> 
> On Wed, Sep 21, 2011 at 1:38 PM, Michael Snoyman  wrote:
> 
>> Hi,
>> 
>> One of the recurring issues that comes up in Warp is binding to IPv4
>> versus IPv6 hosts. Our current code is available at [1]. It was
>> updated to look like that in this commit [2] in order to support both
>> IPv4 and IPv6 hosts by default. However, now it seems than on Debian
>> and FreeBSD, it *only* responds to IPv6 by default[3][4]. I'm frankly
>> stumped at this point on how to have our cake and eat it too.
>> 
>> Does anyone have an idea of the correct incantation to get Warp to do
>> the Right Thing(tm) here? And if not, is there any advice on sensible
>> default behavior? I'm considering allowing a few special host values:
>> 
>> * "*" (default, what we have now): Make this bind to IPv4
>> * "ipv4": Again, bind to IPv4. Guaranteed not to change in the future
>> * "ipv6": Bind to IPv6.
>> 
>> Michael
>> 
>> [1] https://github.com/yesodweb/wai/blob/master/warp/Network/Wai/Handler/
> Warp.hs#L119
>> [2] https://github.com/snoyberg/warp/commit/
> 02c1396c86e3fceb48cbe7df58cb631c804e24d4
>> [3] https://github.com/snoyberg/warp/issues/9
>> [4] http://stackoverflow.com/questions/7486257/
> yesod-devel-server-only-listening-on-ipv6
>> 
>> ___
>> 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] Typhoon

2011-09-20 Thread
Hello,

To those who are in Tokyo for ICFP:

The typhoon is likely to come after 16:00 today. Many students and
workers will go home earlier this afternoon. It's Japanse style.

If typhoon comes, umbrella does not work. Please stay in your
building. You should understand all traffic transportation will stop.
Even blackout would happen. Please please don't underestimate the
typhoon.

Typhoon info:
http://www.jma.go.jp/en/typh/
http://weathernews.jp/satellite/

Rain visual info:
http://tokyo-ame.jwa.or.jp/en/index.html


Please don't panic. Stay in your building for about two hours. Enjoy
slow life.

--Kazu

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


Re: [Haskell-cafe] efficient chop

2011-09-14 Thread
You can find the results of my friend:

https://gist.github.com/1215660

Please ignore the Japanese text. Please read the code and the results.
I'm not sure why you had the different result.

--Kazu

> This was exactly my first attempt on rewriting your foldr version.
> 
> Unfortunately, it doesn't seem faster at all (foldr2 below).
> The test input was replicate 100 'a' ++ replicate 100 ' '.
> GHC 7, -O2.
> 
> benchmarking all/foldr
> mean: 2.808462 us, lb 2.807047 us, ub 2.810520 us, ci 0.950
> std dev: 8.620822 ns, lb 6.535738 ns, ub 11.59552 ns, ci 0.950
> 
> benchmarking all/reverse
> mean: 4.128217 us, lb 4.125409 us, ub 4.134086 us, ci 0.950
> std dev: 20.07591 ns, lb 11.47572 ns, ub 38.33738 ns, ci 0.950
> 
> benchmarking all/foldr2
> mean: 6.701714 us, lb 6.692093 us, ub 6.711627 us, ci 0.950
> std dev: 50.06638 ns, lb 42.25004 ns, ub 64.84223 ns, ci 0.950
> 
> 
> -- 
> Roman I. Cheplyaka :: http://ro-che.info/

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


Re: [Haskell-cafe] efficient chop

2011-09-14 Thread
Hello,

My friend reached the following version:

chop :: String -> String
chop = foldr go []
  where
go x xs
  | isSpace x && null xs = []
  | otherwise= x:xs

This version is faster than the reverse version in most cases.  The
point is checking "isSpace" first and falling into "otherwise" in many
cases, which is a natural co-recursion.

Thanks anyway.

--Kazu

>> Hello,
>> 
>> Of course, I use ByteString or Text for real programming. But I would
>> like to know whether or not there are any efficient methods to remove
>> a tail part of a list.
>> 
>> --Kazu
> 
> In that case, I would prefer this version, since it is lazier:
> 
> lazyChop :: String -> String
> lazyChop s = pref ++ if null s' then [] else (mid_sp ++ lazyChop s')
>   where
> (pref,sp_suf) = break isSpace s
> (mid_sp,s')   = span isSpace sp_suf
> 
> By "lazier" I mean:
> 
> *Main> chopReverse $ "hello world " ++ undefined
> "*** Exception: Prelude.undefined
> *Main> chopFoldr $ "hello world " ++ undefined
> "*** Exception: Prelude.undefined
> *Main> lazyChop $ "hello world " ++ undefined
> "hello world*** Exception: Prelude.undefined
> 
> Daniel

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


Re: [Haskell-cafe] efficient chop

2011-09-13 Thread
Hello,

Of course, I use ByteString or Text for real programming. But I would
like to know whether or not there are any efficient methods to remove
a tail part of a list.

--Kazu

From: Thomas DuBuisson 
Subject: Re: [Haskell-cafe] efficient chop

> This was a recent question on StackOverflow:
> 
> http://stackoverflow.com/questions/6270324/in-haskell-how-do-you-trim-whitespace-from-the-beginning-and-end-of-a-string/6270382#6270382
> 
> Where I started:
> 
> If you have serious text processing needs then use the text package
> from hackage.
> 
> And concluded:
> 
> A quick Criterion benchmark tells me that (for a particularly long
> string of words with spaces and ~200 pre and post spaces) my trim
> takes 1.6 ms, the trim using reverse takes 3.5ms, and Data.Text.strip
> takes 0.0016 ms.
> 
> Cheers,
> Thomas
> 
> On Tue, Sep 13, 2011 at 8:03 PM, Kazu Yamamoto  wrote:
>> Hello Cafe,
>>
>> I would like to have an efficient implementation of the chop function.
>> As you guess, the chop function drops spaces in the tail of a list.
>>
>>   chop " foo  bar baz   "
>>   ->   " foo  bar baz"
>>
>> A naive implementation is as follows:
>>
>>    chopReverse :: String -> String
>>    chopReverse = reverse . dropWhile isSpace . reverse
>>
>> But this is not elegant. foldr version is as follows:
>>
>>    chopFoldr :: String -> String
>>    chopFoldr = foldr f []
>>      where
>>        f c []
>>          | isSpace c = []
>>          | otherwise = c:[]
>>        f c cs = c:cs
>>
>> But this code is slower than chopReverse in some cases.
>>
>> Are there any more efficient implementations of chop? Any suggestions?
>>
>> --Kazu
>>
>> ___
>> 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] efficient chop

2011-09-13 Thread
Hello Cafe,

I would like to have an efficient implementation of the chop function.
As you guess, the chop function drops spaces in the tail of a list.

   chop " foo  bar baz   "
   ->   " foo  bar baz"

A naive implementation is as follows:

chopReverse :: String -> String
chopReverse = reverse . dropWhile isSpace . reverse

But this is not elegant. foldr version is as follows:

chopFoldr :: String -> String
chopFoldr = foldr f []
  where
f c []
  | isSpace c = []
  | otherwise = c:[]
f c cs = c:cs

But this code is slower than chopReverse in some cases.

Are there any more efficient implementations of chop? Any suggestions?

--Kazu

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


[Haskell-cafe] how to change a process name

2011-07-06 Thread
Hello,

I would like to know how to change a process name in Haskell. When we
are programming in C, we can change it by overriding argv on Unix.
But I cannot find the same way to do in Haskell. Can anyone suggest
how in Haskell? I'm not talking about the result of
System.Environment.getProgName but talking about the process name
which we can see by the "ps" command.

Thanks.

--Kazu

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


[Haskell-cafe] A paper relating to Data.Set and Data.Map

2011-04-18 Thread
Hello libraries and cafe,

We (Hirai and I) would like to tell you our paper relating to
Data.Set and Data.Map. "Balancing Weight-Balanced Trees" is now
accepted and will appear in Journal of Functional Programming.
The camera-ready version of the paper is available from:

http://www.mew.org/~kazu/proj/weight-balanced-tree/

Please recall that Taylor Campbell reported a bug of Data.Map in last
Summer. In some cases, the balance of Data.Map is broken after delete
operations. This triggered our research.

http://article.gmane.org/gmane.comp.lang.haskell.libraries/13444

Though Data.Set/Data.Map are based of a variant Weight-Balanced tree
by Adams, we target the original Weight-Balanced tree by Nievergelt
and Reingold. They are parameterized algorithms and the difference of
two algorithms is quite small. But the original has smaller conditions
which are gentle for proof.

We identified the valid area of two parameters of the original
Weight-Balanced tree and showed <3,2> is only one integer solution.
Soundness is proved in Coq and completeness is verified with four
algorithms to generate counterexamples for the outside of the valid
area.

"wttree.scm" of MIT/GNU Scheme and slib have already incorporated our
fixes. When I offered our fixes to MIT/GNU Scheme, Taylor Campbell
appeared again. I understand that he is an MIT/GNU Scheme guy and
found the bug of Data.Map when re-implementing "wttree.scm" consulting
Data.Map. :-)

We think it's Haskell community turn now. Data.Set/Data.Map are still
based on the variant whose soundness is not proved yet. If interested,
let's discuss whether or not we should replace the variant with the
original in Data.Set/Data.Map.

We guess that Milan Straka, a big contributer of the container
package, has his opinion. We welcome opinions from other people, two.

Regards,

--Kazu

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


Re: [Haskell-cafe] Request for library recommendations

2011-04-12 Thread
Erik,

> I have done stuff like this before in C++ and Ocaml, so the mechanics
> are not a mystery. However I would like as much as possible to make
> use of existing Haskell libraries to cut down the development time.

I recommend wai and warp which are available on Hackage. I asked
Michael, the author of the libraries, to handle absolute URLs in
warp. So, you can use it as a platform for HTTP proxies even for
HTTP/1.0.

--Kazu

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


Re: [Haskell-cafe] already installed packages alerted as not being installed

2011-04-11 Thread
Hello,

> thanks I wanted to mention that the "unknown symbol" error is very
> likely not related to the cab tool as the same error appears, when
> using the cabal - tool. I guess we can ignore it even in the context
> of my main question, sorry for being to verbose. What I found more
> interesting is, that cab doesn't try to re-install an installed
> package - already in the database too, as ghc-pkg output pretends -
> which is expected behaviour. The cabal system frontend obviously does
> trying to reinstall the package though. This seems like different
> model of reality...

This is not true.

cab install re-installs some packages if necessary, unfortunately.
That's why I recommend to use "cab install -n".

--Kazu

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


Re: [Haskell-cafe] already installed packages alerted as not being installed

2011-04-11 Thread
Hello,

> When I install cabal-dev and cab first and then re-install everything
> with cab instead of cabal the issue with re-installing already
> installed packages described above disappears and only an "unknown
> symbol" message related to the correctly found installed cairo package
> remains. So is there an error in package database handling somewhere
> or changed semantics in cabal | ghc-pkg | (even) pkg-config flags I
> missed?

"cab" is just a wrapper for "cabal" and "cabal-dev" for installation.
So, I have no idea about what's going on.

Please try "cab install  -n" to see what will happen before
typing "cab install ". If you find the word "reinstall", you
should not install the package because the installation operation will
break your package environment.

You can analyze package dependency with:
cab deps  -r
cab revdeps  -r
cab list -r

Adding the "-a" option displays global packages also.

I recommend to use a sandbox when you try to resolve a dependency
problem.

--Kazu

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


Re: [Haskell-cafe] Is there a way to find out the type inferred for a local function inside another function? :)

2011-04-08 Thread
I made a mistake. Use M-t instead of C-cC-t.

>> Currently what I do is declare a signature for helper, and then if it
>> gets a type error try to figure out how to fix it.  It's usually not
>> very hard, but it would be slick to have the signature filled in
>> automatically.
> 
> Try ghc-mod on Hackage if you are an Emacs user.
> 
> If GHC can guess the signature of helper function, haskell-mode with
> ghc-mod automatically hilights the function. Typing C-cC-t inserts the
> guessed signature.
> 
>   http://www.mew.org/~kazu/proj/ghc-mod/en/
> 
> --Kazu

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


Re: [Haskell-cafe] Is there a way to find out the type inferred for a local function inside another function? :)

2011-04-08 Thread
> Currently what I do is declare a signature for helper, and then if it
> gets a type error try to figure out how to fix it.  It's usually not
> very hard, but it would be slick to have the signature filled in
> automatically.

Try ghc-mod on Hackage if you are an Emacs user.

If GHC can guess the signature of helper function, haskell-mode with
ghc-mod automatically hilights the function. Typing C-cC-t inserts the
guessed signature.

http://www.mew.org/~kazu/proj/ghc-mod/en/

--Kazu

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


[Haskell-cafe] cab 0.1.2

2011-04-07 Thread
Hello cafe,

Let me announce "cab version 0.1.2". This version integrates
"cabal-dev" as well as "cabal/ghc-pkg". So, you can use a sandbox for
your development.

http://www.mew.org/~kazu/proj/cab/en/

Here is the short explanation from the page above:


"cab" is a MacPorts-like maintenance command of Haskell cabal
packages. Some parts of this program are a wrapper to "ghc-pkg",
"cabal", and "cabal-dev".

If you are always confused due to inconsistency of "ghc-pkg" and
"cabal", or if you want a way to check all outdated packages, or if
you want a way to remove outdated packages recursively, this command
helps you.

"cab" is designed to maintain user packages only assuming that users
use a Haskell Platform and don't want to touch the global packages.


--Kazu

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


Re: [Haskell-cafe] A maintenance command of Haskell cabal packages

2011-04-01 Thread
> My workaround was to create a link:
> ln -s ~/Library/Haskell/repo-cache ~/.cabal/packages

I have already done it. :)

--Kazu


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


Re: [Haskell-cafe] A maintenance command of Haskell cabal packages

2011-03-31 Thread
Hello,

>>> cabal-dev is a wrapper around cabal. It creates the directory
>>> "cabal-dev" in your current directory when you run commands.
>>
>> Yes, I know. But when I typed "cabal-devel install" on a package
>> directory, nothing happened.
> 
> Can you give a specific example? Surely *something* happened :)

I guess this happens with Haskell Platform for MacOS only. In this
environment, .cabal/config specifies as follows:

remote-repo-cache: /Users//Library/Haskell/repo-cache

But cabal-dev refers to /Users//.cabal/packages. After
"cabal-dev update" to create it, everything becomes fine to me.

Thank you.

--Kazu

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


Re: [Haskell-cafe] A maintenance command of Haskell cabal packages

2011-03-31 Thread
Hello,

> Have you read this?
> http://www.reddit.com/r/haskell/related/f3ykj/
> psa_use_cabaldev_to_solve_dependency_problems/

I did know this page. I will read it later. Thank you.

> cabal-dev is a wrapper around cabal. It creates the directory
> "cabal-dev" in your current directory when you run commands.

Yes, I know. But when I typed "cabal-devel install" on a package
directory, nothing happened.

> If you understand how to use 'cabal' then 'cabal-dev' should be
> pretty easy to figure out. Do you have any specific questions?

I read its source but I could not found the code where cabal-dev
passes GHC_PACKAGE_PATH to ghc. I don't know how cabal-dev can
implement the sandbox featrue.

--Kazu

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


Re: [Haskell-cafe] A maintenance command of Haskell cabal packages

2011-03-31 Thread
> whoah, it has uninstall!!! awesome!

It just unregisters libraries not delete them actually. But I guess it
is enough for you.

The "cabal-delete" command does delete libraries and I'm planning to
integrate "cab" and "cabal-delete". But the author of "cabal-delete"
is now suffering from the Tsunami in Japan. I'm just waiting for
his recovery.

I want to integrate "cab" and "cabal-dev" also. But I cannot
understand how to use "cabal-dev" at this momemnt...

--Kazu

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


[Haskell-cafe] A maintenance command of Haskell cabal packages

2011-03-31 Thread
Hello cafe,

Let me announce a maintenance command of Haskell cabal packages.

http://www.mew.org/~kazu/proj/cab/en/


"cab" is a MacPorts-like maintenance command of Haskell cabal
packages. Some part of this program is a wrapper to "ghc-pkg" and
"cabal".

If you are always confused due to inconsistency of two commands, or if
you want a way to check all outdated packages, or if you want a way to
remove outdated packages recursively, this command helps you.


I'm a user of Yesod. Yesod consists of many packages and they are
being updated very quickly. So, I need this command.

Regards,

--Kazu

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


Re: [Haskell-cafe] ANNOUNCE: enumerator 0.4.8

2011-03-29 Thread
Hello,

>> (=$) :: Monad m => Enumeratee ao ai m b -> Iteratee ai m b -> Iteratee ao m
>> b
>> enum =$ iter = joinI (enum $$ iter)
>>
>> ($=) :: Monad m => Enumerator ao m (Step ai m b) -> Enumeratee ao ai m b ->
>> Enumerator ai m b
>> ($=) = joinE
>> --
> 
> The operators sound good to me. My only request would be to put in a
> usage example in the documentation. I'd be happy to write one if you'd
> like. Personally, I think that =$ will *greatly* clean up my code.

I have a tutorial to describe how to use the enumerator library in
Japanese. Since it is popular among the Haskell community in Japan, I
guess it's worth translating into English. So, I did.

http://www.mew.org/~kazu/proj/enumerator/

This tutorial explains how to use (=$) and ($=) as well as other
operators(($$), (<==<), (>>=)).

Of course, my English is broken. If English native speakers will
kindly correct broken grammar, it would be appreciated.

I'm reachable by e-mail or twitter (@kazu_yamamoto).

--Kazu

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


Re: [Haskell-cafe] Abstracted File Library?

2010-04-26 Thread
Hello,

> Clarify this, please. Used by who?

It is by System.FilePath.
 Windows: combine "home" "bob" == "home\\bob"

> Both Cabal and filepath libraries do have functions operating on
> filepath strings. Eg filepath can split them.

I'm want to use regular expressions for results of 'combine', for
instance.

>> Are there any abstracted file library to solve these problems?
>> Or should I start to write such a library?
> 
> Which functions should this library have?

isSymbolicLink, linkCounts, etc.

> I'm pretty sure that filepath already has most functions you need.

Not really at least to me.

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


[Haskell-cafe] Abstracted File Library?

2010-04-26 Thread
Hello,

I'm implementing a command which manipulates files both on Unix/Mac
and Windows. I was very surprised because there is not
"getStatusChangeTime" function. So, I wrote it with CPP.

http://github.com/kazu-yamamoto/Mew/blob/master/bin/hs/Stat.hs

Another problem is that since '\\' is used as the file separator of
Windows, I cannot use regular expression naturally for file path. In
many programming languages, '/' is only file separator for
programmers. And my friend, who is an expert of Windows API, says to me
that Windows API allows '/' as a file separator. Why don't we
use '/' on Windows, too?

Are there any abstracted file library to solve these problems?
Or should I start to write such a library?

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