Re[2]: [Haskell-cafe] Lazy lists simulated by unboxed mutable arrays

2008-05-29 Thread Henning Thielemann


On Thu, 29 May 2008, Bulat Ziganshin wrote:


Hello Andrew,

Wednesday, May 28, 2008, 10:37:47 PM, you wrote:

looks like lazy.bytestring generalized to any a

That sounds like a darn useful thing to have...


well, support on only Word8 as base type isn't some fundamental limit,
just creators of bytestring package was not very interested in support
of other base types


Just in order to remind you, ByteString for any Storable types does 
already exist:

  http://hackage.haskell.org/cgi-bin/hackage-scripts/package/storablevector

Current repository is here:
  http://code.haskell.org/storablevector/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ambiguous constraint errors

2008-05-29 Thread Daniil Elovkov

Hello

Evan Laforge wrote:

I have two related questions:

#1

I'm getting some annoying type errors that I don't fully understand,
and wind up having to do a workaround that I don't totally like.
Here's a simplified version of my situation:

data Ambi m = Ambi {
ambi_monad :: m Int
, ambi_int :: Int
}

some_ambi :: Monad m = Ambi m
some_ambi = Ambi (return 5) 10

ambi_table :: Monad m = [(String, Ambi m)]
ambi_table = [(default, some_ambi)]
.
get_int :: String - Maybe Int
get_int sym = fmap ambi_int (lookup sym ambi_table)

---

get_int produces:
Ambiguous type variable `m' in the constraint:
  `Monad m' arising from a use of `ambi_table' at ambi.hs:13:40-49

So I guess this means I'm not telling it which 'm', so it doesn't know
how to resolve the 'return'... but the thing is, I'm not even using
that value, so it doesn't matter what it resolves to.  So it works if
I pick some random monad:

get_int sym = fmap ambi_int (lookup sym ambi_table :: Maybe (Ambi Maybe))


Of you and the type system you're the only one who knows that that value 
is not used. The type system doesn't use (all) the rules you have in 
your mind. It follows more simple ones.


You judge by values, not only types here. That is, you look at the value 
of ambi_int and see that it's just 10 in your (value again) some_ambi. 
You see that it's not


ambi_int = (some_return_from_monad ambi_monad) * 3

(If there were function returning from a monad)

In this case you wouldn't complain because the compiler definitely would 
have to know what monad it is.


Haskell type system doesn't look that far to distinguish those 2 cases. 
It doesn't deal with values (well, in a sense :).


Also compare with this

x :: Int
x = Five

main = putStrLn Hello

This program doesn't use x, so the type error would definitely not 
bother us at run-time. But it's nevertheless not ignored.






Note that I can't leave it as 'Monad m = Ambi m' because I still get
an ambiguous type variable complaint.

I'm a little disconcerted by having to pick some random dummy monad.
Even worse, everything this type touches starts requiring explicit
type declarations everywhere.  Is there some easier way to do this?


I tried to fiddle with forall, but it seems a lot more simple to say 
Identity. It will be entirely local to get_int function. Maybe it's not 
so bad...



#2

This is somewhat related to another issue I've been having, which is
that I have some kind of complicated type, e.g. '(SomeMonad some,
Monad m) = some (SomethingM m Status)' that I use in a lot of places.
 It would be a lot less typing and easier to modify later if I wrote a
type alias:

type Command = (Monad some, Monad m) = some (State.StateT () m Status)

but of course, this isn't allowed, since the type variables don't
appear on the lhs, and if I put a context there, it's a syntax error.
While I can write it with data:

data (Monad some, Monad m) = Command some m = Command (some
(State.StateT () m Status))

I've been told this doesn't mean what I expect it to, which is that
the context constraints propagate up to and unify with the containing
type (out of curiosity, since it's accepted, what *does* this do?  I
think I read it somewhere once, but now I forget and can't find it).
And sure enough, using this type doesn't make my type declarations
have the right contexts.



Well it means that you can't call any data constructor of this type with 
arguments not satisfying those constraints. Effectively it means that 
you won't ever have a value of type (Command some m) in your program 
where the pair (some,m) doesn't satisfy them.


However, the type system won't leverage that fact. And when you use a 
value of type Command some m somewhere you have to repeat the constraints.


afaik it is officially considered a Haskell mis-feature.

Am I wrong or it can be fixed by a compiler option (ghc)?

Operationally, if I get it right, it has to do with (not) attaching 
dictionaries to data constructors. If a dictionary was attached at the 
stage of constructing a Command, it could be easily re-used anywhere. If 
it's not attached you have to pass it later.




So the first problem means that I have to declare types in various
inconvenient places, and the second one means that I have to type out
all the various class constraints (I can still alias away the
non-polymorphic bits), and all my type declarations start looking much
more complicated than they are.

The solution I've been using for some of this is just to remove the
polymorphism, so I can write a simple alias like

type Command = SomethingM (State.StateT () Identity Status)

and now I can think of a command and have various functions that
take and return Commands, without caring that it's some kind of monad
with context constraints.  But of course, this isn't always possible
since sometimes I need the type to remain polymorphic (i.e. while most
of these I don't *think* will run in some other monad, some of them
definitely get 

Re: [Haskell-cafe] is there some book about haskell and data struct and alg?

2008-05-29 Thread Henk-Jan van Tuyl
On Thu, 29 May 2008 05:11:54 +0200, Benjamin L. Russell  
[EMAIL PROTECTED] wrote:


Although all the source code for the pdf version  
(http://www.cs.cmu.edu/~rwh/theses/okasaki.pdf) of Purely Functional  
Data Structures is provided in Standard ML, not Haskell, I found a  
broken link to the supposedly equivalent Haskell source code on Books -  
HaskellWiki (http://haskell.org/haskellwiki/Books):


Haskell source code for the book:
http://www.cs.columbia.edu/~cdo/pfds-haskell.tar.gz

Clicking on this link results in the following error:

[...]


Without the equivalent Haskell source code, the code must be manually  
translated from Standard ML into Haskell.  Does anybody know why the  
link is broken, when it may be fixed, and from where the Haskell source  
code can be currently obtained?


It appears that http://www.cs.columbia.edu/~cdo/ does not exist anymore;  
probably because the owner does not study/work at the university anymore.  
I fixed the link, it now points to the copy stored in the Wayback Machine  
( http://web.archive.org/ ).

The new link is:
  
http://web.archive.org/web/2818044004/http://www.cs.columbia.edu/~cdo/pfds-haskell.tar.gz

--
Met vriendelijke groet,
Henk-Jan van Tuyl


--
http://functor.bamikanarie.com
http://Van.Tuyl.eu/
--


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


Re: Re: [Haskell-cafe] Aren't type system extensions fun? [Further analysis]

2008-05-29 Thread Kim-Ee Yeoh


Roberto Zunino-2 wrote:
 
 Alas, for code like yours:
foo = \f - (f 'J', f True)
 
 there are infinite valid types too:
(forall a. a - Int) - (Int, Int)
(forall a. a - Char)- (Char, Char)
(forall a. a - (a,a)) - ((Char,Char),(Bool,Bool))
...
 
 and it is much less clear if a best, most general type exists at all.
 

How about
  foo :: (exists. m :: * - *. forall a. a - m a) - (m Char, m Bool)

Not quite Haskell, but seems to cover all of the examples you gave.


-- Kim-Ee

-- 
View this message in context: 
http://www.nabble.com/Aren%27t-type-system-extensions-fun--tp17479349p17531238.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

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


Re: [Haskell-cafe] type-level integers using type families

2008-05-29 Thread Isaac Dupree

Peter Gavin wrote:

Has anyone else tried implementing type-level integers using type families?

I tried using a couple of other type level arithmetic libraries 
(including type-level on Hackage) and they felt a bit clumsy to use.  I 
started looking at type families and realized I could pretty much build 
an entire Scheme-like language based on them.


In short, I've got addition, subtraction,  multiplication working after 
just a days worth of hacking. I'm going to post the darcs archive 
sometime, sooner if anyone's interested.


I really like the type-families based approach to this, it's a lot 
easier to understand, and you can think about things functionally 
instead of relationally.  (Switching back and forth between Prolog-ish 
thinking and Haskell gets old quick.) Plus you can do type arithmetic 
directly in place, instead of using type classes everywhere.


nice, it's been tried before, etc. etc.. And of course it doesn't work 
with a released version of GHC, so maybe it's hoping too much that it 
would be on Hackage.  What I was going to say was, see if there is one 
on hackage, otherwise there should be one there to be polished.  But I 
guess searching haskell-cafe is your man :-) (your way to try to find 
any.  Or the Haskell blogosphere too.)


One thing that I'd like to be able to do is lazy unification on type 
instances, so that things like


...

will work if the non-taken branch can't be unified with anything.  Is 
this planned? Is it even feasible?


I'm pretty sure it would be possible to implement a Lambda like this, 
but I'm not seeing it yet. Any ideas?


Yeah -- that would be neat but generally tends to lead to undecidability 
(unless you're really careful making it a lot(?) less useful).  That is, 
potential nontermination in the type inferencer/checker, not just in 
runtime.  Then you'll want it to be well-defined when something is 
type-level-lazy, so you can reliably write your type-level algorithms. 
And *that* is bound to be rather difficult to define and to implement 
and maintain.

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


Re: [Haskell-cafe] ambiguous constraint errors

2008-05-29 Thread Isaac Dupree

Evan Laforge wrote:

I have two related questions:

#1

I'm getting some annoying type errors that I don't fully understand,
and wind up having to do a workaround that I don't totally like.
Here's a simplified version of my situation:

data Ambi m = Ambi {
ambi_monad :: m Int
, ambi_int :: Int
}

some_ambi :: Monad m = Ambi m
some_ambi = Ambi (return 5) 10

ambi_table :: Monad m = [(String, Ambi m)]
ambi_table = [(default, some_ambi)]

get_int :: String - Maybe Int
get_int sym = fmap ambi_int (lookup sym ambi_table)

---

get_int produces:
Ambiguous type variable `m' in the constraint:
  `Monad m' arising from a use of `ambi_table' at ambi.hs:13:40-49

So I guess this means I'm not telling it which 'm', so it doesn't know
how to resolve the 'return'... but the thing is, I'm not even using
that value, so it doesn't matter what it resolves to.  So it works if
I pick some random monad:

get_int sym = fmap ambi_int (lookup sym ambi_table :: Maybe (Ambi Maybe))

Note that I can't leave it as 'Monad m = Ambi m' because I still get
an ambiguous type variable complaint.

I'm a little disconcerted by having to pick some random dummy monad.
Even worse, everything this type touches starts requiring explicit
type declarations everywhere.  Is there some easier way to do this?

#2

This is somewhat related to another issue I've been having, which is
that I have some kind of complicated type, e.g. '(SomeMonad some,
Monad m) = some (SomethingM m Status)' that I use in a lot of places.
 It would be a lot less typing and easier to modify later if I wrote a
type alias:

type Command = (Monad some, Monad m) = some (State.StateT () m Status)

but of course, this isn't allowed, since the type variables don't
appear on the lhs, and if I put a context there, it's a syntax error.


-fglasgow-exts (not sure which extension) allows the above, though I'm 
not quite sure what it *means*.  It also allows
type Command some m = (Monad some, Monad m) = some (State.StateT () m 
Status)
which allows the polymorphism in the types to be shared across more of 
the function that's defined using Command: more opportunity for 
explicitness.



While I can write it with data:

data (Monad some, Monad m) = Command some m = Command (some
(State.StateT () m Status))

I've been told this doesn't mean what I expect it to, which is that
the context constraints propagate up to and unify with the containing
type (out of curiosity, since it's accepted, what *does* this do?  I
think I read it somewhere once, but now I forget and can't find it).
And sure enough, using this type doesn't make my type declarations
have the right contexts.
That Haskell-98 syntax only tells the compiler to break some times when 
the context isn't met.  But you want the compiler to not-break at other 
times by supplying the information about the context being available 
when something else requires it.


with {-# LANGUAGE GADTs #-} you should be able to use a different syntax 
for the same sort of thing but with the meaning you wanted:  (beware of 
layout messed up by e-mail line wrapping) :

data Command some m where
  Command :: (Monad some, Monad m) = some (State.StateT () m Status) 
- Command some m


This might be a better choice than the type synonym actually, since it's 
in some ways less unpredictable in meaning to the type system (well, 
again assuming that GHC is the only Haskell implementation that matters 
to you).



So the first problem means that I have to declare types in various
inconvenient places, and the second one means that I have to type out
all the various class constraints (I can still alias away the
non-polymorphic bits), and all my type declarations start looking much
more complicated than they are.


It's a really annoying problem!  The multi-param-type-class hack Daniil 
Elovkov mentioned is another way it's done sometimes, that also uses a 
few compiler extensions.  CPP macros are even uglier but they can work 
too.  Choose whatever suits you best.  None of the solutions that make 
polymorphism more syntactically convenient will get rid of your 
ambiguity annoyances, and I'm not sure if the Haskell98 default()ing 
system is willing to default Monads.


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


Re: Re: [Haskell-cafe] Aren't type system extensions fun? [Further analysis]

2008-05-29 Thread Luke Palmer
On Thu, May 29, 2008 at 9:51 AM, Kim-Ee Yeoh [EMAIL PROTECTED] wrote:
 Roberto Zunino-2 wrote:

 Alas, for code like yours:
foo = \f - (f 'J', f True)

 there are infinite valid types too:
(forall a. a - Int) - (Int, Int)
(forall a. a - Char)- (Char, Char)
(forall a. a - (a,a)) - ((Char,Char),(Bool,Bool))
...

 and it is much less clear if a best, most general type exists at all.


 How about
  foo :: (exists. m :: * - *. forall a. a - m a) - (m Char, m Bool)

 Not quite Haskell, but seems to cover all of the examples you gave.

You have now introduced a first-class type function a la dependent
types, which I believe makes the type system turing complete.  This
does not help the decidability of inference :-)

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


Re: [Haskell-cafe] Aren't type system extensions fun? [Further analysis]

2008-05-29 Thread Roberto Zunino

Kim-Ee Yeoh wrote:


How about
  foo :: (exists. m :: * - *. forall a. a - m a) - (m Char, m Bool)


Thank you: I had actually thought about something like that.

First, the exists above should actually span over the whole type, so it 
becomes a forall because (-) is contravariant on its 1st argument:


   foo :: forall m :: * - * . (forall a. a - m a) - (m Char, m Bool)

This seems to be Haskell+extensions, but note that m above is meant to 
be an arbitrary type-level function, and not a type constructor (in 
general).  So, I am not surprised if undecidability issues arise in type 
checking/inference. :-)


Another valid type for foo can be done AFAICS with intersection types:

   foo :: (Char - a /\ Bool - b) - (a,b)

But I can not comment about their inference, or usefulness in practice.

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


Re: [Haskell-cafe] Aren't type system extensions fun? [Further analysis]

2008-05-29 Thread Edsko de Vries
On Thu, May 29, 2008 at 01:44:24PM +0200, Roberto Zunino wrote:
 Kim-Ee Yeoh wrote:
 
 How about
   foo :: (exists. m :: * - *. forall a. a - m a) - (m Char, m Bool)
 
 Thank you: I had actually thought about something like that.
 
 First, the exists above should actually span over the whole type, so it 
 becomes a forall because (-) is contravariant on its 1st argument:
 
foo :: forall m :: * - * . (forall a. a - m a) - (m Char, m Bool)
 
 This seems to be Haskell+extensions, but note that m above is meant to 
 be an arbitrary type-level function, and not a type constructor (in 
 general).  So, I am not surprised if undecidability issues arise in type 
 checking/inference. :-)

Type *checking* is still decidable (System Fw is sufficiently powerful
to model these types) but type inference now needs higher order
unification, which indeed is undecidable.

 Another valid type for foo can be done AFAICS with intersection types:
 
foo :: (Char - a /\ Bool - b) - (a,b)
 
 But I can not comment about their inference, or usefulness in practice.

Again, undecidable :) In fact, I believe that an inference algorithm for
intersection types is equivalent to solving the halting problem. Type
checking however is decidable, but expensive.

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


Re: Re: [Haskell-cafe] Aren't type system extensions fun? [Further analysis]

2008-05-29 Thread Kim-Ee Yeoh


Luke Palmer-2 wrote:
 
 You have now introduced a first-class type function a la dependent
 types, which I believe makes the type system turing complete.  This
 does not help the decidability of inference :-)
 

God does not care about our computational difficulties. He infers
types emp^H^H^H ... uh, as He pleases.

Anyway, the original point of it was semantic. Let's first
explore the meaning of the most general type. Type functions
give one answer, intersection types another.


-- Kim-Ee (yeoh at cs dot wisc dot edu)


-- 
View this message in context: 
http://www.nabble.com/Aren%27t-type-system-extensions-fun--tp17479349p17534701.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

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


[Haskell-cafe] Re: Aren't type system extensions fun? [Further analysis]

2008-05-29 Thread Achim Schneider
Kim-Ee Yeoh [EMAIL PROTECTED] wrote:

 
 
 Luke Palmer-2 wrote:
  
  You have now introduced a first-class type function a la dependent
  types, which I believe makes the type system turing complete.  This
  does not help the decidability of inference :-)
  
 
 God does not care about our computational difficulties. He infers
 types emp^H^H^H ... uh, as He pleases.
 
This begs the question: Can God come up with a type He doesn't
understand?

The answer, it seems, is Mu.

-- 
(c) this sig last receiving data processing entity. Inspect headers for
past copyright information. All rights reserved. Unauthorised copying,
hiring, renting, public performance and/or broadcasting of this
signature prohibited. 

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


Re: [Haskell-cafe] Aren't type system extensions fun? [Further analysis]

2008-05-29 Thread Isaac Dupree

Another valid type for foo can be done AFAICS with intersection types:

   foo :: (Char - a /\ Bool - b) - (a,b)

But I can not comment about their inference, or usefulness in practice.


Again, undecidable :) In fact, I believe that an inference algorithm for
intersection types is equivalent to solving the halting problem. Type
checking however is decidable, but expensive.


a.k.a. find some value that matches both Char-a and Bool-b for some a 
and b.  Could use type-classes to do it.


But why, when we can just use standard tuples instead?
foo :: (Char - a , Bool - b) - (a,b)

Admittedly this function is isomorphic to type (Char,Bool)... but that's 
a different issue, with the arbitrariness of our choice of example function.


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


Re: [Haskell-cafe] Bug in parallel GHC runtime?

2008-05-29 Thread Simon Marlow

Don Stewart wrote:

Hi,

Thanks for the bug report.
This should be filed on the GHC bug tracker,

http://hackage.haskell.org/trac/ghc/newticket?type=bug

And I've forwarded it to the glasgow-haskell-bugs mailing list.


Please try with the 6.8.3 RC we just released.  I fixed a bug that could be 
the cause of this.


http://www.haskell.org/pipermail/glasgow-haskell-users/2008-May/014814.html

Cheers,
Simon



kolar:

Hello all,

 The attached file was compiled by the following command:

ghc -O2 --make -threaded ltest1pl.hs -o alall

When run in a sequential mode, I get this result:
./alall
Starting ...
Lst1: 416665
Lst2: 4166916670
T1: 0m 1.0e-6s
36
End!


On the other hand, when run in a threaded mode, I get the following error:
./alall +RTS -N2
Starting ...
Lst1: 416665
Lst2: 4166916670
T1: 0m 0.0s
Segmentation fault

Is it fault of the GHC runtime, or is it something on my side?


My machine: uname -a
Linux pc 2.6.24-ARCH #1 SMP PREEMPT Sun Mar 30 10:50:22 CEST 2008 x86_64 
Intel(R) Core(TM)2 CPU 6600 @ 2.40GHz GenuineIntel GNU/Linux


My ghc: ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.8.2


Thanks and regards
 Dusan




--import Control.Concurrent
--import Control.Concurrent.MVar
import System.Time

import Control.Parallel.Strategies

--import Data.List (foldl')
import qualified Data.ByteString as B


sumAllSums [] = 0
sumAllSums l@(_:xs) = sumlist 0 l + sumAllSums xs
  where  sumlist res [] = res   
 sumlist sr  (v:vs) = sumlist (sr+v) vs

wlist2wbs [] = B.pack []
wlist2wbs l@(_:_) = B.pack $ encode l
  where
encode :: Integral a = [Int] - [a]
encode [] = []
encode (x:xs) = 
  if x==0 then 0:0:encode xs

  else fromIntegral (x `mod` 256) : fromIntegral (x `div` 256) : encode xs

main = do
  putStrLn $ Starting ...
  let lst1 = [0..4]
  let lst2 = [0..5]
  let bs1 = wlist2wbs lst1
  let bs2 = wlist2wbs lst2
  tm1 - getClockTime
  let (v1:v2:_) = parMap rnf sumAllSums [lst1,lst2]
  tm1' - getClockTime
  putStrLn (Lst1:  ++ show v1)
  putStrLn (Lst2:  ++ show v2)
  let tdiff1 = diffClockTimes tm1' tm1
  --let tdiff2 = diffClockTimes tm2' tm2
  putStrLn $ T1:  ++ show (tdMin tdiff1) ++ m  ++ show (fromIntegral(tdSec tdiff1) + 
fromIntegral(tdPicosec tdiff1)/1e12) ++ s
  --putStrLn $ T2:  ++ show (tdMin tdiff2) ++ m  ++ show (fromIntegral(tdSec tdiff2) 
+ fromIntegral(tdPicosec tdiff2)/1e12) ++ s
  putStrLn $ show $ {-ibs1 +-} B.index bs1 9 + B.index bs2 4 {-((bs1 + 
fromIntegral (B.index bs2 9)) :: Integer)-}
  putStrLn $ End!

{-
main = do
  tm1 - getClockTime
  putStrLn $ Starting ... 
  mv1 - newEmptyMVar
  mv2 - newEmptyMVar
  t1 - forkIO (putMVar mv1 $! sumAllSums [0..4])
  t2 - forkIO (putMVar mv2 $!  sumAllSums [1..5])
  v1 - takeMVar mv1
  v2 - takeMVar mv2
  killThread t1
  killThread t2
  putStrLn $ Result:  ++ show (v1+v2)
  tm2 - getClockTime
  let tdiff = diffClockTimes tm2 tm1
  putStrLn $ End!  ++ show (tdMin tdiff) ++ m  ++ show (fromIntegral(tdSec tdiff) + 
fromIntegral(tdPicosec tdiff)/1e12) ++ s
-}




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


___
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


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


[Haskell-cafe] Damnit, we need a CPAN.

2008-05-29 Thread Achim Schneider
No, wait, there's cabal-install. And it doesn't even depend on 20+
packages I'd have to install manually. My day, for now, is saved, at
least if portage installs it without hesitation.

Ah, there it is: 
 Compiling source
 in /var/tmp/portage/dev-haskell/cabal-darcs-0/work/cabal-darcs-0 ...
 * Bootstrapping Cabal...

no location info: can't find file: Setup.lhs
 *
 * ERROR: dev-haskell/cabal-darcs-0 failed.

Ok, let's try it the other way 'round...:
% wget \
http://hackage.haskell.org/packages/archive/cabal-install/0.4.0/cabal-install-0.4.0.tar.gz
% tar xvzf cabal-install-0.4.0.tar.gz
% cd cabal-install-0.4.0
% runhaskell Setup.lhs configure --prefix=/home/ksf/cabal-inst --user
Configuring cabal-install-0.4.0...
% runhaskell Setup.lhs install
Installing: /home/ksf/cabal-inst/bin
Setup.lhs: dist/build/cabal/cabal: copyFile: does not exist (No such
file or directory)
% runhaskell Setup.lhs build
Preprocessing executables for cabal-install-0.4.0...
Building cabal-install-0.4.0...
[...]
% runhaskell Setup.lhs install
Installing: /home/ksf/cabal-inst/bin
% cabal update
% cabal install phooey
[...]
 type 'make' to build wxhaskell.
 type 'make install' to install wxhaskell.
 type 'make help' to receive help on all other make targets

Configure Succeeded.

Indeed. It succeeded. Now what? Building and installing by hand, it
seems.

Building works, installing too, but registering fails: the Makefile
does not seem to like --user:

% runhaskell Setup.lhs register --user
-=-= Cabal executing: make register=-=-
cat config/wxcore.pkg | sed -e
s|\${wxhlibdir}|/home/ksf/cabal-inst/lib| | ghc-pkg update - Reading
package info from stdin ... done. WARNING: unversioned dependencies are
deprecated, and will NOT be accepted by GHC 6.10: base haskell98 Unable
to rename /usr/lib64/ghc-6.8.2/package.conf to
/usr/lib64/ghc-6.8.2/package.conf.old Saving old package config
file... ghc-pkg.bin: /usr/lib64/ghc-6.8.2/package.conf: renameFile:
permission denied (Permission denied)


Just a second... 
# emerge wxhaskell -pv

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild UD] dev-lang/ghc-6.4.2 [6.8.2] USE=X%* doc opengl%*
-binary -ghcbootstrap -openal% -test%(-bash-completion%) 0 kB [0=1]
[ebuild  N] dev-haskell/wxhaskell-0.9.4  USE=doc 0 kB


In other words: No way. The only program that touches anything in /usr/
is portage.

Well, at least ghc-pkg update works on a mangled wxcore.pkg.


Rationale: We need a CPAN, a cabal that is smart enough to know what to
to, even if building depends on make, grapefruit authors that commit
to hackage, a cabal-inst that can install from darcs (or at least from
a local directory), or maybe just a make-replacement for haskell, like
java has with ant (which is really cool if you successfully do not
notice the xml-syntax).

I would already shut up if there were an ebuild generator, but then I'm
not that egoistic ;)

Anyway, three hours after wanting to try it out, grapefruit is up and
running, and I did not even have to install its dependencies by hand. It
seems like grapefruit could benefit from nestable cabal packages,
though: It has one big script that installs many packages. You could
also call them dependencies.

I'm going to shut up now.

-- 
(c) this sig last receiving data processing entity. Inspect headers for
past copyright information. All rights reserved. Unauthorised copying,
hiring, renting, public performance and/or broadcasting of this
signature prohibited. 

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


Re: [Haskell-cafe] Damnit, we need a CPAN.

2008-05-29 Thread Neil Mitchell
Hi

 Rationale: We need a CPAN

We choose to spell CPAN as Hackage

, a cabal that is smart enough to know what to
 to, even if building depends on make

Why should building depend on make? Shouldn't cabal build stuff for
us? We need a cabal that is clever enough that we don't need a make.

, grapefruit authors that commit
 to hackage

Or someone to help show the grapefruit authors the light. I helped put
smallcheck on hackage, others have done other packages. Perhaps you
could do grapefruit?

, a cabal-inst that can install from darcs (or at least from
 a local directory)

Yes, that would be lovely!

, or maybe just a make-replacement for haskell, like
 java has with ant (which is really cool if you successfully do not
 notice the xml-syntax).

We have replaced a lot of make with just --make in GHC. Cabal replaces
more. What more bits of make do you need? If you can say why make is
still necessary, people may be able to eliminate it.

Thanks

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


Re: [Haskell-cafe] Damnit, we need a CPAN.

2008-05-29 Thread Darrin Thompson
On Thu, May 29, 2008 at 11:47 AM, Neil Mitchell [EMAIL PROTECTED] wrote:
, a cabal-inst that can install from darcs (or at least from
 a local directory)

 Yes, that would be lovely!


While we're on the subject, why does searchpath get as little
attention as it does? It seems to work reasonably well for HAppS.

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


Re: [Haskell-cafe] Damnit, we need a CPAN.

2008-05-29 Thread Rob Hoelz
Neil Mitchell [EMAIL PROTECTED] wrote:

 Hi
 
  Rationale: We need a CPAN
 
 We choose to spell CPAN as Hackage
 
 , a cabal that is smart enough to know what to
  to, even if building depends on make
 
 Why should building depend on make? Shouldn't cabal build stuff for
 us? We need a cabal that is clever enough that we don't need a make.
 
 , grapefruit authors that commit
  to hackage
 
 Or someone to help show the grapefruit authors the light. I helped put
 smallcheck on hackage, others have done other packages. Perhaps you
 could do grapefruit?
 
 , a cabal-inst that can install from darcs (or at least from
  a local directory)
 
 Yes, that would be lovely!
 
 , or maybe just a make-replacement for haskell, like
  java has with ant (which is really cool if you successfully do not
  notice the xml-syntax).
 
 We have replaced a lot of make with just --make in GHC. Cabal replaces
 more. What more bits of make do you need? If you can say why make is
 still necessary, people may be able to eliminate it.
 
 Thanks
 
 Neil
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

Hackage and Cabal are nice, but a command line tool for automatically
searching Hackage and installing Hackage packages (like the cpan
program, or easy_install) would be nice.  Unless I haven't done my
homework and this tool exists...

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


Re: [Haskell-cafe] Damnit, we need a CPAN.

2008-05-29 Thread Donnie Jones
Hello Rob,

On Thu, May 29, 2008 at 12:05 PM, Rob Hoelz [EMAIL PROTECTED] wrote:

 Neil Mitchell [EMAIL PROTECTED] wrote:

  Hi
 
   Rationale: We need a CPAN
 
  We choose to spell CPAN as Hackage
 
  , a cabal that is smart enough to know what to
   to, even if building depends on make
 
  Why should building depend on make? Shouldn't cabal build stuff for
  us? We need a cabal that is clever enough that we don't need a make.
 
  , grapefruit authors that commit
   to hackage
 
  Or someone to help show the grapefruit authors the light. I helped put
  smallcheck on hackage, others have done other packages. Perhaps you
  could do grapefruit?
 
  , a cabal-inst that can install from darcs (or at least from
   a local directory)
 
  Yes, that would be lovely!
 
  , or maybe just a make-replacement for haskell, like
   java has with ant (which is really cool if you successfully do not
   notice the xml-syntax).
 
  We have replaced a lot of make with just --make in GHC. Cabal replaces
  more. What more bits of make do you need? If you can say why make is
  still necessary, people may be able to eliminate it.
 
  Thanks
 
  Neil
  ___
  Haskell-Cafe mailing list
  Haskell-Cafe@haskell.org
  http://www.haskell.org/mailman/listinfo/haskell-cafe

 Hackage and Cabal are nice, but a command line tool for automatically
 searching Hackage and installing Hackage packages (like the cpan
 program, or easy_install) would be nice.  Unless I haven't done my
 homework and this tool exists...

 Thanks,
 Rob



Try this:
  cabal update
  cabal list pattern
  cabal install

For example,
  cabal update-- updates your list of packages
  cabal list xml-- searches the list of packages matching the
pattern xml
  cabal install HaXml  -- will download and install the package.

Is that what you were wanting?  :)
__
Donnie
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Damnit, we need a CPAN.

2008-05-29 Thread Don Stewart
 Hackage and Cabal are nice, but a command line tool for automatically
 searching Hackage and installing Hackage packages (like the cpan
 program, or easy_install) would be nice.  Unless I haven't done my
 homework and this tool exists...
 

This tool exists. It is called 'cabal-install'. To try out one of
today's new packages:

$ cabal update
Downloading package list from server 
'http://hackage.haskell.org/packages/archive'

$ cabal install category-extras
Downloading 'category-extras-0.52.1'...
Configuring category-extras-0.52.1...
Preprocessing library category-extras-0.52.1...
Building category-extras-0.52.1...
/usr/bin/ar: creating dist/build/libHScategory-extras-0.52.1.a
Installing: /home/dons/.cabal/lib/category-extras-0.52.1/ghc-6.8.2
Registering category-extras-0.52.1...

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


[Haskell-cafe] Copying Arrays

2008-05-29 Thread Tom Harper
I'm trying to implement some file I/O where I can read in a file to an
array, but do so without having to know how much space I will need.
(Before you suggest it, lists are too slow/space consuming.)  I was
thinking that one possible solution is to use a strategy used in
dynamic arrays, where everytime you run out of space you double the
capacity of the array.  Trouble is, most arrays in Haskell would
require you to traverse the entire array and copy each individual
cell, which would make it worthless.

Are there any low-level array types (MutableByteArray#, for example)
that support a memcpy-like function where I could copy the entire
array into the new one instead of copying it one value at a time?  Is
there another solution that I'm missing?


-- 
Tom Harper
MSc Computer Science '08
University of Oxford
Mobile: +44 (0)7533 998 591
Skype: +1 949 273 4627 (harpertom)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Copying Arrays

2008-05-29 Thread Jefferson Heard
Define too slow, time-consuming?  I've dealt with this problem a lot
at this point, and I've been able to slurp up CSV files of several
gigabytes in the same amount of time as I generally do in C.  I have a
feeling an array solution is just going to bog you down more, however
if you insist, I would also suggest writing your I/O in C and
returning a ForeignPtr to something and work from there.

-- Jeff

On Thu, May 29, 2008 at 12:21 PM, Tom Harper
[EMAIL PROTECTED] wrote:
 I'm trying to implement some file I/O where I can read in a file to an
 array, but do so without having to know how much space I will need.
 (Before you suggest it, lists are too slow/space consuming.)  I was
 thinking that one possible solution is to use a strategy used in
 dynamic arrays, where everytime you run out of space you double the
 capacity of the array.  Trouble is, most arrays in Haskell would
 require you to traverse the entire array and copy each individual
 cell, which would make it worthless.

 Are there any low-level array types (MutableByteArray#, for example)
 that support a memcpy-like function where I could copy the entire
 array into the new one instead of copying it one value at a time?  Is
 there another solution that I'm missing?


 --
 Tom Harper
 MSc Computer Science '08
 University of Oxford
 Mobile: +44 (0)7533 998 591
 Skype: +1 949 273 4627 (harpertom)
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe




-- 
I try to take things like a crow; war and chaos don't always ruin a
picnic, they just mean you have to be careful what you swallow.

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


Re: [Haskell-cafe] Copying Arrays

2008-05-29 Thread Bulat Ziganshin
Hello Tom,

Thursday, May 29, 2008, 8:21:25 PM, you wrote:

 Are there any low-level array types (MutableByteArray#, for example)
 that support a memcpy-like function

yes, MBA# allows to use memcpy. you can find examples of its
usage right in the array package, for example:

thawSTUArray :: Ix i = UArray i e - ST s (STUArray s i e)
thawSTUArray (UArray l u arr#) = ST $ \s1# -
case sizeofByteArray# arr#  of { n# -
case newByteArray# n# s1#   of { (# s2#, marr# #) -
case unsafeCoerce# memcpy marr# arr# n# s2# of { (# s3#, () #) -
(# s3#, STUArray l u marr# #) }}}

foreign import ccall unsafe memcpy
memcpy :: MutableByteArray# RealWorld - ByteArray# - Int# - IO ()

i can give you further explanations if required

-- 
Best regards,
 Bulatmailto:[EMAIL PROTECTED]

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


Re: [Haskell-cafe] Copying Arrays

2008-05-29 Thread Adrian Neumann

Isn't fast IO what ByteStrings where invented for?

Adrian

Tom Harper schrieb:

I'm trying to implement some file I/O where I can read in a file to an
array, but do so without having to know how much space I will need.
(Before you suggest it, lists are too slow/space consuming.)  I was
thinking that one possible solution is to use a strategy used in
dynamic arrays, where everytime you run out of space you double the
capacity of the array.  Trouble is, most arrays in Haskell would
require you to traverse the entire array and copy each individual
cell, which would make it worthless.

Are there any low-level array types (MutableByteArray#, for example)
that support a memcpy-like function where I could copy the entire
array into the new one instead of copying it one value at a time?  Is
there another solution that I'm missing?







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] Copying Arrays

2008-05-29 Thread Jefferson Heard
Exactly.  Someone on the list gave me this example awhile back for
reading CSV files.  I can process a gigabyte (simple unpack and print
to dev/null for IO testing purposes) in about two and a half seconds
using this code.

import Data.ByteString.Lazy.Char8 as C

-- | Read a datafile and turn it into lists of columns
readDatafileAndTranspose name = do
sheet - (transpose . map (C.split '\t') . C.lines) `fmap` C.readFile name
return $ foldl' go M.empty sheet
  where go m (x:xs) = M.insert (C.unpack x) xs m


2008/5/29 Adrian Neumann [EMAIL PROTECTED]:
 Isn't fast IO what ByteStrings where invented for?

 Adrian

 Tom Harper schrieb:

 I'm trying to implement some file I/O where I can read in a file to an
 array, but do so without having to know how much space I will need.
 (Before you suggest it, lists are too slow/space consuming.)  I was
 thinking that one possible solution is to use a strategy used in
 dynamic arrays, where everytime you run out of space you double the
 capacity of the array.  Trouble is, most arrays in Haskell would
 require you to traverse the entire array and copy each individual
 cell, which would make it worthless.

 Are there any low-level array types (MutableByteArray#, for example)
 that support a memcpy-like function where I could copy the entire
 array into the new one instead of copying it one value at a time?  Is
 there another solution that I'm missing?





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





-- 
I try to take things like a crow; war and chaos don't always ruin a
picnic, they just mean you have to be careful what you swallow.

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


[Haskell-cafe] appending an element to a list

2008-05-29 Thread Adrian Neumann

Hello,

I was wondering how expensive appending something to a list really is. 
Say I write


I'd say longList ++ [5] stays unevaluated until I consumed the whole 
list and then appending should go in O(1). Similarly when concatenating 
two lists.


Is that true, or am I missing something?

Adrian



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] Copying Arrays

2008-05-29 Thread Bryan O'Sullivan
Tom Harper wrote:
 I'm trying to implement some file I/O where I can read in a file to an
 array, but do so without having to know how much space I will need.

Why not just read it into a lazy ByteString?  Are you looking to use an
array with elements of a different type?  You could then convert it to a
strict ByteString.

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


Re: [Haskell-cafe] Aren't type system extensions fun? [Further analysis]

2008-05-29 Thread Roberto Zunino

Isaac Dupree wrote:

   foo :: (Char - a /\ Bool - b) - (a,b)


a.k.a. find some value that matches both Char-a and Bool-b for some a 
and b.  Could use type-classes to do it.


Uhmm... you mean something like (neglecting TC-related issues here)

class C a b where
   fromChar :: Char - a
   fromBool :: Bool - b

or some more clever thing?

If this can be encoded with method-less classes, I would be quite 
interested in knowing how.



But why, when we can just use standard tuples instead?
foo :: (Char - a , Bool - b) - (a,b)


This makes the class dictionary explicit.

Alas, IIUC we lost type erasure (does that still hold with intersection 
types?) in this implementation.


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


Re: [Haskell-cafe] Aren't type system extensions fun? [Further analysis]

2008-05-29 Thread Roberto Zunino

Roberto Zunino wrote:

Uhmm... you mean something like (neglecting TC-related issues here)

class C a b where
   fromChar :: Char - a
   fromBool :: Bool - b


Oops: i meant something like

class C x a b | x - a,b where
   fromChar :: x - Char - a
   fromBool :: x - Bool - b


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


Re: [Haskell-cafe] appending an element to a list

2008-05-29 Thread Joachim Breitner
Hi,

Am Donnerstag, den 29.05.2008, 19:04 +0200 schrieb Adrian Neumann:
 I was wondering how expensive appending something to a list really is. 
 Say I write
 
 I'd say longList ++ [5] stays unevaluated until I consumed the whole 
 list and then appending should go in O(1). Similarly when concatenating 
 two lists.
 
 Is that true, or am I missing something?

I’m no expert, but I give it shot:

The problem is that longList might be referenced somewhere else as well,
so it has to be kept around, ending in [], not in [5]. But (longList ++
[5]) also might be referenced somewhere, so you also need to keep that
list. Thus you have to copy the whole list structure for the appending
(not the values, though).

For comparision, with (5:longList), the new list can use the old list
unmodified, so nothing has to be copied.


You can also observe this in the code for (++):

(++) :: [a] - [a] - [a]
(++) [] ys = ys
(++) (x:xs) ys = x : xs ++ ys

where you can see that on the right hand side, a totally new list is
constructed.


In some cases, e.g. when the longList is only referenced there and
nowhere else, one might hope that the compiler can optimize this problem
away. There is some hope, as I see this in the code:

{-# RULES
++[~1] forall xs ys. xs ++ ys = augment (\c n - foldr c n xs) ys
  #-}

Maybe some core-literate people can give more information on this?

Greetings,
Joachim

-- 
Joachim nomeata Breitner
  mail: [EMAIL PROTECTED] | ICQ# 74513189 | GPG-Key: 4743206C
  JID: [EMAIL PROTECTED] | http://www.joachim-breitner.de/
  Debian Developer: [EMAIL PROTECTED]


signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] So how do people pronounce 'cabal' around here?

2008-05-29 Thread Dan Piponi
On Wed, May 28, 2008 at 6:38 PM, Richard A. O'Keefe [EMAIL PROTECTED] wrote:
 I've always pronounced it k'BAHL, but was surprised to find that
 the OED only countenances a short second syllable:

The reason I originally asked is that American, British and other
dialects of English handle French loanwords differently. Americans put
stress towards the end and lengthen the final vowel; Brits typically
do the opposite.
--
Dan
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] WebSense doesn't like darcs.haskell.org

2008-05-29 Thread Chad Scherrer
My work uses WebSense to filter viewable pages - I don't have an option.

I used to be able to get to darcs.haskell.org just fine, but apparently a
/hacking directory was added somewhere, so WebSense put it on the naughty list.

I put in a request for WebSense to review the site; hopefully it will soon be
allowed again. But if not, I'll have to go through lots of red tape, which I'd
really like to avoid.

I assume/hope this hacking is only in the sense of making adjustments to code.
Is this right? If there's anything involving DoS attacks, etc, I might never be
able to get to it from work again.

I get the impression WebSense is relatively widely used. Is anyone else here
having similar trouble?

Chad

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


Re: [Haskell-cafe] appending an element to a list

2008-05-29 Thread Tillmann Rendel



Adrian Neumann wrote:

Hello,

I was wondering how expensive appending something to a list really is. 
Say I write


I'd say longList ++ [5] stays unevaluated until I consumed the whole 
list and then appending should go in O(1). Similarly when concatenating 
two lists.


Is that true, or am I missing something?


I think that is true and you are missing something: You have to push the 
call to ++ through the whole longList while consuming it wholy one 
element at a time! So when longList has n elements, you have (n+1) calls 
of ++, each returning after O(1) steps. The first n calls return a list 
with the ++ pushed down, and the last returns [5]. Summed together, that 
makes O(n) actual calls of ++ for one written by the programmer.


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


Re: [Haskell-cafe] Copying Arrays

2008-05-29 Thread Tom Harper
 Why not just read it into a lazy ByteString?  Are you looking to use an
 array with elements of a different type?  You could then convert it to a
 strict ByteString.

b


Because I'm writing the Unicode-friendly ByteString =p


-- 
Tom Harper
MSc Computer Science '08
University of Oxford
Mobile: +44 (0)7533 998 591
Skype: +1 949 273 4627 (harpertom)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Copying Arrays

2008-05-29 Thread Bryan O'Sullivan
Tom Harper wrote:

 Because I'm writing the Unicode-friendly ByteString =p

Perhaps I'm not understanding.  Why wouldn't you use ByteString for I/O,
even if you're writing a different library?  After all, ByteString's own
internals use memcpy.

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


Re: [Haskell-cafe] Copying Arrays

2008-05-29 Thread Jed Brown
On Thu 2008-05-29 19:19, Tom Harper wrote:
  Why not just read it into a lazy ByteString?  Are you looking to use an
  array with elements of a different type?  You could then convert it to a
  strict ByteString.
 
 Because I'm writing the Unicode-friendly ByteString =p

Uh, ByteString is Unicode-agnostic.  ByteString.Char8 is not.  So why not do IO
with lazy ByteString and parse into your own representation (which might look a
lot like StorableVector)?

Jed


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


[Haskell-cafe] Re: Copying Arrays

2008-05-29 Thread Chad Scherrer
Jed Brown jed at 59A2.org writes:
 Uh, ByteString is Unicode-agnostic.  ByteString.Char8 is not.  So why not do 
 IO
 with lazy ByteString and parse into your own representation (which might look 
 a
 lot like StorableVector)?

One problem you might run into doing it this way is if a wide character is split
between two different arrays. In that case you have to do some post-porcessing
to put the pieces back together. More efficient, I think, if you could force a
given alignment when reading in the lazy bytestring. But there's not a way to do
that, is there?

I hope this makes sense. It's the problem I ran into when I tried once to use
lazy bytestrings instead of a storable vector, reasoning that the more recent
fusion work in bytestring would give a speed boost. But then I was doing
numerical stuff, and I don't know much about unicode.

Chad

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


Re: [Haskell-cafe] WebSense doesn't like darcs.haskell.org

2008-05-29 Thread Neil Mitchell
Hi

 I assume/hope this hacking is only in the sense of making adjustments to 
 code.
 Is this right? If there's anything involving DoS attacks, etc, I might never 
 be
 able to get to it from work again.

Yes, darcs.haskell.org won't be hosting DoS attacks ever.

Perhaps the problem is with this document: http://darcs.haskell.org/ghc/HACKING

There are at least 6 branches of that document, and removing them all
would be a fair bit of work. Perhaps you can take a very big clue
stick and beat the WebSense developers until they cry?

I've had a website be incorrectly marked as a phishing site
previously, by Norton, and simply submitting the URL to them using a
web form on their site resulted in it getting put back on the safe
list after a couple of days.

Thanks

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


Re: [Haskell-cafe] Copying Arrays

2008-05-29 Thread Duncan Coutts

On Thu, 2008-05-29 at 11:25 -0700, Bryan O'Sullivan wrote:
 Tom Harper wrote:
 
  Because I'm writing the Unicode-friendly ByteString =p
 
 Perhaps I'm not understanding.  Why wouldn't you use ByteString for I/O,
 even if you're writing a different library?  After all, ByteString's own
 internals use memcpy.

Just to clarify Tom's question...

He's designing a proper Unicode type along the lines of ByteString.
However it does not use a ByteString underneath so we cannot re-use the
IO operations from ByteString, though obviously we can steal ideas.

The reason we do not want to re-use ByteString as the underlying
representation is because they're not good for short strings and we
expect that for Unicode text (more than arbitrary blobs of binary data)
people will want efficient short strings.

So instead of using a ForeignPtr to pinned heap memory (read: slow
allocation, lots of fragmentation) we're looking at using unpinned heap
arrays. So that means MutableByteArr# (or STUArray for the first
prototype).

We cannot use memcpy because it operates on raw pointers but that's no
good for a movable heap object like a ByteArr#.

So that's the background to the question.

I think the answer is either that there's a primitive to do this copying
in the GHC.* libs or we'll need to add one.

Duncan

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


Re: [Haskell-cafe] WebSense doesn't like darcs.haskell.org

2008-05-29 Thread Duncan Coutts

On Thu, 2008-05-29 at 18:12 +, Chad Scherrer wrote:
 My work uses WebSense to filter viewable pages - I don't have an option.
 
 I used to be able to get to darcs.haskell.org just fine, but apparently a
 /hacking directory was added somewhere, so WebSense put it on the naughty 
 list.

Do you know where?

[EMAIL PROTECTED]:~$ locate hacking

There are some hits in /usr/share/doc but they're not on any of the
websites that monk serves.

Duncan

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


Re: [Haskell-cafe] Re: Copying Arrays

2008-05-29 Thread Jed Brown
On Thu 2008-05-29 18:45, Chad Scherrer wrote:
 Jed Brown jed at 59A2.org writes:
  Uh, ByteString is Unicode-agnostic.  ByteString.Char8 is not.  So why not 
  do IO
  with lazy ByteString and parse into your own representation (which might 
  look a
  lot like StorableVector)?
 
 One problem you might run into doing it this way is if a wide character is 
 split
 between two different arrays. In that case you have to do some post-porcessing
 to put the pieces back together. More efficient, I think, if you could force a
 given alignment when reading in the lazy bytestring. But there's not a way to 
 do
 that, is there?

Unless you are reading UTF-32, you won't know what alignment you want until you
get there.  If I remember correctly, the default block size is nicely aligned so
that in practice you shouldn't have to worry about a chunk ending with weird
alignment.  However, such alignment issues shouldn't affect you unless you are
using the internal interface.  If you want fast indexing, you have to parse one
character at a time anyway so you won't gain anything by unsafe casting (or
memcpy) into your data structure.

Jed


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


Re: [Haskell-cafe] Aren't type system extensions fun? [Further analysis]

2008-05-29 Thread Isaac Dupree

   foo :: (Char - a /\ Bool - b) - (a,b)


a.k.a. find some value that matches both Char-a and Bool-b for some a and b.  Could use type-classes to do it. 



Uhmm... you mean something like (neglecting TC-related issues here)

class C a b where
   fromChar :: Char - a
   fromBool :: Bool - b


Oops: i meant something like

class C x a b | x - a,b where
   fromChar :: x - Char - a
   fromBool :: x - Bool - b


no... let me figure out what I meant.  Just somehow to have a single 
function that takes an argument of two different types without 
completely ignoring it.


class Arg a where
  whatYouPass :: a - Something
instance Arg Char where
  whatYouPass = ...
instance Arg Bool where
  whatYouPass = ...

Then (foo whatYouPass) :: (Something, Something).
Or if it was
class Arg a where
  whatYouPass :: a - a
then (foo whatYouPass) :: (Char, Bool).
And I'm sure there are ways to make the return type different if you 
want to think about FDs etc.





Zun.



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


Re: [Haskell-cafe] WebSense doesn't like darcs.haskell.org

2008-05-29 Thread Neil Mitchell
Hi

 Do you know where?

 [EMAIL PROTECTED]:~$ locate hacking

try locate HACKING

Google has the answer (as always):

http://www.google.co.uk/search?q=allinurl:hacking+site:darcs.haskell.orghl=enfilter=0

Thanks

Neil

PS. Google trivia: switching the allinurl and site arguments around
means it doesn't find anything.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: WebSense doesn't like darcs.haskell.org

2008-05-29 Thread Chad Scherrer
Duncan Coutts duncan.coutts at worc.ox.ac.uk writes:

 On Thu, 2008-05-29 at 18:12 +, Chad Scherrer wrote:
 I used to be able to get to darcs.haskell.org just fine, but apparently a
 /hacking directory was added somewhere, so WebSense put it on the naughty
 list.
 Do you know where?

Neil suggested it might be

http://darcs.haskell.org/ghc/HACKING

but that's been there for a long time, hasn't it? Maybe it's not that a new
directory was added, but that WebSense hadn't ever indexed haskell.org before?

Chad

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


Re: [Haskell-cafe] Damnit, we need a CPAN.

2008-05-29 Thread Duncan Coutts

On Thu, 2008-05-29 at 17:38 +0200, Achim Schneider wrote:
 No, wait, there's cabal-install. And it doesn't even depend on 20+
 packages I'd have to install manually. My day, for now, is saved, at
 least if portage installs it without hesitation.
 
 Ah, there it is: 
  Compiling source
  in /var/tmp/portage/dev-haskell/cabal-darcs-0/work/cabal-darcs-0 ...
  * Bootstrapping Cabal...
 
 no location info: can't find file: Setup.lhs
  *
  * ERROR: dev-haskell/cabal-darcs-0 failed.

The ebuild for the darcs version of Cabal it out of date. This happens
frequently with *-darcs ebuilds because upstream changes.

 http://hackage.haskell.org/packages/archive/cabal-install/0.4.0/cabal-install-0.4.0.tar.gz

This version is unfortunately far far too old. I cannot upload a new
version to hackage until I release Cabal-1.4 which it depends on.
Fortunately I'll be releasing both soonish and in the mean time you can
try the darcs versions or the pre-release tarballs from a few weeks ago.


 Building works, installing too, but registering fails: the Makefile
 does not seem to like --user:
 
 % runhaskell Setup.lhs register --user
 -=-= Cabal executing: make register=-=-
 cat config/wxcore.pkg | sed -e
 s|\${wxhlibdir}|/home/ksf/cabal-inst/lib| | ghc-pkg update - Reading
 package info from stdin ... done. WARNING: unversioned dependencies are
 deprecated, and will NOT be accepted by GHC 6.10: base haskell98 Unable
 to rename /usr/lib64/ghc-6.8.2/package.conf to
 /usr/lib64/ghc-6.8.2/package.conf.old Saving old package config
 file... ghc-pkg.bin: /usr/lib64/ghc-6.8.2/package.conf: renameFile:
 permission denied (Permission denied)

The wx package seems to be broken. It is registering directly with
ghc-pkg and not respecting the --user flag. This is because it uses make
rather than the build infrastructure that Cabal provides. Not that I can
blame it for that, it's a pretty complex package and Cabal doesn't yet
provide all the features it needs. Gtk2Hs is not cabalised yet either.

 Just a second... 
 # emerge wxhaskell -pv
 
 These are the packages that would be merged, in order:
 
 Calculating dependencies... done!
 [ebuild UD] dev-lang/ghc-6.4.2 [6.8.2] USE=X%* doc opengl%*
 -binary -ghcbootstrap -openal% -test%(-bash-completion%) 0 kB [0=1]
 [ebuild  N] dev-haskell/wxhaskell-0.9.4  USE=doc 0 kB
 
 
 In other words: No way. The only program that touches anything in /usr/
 is portage.

It's trying to downgrade ghc because the version of wxhaskell in portage
only works with ghc-6.4.2 and not 6.6 or 6.8.

 Rationale: We need a CPAN, a cabal that is smart enough to know what to
 to, even if building depends on make, grapefruit authors that commit
 to hackage, a cabal-inst that can install from darcs (or at least from
 a local directory)

It can build from a local directory. Being able to build from darcs is
possible in principle but we've not implemented it yet.

 , or maybe just a make-replacement for haskell, like
 java has with ant (which is really cool if you successfully do not
 notice the xml-syntax).

We're doing something like that as a Google Summer of Code project this
summer.

 I would already shut up if there were an ebuild generator, but then I'm
 not that egoistic ;)

There is. It's called hackport. We use it to generate most of the 100's
of Haskell ebuilds that you find in the haskell overlay.


So I fully appreciate this packaging stuff is sometimes frustrating. I
hope you appreciate that it is actually improving.

BTW, if you have specific bugs to report in Cabal, cabal-install or
hackage (ie hackage itself, not problems with packages in hackage) then
please do report them in our bug tracker:
http://hackage.haskell.org/trac/hackage/

You'll also find links there to the darcs versions of Cabal and
cabal-install if you want to play with them.

Duncan

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


Re[2]: [Haskell-cafe] Copying Arrays

2008-05-29 Thread Bulat Ziganshin
Hello Duncan,

Thursday, May 29, 2008, 10:57:02 PM, you wrote:

 We cannot use memcpy because it operates on raw pointers but that's no
 good for a movable heap object like a ByteArr#.

it's false assumption - memcpy is used for copying non-pinned arrays
as in the code from Data.Array.Base i've citated. the idea is that
GC shouldn't occur between getting array address and actual memcpy
call. you may consult Simon Marlow

-- 
Best regards,
 Bulatmailto:[EMAIL PROTECTED]

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


Re: [Haskell-cafe] ambiguous constraint errors

2008-05-29 Thread Evan Laforge
 get_int sym = fmap ambi_int (lookup sym ambi_table :: Maybe (Ambi Maybe))

 Of you and the type system you're the only one who knows that that value is
 not used. The type system doesn't use (all) the rules you have in your mind.
 It follows more simple ones.

 You judge by values, not only types here. That is, you look at the value of
 ambi_int and see that it's just 10 in your (value again) some_ambi. You see
 that it's not

 ambi_int = (some_return_from_monad ambi_monad) * 3

I'm not totally understanding, but I think you're saying that I could
write ambi_int in a way that it still had type Ambi m - Int but
depended on the type of 'm'.  I guess that makes sense, because it
could run m internally and return an Int based on the result, which
therefore depends on the type of 'm'.

 Also compare with this

 x :: Int
 x = Five

 main = putStrLn Hello

 This program doesn't use x, so the type error would definitely not bother us
 at run-time. But it's nevertheless not ignored.

Sure, my intuition has much less trouble with that one.  It's off
topic, but I wonder if there's lazy equivalent for type checkers.
I.e. at the value level I could call it 'undefined' which works with
any type (since all types include _|_ I guess), and as long as it's
not evaluated, there's no problem at runtime.  A type level equivalent
could have a type bottom which represents a type checking failure,
but it only affects the results of type functions if they demand it.

I guess a more appealing direction is to try to make the value system
total, not make the type system partial :)
And it might destroy separate compilation.

 I've been told this doesn't mean what I expect it to, which is that
 the context constraints propagate up to and unify with the containing
 type (out of curiosity, since it's accepted, what *does* this do?  I
 think I read it somewhere once, but now I forget and can't find it).
 And sure enough, using this type doesn't make my type declarations
 have the right contexts.

 Well it means that you can't call any data constructor of this type with
 arguments not satisfying those constraints. Effectively it means that you
 won't ever have a value of type (Command some m) in your program where the
 pair (some,m) doesn't satisfy them.

 However, the type system won't leverage that fact. And when you use a value
 of type Command some m somewhere you have to repeat the constraints.

 afaik it is officially considered a Haskell mis-feature.

Interesting.  Are there any valid uses for data context?  If not, is
it slated for removal?

 Maybe something like

 class MyAlias t1 t2 ...

 instance (Monad some, Monad m, ...) = MyAlias some m ...

I see, so sort of like using classes as class aliases which can
reduce the amount of junk in the context.  I think I've seen that
convention in use before.


[ isaac dupree ]

 with {-# LANGUAGE GADTs #-} you should be able to use a different syntax for
 the same sort of thing but with the meaning you wanted:  (beware of layout
 messed up by e-mail line wrapping) :
 data Command some m where
  Command :: (Monad some, Monad m) = some (State.StateT () m Status) -
 Command some m

Interesting, I'll have to try that out.

 It's a really annoying problem!  The multi-param-type-class hack Daniil
 Elovkov mentioned is another way it's done sometimes, that also uses a few
 compiler extensions.  CPP macros are even uglier but they can work too.

I guess I'll just type them out explicitly, and add automatic context
propagation to my ghc wishlist, along with records and
srcloc_annotate, and other random stuff.

I'm not even sure what such a feature would look like, or if it would
be feasible though...


Thanks for the pointers!
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ambiguous constraint errors

2008-05-29 Thread Isaac Dupree

Evan Laforge wrote:

get_int sym = fmap ambi_int (lookup sym ambi_table :: Maybe (Ambi Maybe))

Of you and the type system you're the only one who knows that that value is
not used. The type system doesn't use (all) the rules you have in your mind.
It follows more simple ones.

You judge by values, not only types here. That is, you look at the value of
ambi_int and see that it's just 10 in your (value again) some_ambi. You see
that it's not

ambi_int = (some_return_from_monad ambi_monad) * 3


I'm not totally understanding, but I think you're saying that I could
write ambi_int in a way that it still had type Ambi m - Int but
depended on the type of 'm'.  I guess that makes sense, because it
could run m internally and return an Int based on the result, which
therefore depends on the type of 'm'.


It's more obvious with other type classes.

e.g. the snd of a value of type
(Num a) = (a, Bool)

Because what if the record/tuple was:
canOverflow = (ridiculous, ridiculous = 40)
  ridiculous = 40 ^ 5

Then it depends on whether you pick Int or Integer (or something else) 
for a, even if you only look at the Bool.



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


Re: [Haskell-cafe] Copying Arrays

2008-05-29 Thread Don Stewart
duncan.coutts:
 
 On Thu, 2008-05-29 at 11:25 -0700, Bryan O'Sullivan wrote:
  Tom Harper wrote:
  
   Because I'm writing the Unicode-friendly ByteString =p
  
  Perhaps I'm not understanding.  Why wouldn't you use ByteString for I/O,
  even if you're writing a different library?  After all, ByteString's own
  internals use memcpy.
 
 Just to clarify Tom's question...
 
 He's designing a proper Unicode type along the lines of ByteString.
 However it does not use a ByteString underneath so we cannot re-use the
 IO operations from ByteString, though obviously we can steal ideas.
 
 The reason we do not want to re-use ByteString as the underlying
 representation is because they're not good for short strings and we
 expect that for Unicode text (more than arbitrary blobs of binary data)
 people will want efficient short strings.
 
 So instead of using a ForeignPtr to pinned heap memory (read: slow
 allocation, lots of fragmentation) we're looking at using unpinned heap
 arrays. So that means MutableByteArr# (or STUArray for the first
 prototype).
 
 We cannot use memcpy because it operates on raw pointers but that's no
 good for a movable heap object like a ByteArr#.
 
 So that's the background to the question.
 
 I think the answer is either that there's a primitive to do this copying
 in the GHC.* libs or we'll need to add one.

There are these guys,

foreign import ccall unsafe __hscore_memcpy_dst_off
   memcpy_baoff_ba :: RawBuffer - CInt - RawBuffer - CSize - IO (Ptr ())

foreign import ccall unsafe __hscore_memcpy_dst_off
  memcpy_baoff_ptr :: RawBuffer - CInt - Ptr a - CSize - IO (Ptr ())

type RawBuffer = MutableByteArray# RealWorld
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Damnit, we need a CPAN.

2008-05-29 Thread Thomas Hartman
I've been playing a lot with searchpath lately, for doing happs
quickstart installation as described on happs.org.

Searchpath works great when it works, which usually means -- when the
module map file is up to date and pointing everywhere to the right
place.

When the module map file is out of date though, the error messages for
missing dependencies that you would get from searchpath are not as
good as the error messages you'd get from a cabal configure.

Case in point, from #happs irc chat today

18:09:44thomahartman1 ~/MyProjectsp ghc -isrc src/Main.hs --make 
--run 
18:10:16Lemmih?
18:10:19thomahartman1 
/home/thartman/.SearchPath/HAppS/State/Spread.hs:18:17:
18:10:20thomahartman1 Could not find module
`Control.Concurrent.Chan.Closeable':
18:10:20thomahartman1 Use -v to see a list of the files searched for.
18:10:30thomahartman1 something need to be pushed?
18:10:30LemmihInstall hspread.
18:11:06LemmihCabal tells you these sorts of things.
18:11:19Lemmihsp doesn't really keep track of dependencies.

thomas.

2008/5/29 Darrin Thompson [EMAIL PROTECTED]:
 On Thu, May 29, 2008 at 11:47 AM, Neil Mitchell [EMAIL PROTECTED] wrote:
, a cabal-inst that can install from darcs (or at least from
 a local directory)

 Yes, that would be lovely!


 While we're on the subject, why does searchpath get as little
 attention as it does? It seems to work reasonably well for HAppS.

 --
 Darrin
 ___
 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] Question on type synonym definition and language extensions

2008-05-29 Thread Olivier Boudry
Hi all,

I'm trying to define a type synonym for 2D MArray instances. The goal is to
keep the function signature simple and readable using type `Matrix` instead
of something like `(Ix i, MArray a e m) = m (a i e)`.

After some read, guess, try, error cycles I came up with this:

type Matrix = forall m. forall a. forall i. forall n. (Ix i, MArray a n
m, Num i, Num n) = m (a (i,i) n)

it requires option -XRank2Types to work. But then I can write my function
as:

test :: Matrix
test = do { a - newArray ((0,0),(5,8)) 0; writeArray a (0,0) 1; return
a }

Then I wanted to be able to give the Index and Value types in the type
synonym but keep it flexible in terms of which MArray instance is used. I
changed it to:

type Matrix i n = forall m. forall a. (MArray a n m) = m (a (i,i) n)

and the type signature of the test function becomes:

test :: Matrix Int Double

For this one I had to add an extra -XFlexibleContexts option to build it.

It works and I'm quite happy with the look of my new function type
signatures, but I'm just wondering if I'm doing something bad or if there is
a cleaner/simpler way to define the same type synonym without requiring
language extensions. What are the risks associated with using these two
language extensions, non compatibility with other compilers or more?

Thanks,

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


Re: [Haskell-cafe] is there some book about haskell and data struct and alg?

2008-05-29 Thread John Melesky
Looks like Okasaki moved it over when he relocated to the US Military  
Academy:


http://www.eecs.usma.edu/webs/people/okasaki/pfds-haskell.tar.gz

I've fixed it on the wiki.

-johnnn


On May 29, 2008, at 3:56 AM, Henk-Jan van Tuyl wrote:

On Thu, 29 May 2008 05:11:54 +0200, Benjamin L. Russell [EMAIL PROTECTED] 
 wrote:


Although all the source code for the pdf version (http://www.cs.cmu.edu/~rwh/theses/okasaki.pdf 
) of Purely Functional Data Structures is provided in Standard  
ML, not Haskell, I found a broken link to the supposedly equivalent  
Haskell source code on Books - HaskellWiki (http://haskell.org/haskellwiki/Books 
):


Haskell source code for the book:
http://www.cs.columbia.edu/~cdo/pfds-haskell.tar.gz

Clicking on this link results in the following error:

[...]


Without the equivalent Haskell source code, the code must be  
manually translated from Standard ML into Haskell.  Does anybody  
know why the link is broken, when it may be fixed, and from where  
the Haskell source code can be currently obtained?


It appears that http://www.cs.columbia.edu/~cdo/ does not exist  
anymore; probably because the owner does not study/work at the  
university anymore. I fixed the link, it now points to the copy  
stored in the Wayback Machine ( http://web.archive.org/ ).

The new link is:
 http://web.archive.org/web/2818044004/http:// 
www.cs.columbia.edu/~cdo/pfds-haskell.tar.gz


--
Met vriendelijke groet,
Henk-Jan van Tuyl


--
http://functor.bamikanarie.com
http://Van.Tuyl.eu/
--


___
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] Question on type synonym definition and language extensions

2008-05-29 Thread Henning Thielemann


On Thu, 29 May 2008, Olivier Boudry wrote:


Hi all,

I'm trying to define a type synonym for 2D MArray instances. The goal is to
keep the function signature simple and readable using type `Matrix` instead
of something like `(Ix i, MArray a e m) = m (a i e)`.

After some read, guess, try, error cycles I came up with this:

   type Matrix = forall m. forall a. forall i. forall n. (Ix i, MArray a n m, Num 
i, Num n) = m (a (i,i) n)



Is

 type Matrix monad array num = monad (array (Int,Int) num)

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


Re: [Haskell-cafe] WebSense doesn't like darcs.haskell.org

2008-05-29 Thread Magnus Therning
Chad Scherrer wrote:
 My work uses WebSense to filter viewable pages - I don't have an option.

 I used to be able to get to darcs.haskell.org just fine, but apparently a
 /hacking directory was added somewhere, so WebSense put it on the naughty 
 list.

 I put in a request for WebSense to review the site; hopefully it will soon be
 allowed again. But if not, I'll have to go through lots of red tape, which I'd
 really like to avoid.

 I assume/hope this hacking is only in the sense of making adjustments to 
 code.
 Is this right? If there's anything involving DoS attacks, etc, I might never 
 be
 able to get to it from work again.

 I get the impression WebSense is relatively widely used. Is anyone else here
 having similar trouble?
Oh my goodness.  Please tell me WebSense isn't _that_ stupid!  As if any
person who's serious about actually carrying out cyber attacks would
store things in a directory named hacking...  WTF, no wonder it feels
like we're losing when the good guys assume the bad guys have an
intelligence comparable to the average vegetable.

Sorry for the outburst, this sort of brain dead security just really
upsets me.

/M

-- 
Magnus Therning (OpenPGP: 0xAB4DFBA4)
magnus@therning.org Jabber: magnus.therning@gmail.com
http://therning.org/magnus

What if I don't want to obey the laws? Do they throw me in jail with
the other bad monads?
 -- Daveman




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] Damnit, we need a CPAN.

2008-05-29 Thread Darrin Thompson
On Thu, May 29, 2008 at 4:31 PM, Thomas Hartman [EMAIL PROTECTED] wrote:
 I've been playing a lot with searchpath lately, for doing happs
 quickstart installation as described on happs.org.

 Searchpath works great when it works, which usually means -- when the
 module map file is up to date and pointing everywhere to the right
 place.

 When the module map file is out of date though, the error messages for
 missing dependencies that you would get from searchpath are not as
 good as the error messages you'd get from a cabal configure.


Makes me wonder if searchpath and a good module map file wouldn't be a
good way to bootstrap cabal-install.

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


Re: [Haskell-cafe] Question on type synonym definition and language extensions

2008-05-29 Thread Olivier Boudry
On Thu, May 29, 2008 at 4:38 PM, Henning Thielemann 
[EMAIL PROTECTED] wrote:

 Is

  type Matrix monad array num = monad (array (Int,Int) num)

 ok for you?


Not really what I was looking for but I may end up using it.

What I wanted is to hide the Monad and Array and have it inferred from the
context of the array

STArray or STUArray when run in the ST monad with runST(U)Array, IOArray or
IOUArray when used in the IO monad, etc...

I'm not sure it's the right thing to do. I may create more troubles than I
solve. I was just trying to keep things as generic as possible.

Thanks for your reply,

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


Re: [Haskell-cafe] Damnit, we need a CPAN.

2008-05-29 Thread Sterling Clover
And who bootstraps the searchpath?

--S

On Thu, May 29, 2008 at 4:50 PM, Darrin Thompson [EMAIL PROTECTED] wrote:

 On Thu, May 29, 2008 at 4:31 PM, Thomas Hartman [EMAIL PROTECTED]
 wrote:
  I've been playing a lot with searchpath lately, for doing happs
  quickstart installation as described on happs.org.
 
  Searchpath works great when it works, which usually means -- when the
  module map file is up to date and pointing everywhere to the right
  place.
 
  When the module map file is out of date though, the error messages for
  missing dependencies that you would get from searchpath are not as
  good as the error messages you'd get from a cabal configure.
 

 Makes me wonder if searchpath and a good module map file wouldn't be a
 good way to bootstrap cabal-install.

 --
 Darrin
 ___
 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] zlib, missing zlib.h

2008-05-29 Thread Thomas Hartman
Tried to install

http://hackage.haskell.org/cgi-bin/hackage-scripts/package/zlib

which is required for

http://darcs.haskell.org/cabal-branches/cabal-1.4

which is required for cabal-install.

Got the following error. apt-get installed zlibc on a stab in the
dark, but same result. advice?

[EMAIL 
PROTECTED]:~/haskellInstalls/smallInstalls/cabal-install/zlib-0.4.0.4runghc
Setup.hs configure
Configuring zlib-0.4.0.4...

[EMAIL 
PROTECTED]:~/haskellInstalls/smallInstalls/cabal-install/zlib-0.4.0.4runghc
Setup.hs build out

[EMAIL 
PROTECTED]:~/haskellInstalls/smallInstalls/cabal-install/zlib-0.4.0.4head
out
Preprocessing library zlib-0.4.0.4...

Stream.hsc:74:18:  error: zlib.h: No such file or directory
Stream.hsc: In function 'main':

Stream.hsc:254:0:
 error: 'z_stream' undeclared (first use in this function)

Stream.hsc:254:0:
 error: (Each undeclared identifier is reported only once
[EMAIL PROTECTED]:~/haskellInstalls/smallInstalls/cabal-install/zlib-0.4.0.4
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] zlib, missing zlib.h

2008-05-29 Thread Don Stewart
You need to install the C zlib library.

Cabal is currently unable to warn about missing C library dependencies,
but they manifest as undeclared identifiers in .hsc files when that's
the case.

-- Don

tphyahoo:
 Tried to install
 
 http://hackage.haskell.org/cgi-bin/hackage-scripts/package/zlib
 
 which is required for
 
 http://darcs.haskell.org/cabal-branches/cabal-1.4
 
 which is required for cabal-install.
 
 Got the following error. apt-get installed zlibc on a stab in the
 dark, but same result. advice?
 
 [EMAIL 
 PROTECTED]:~/haskellInstalls/smallInstalls/cabal-install/zlib-0.4.0.4runghc
 Setup.hs configure
 Configuring zlib-0.4.0.4...
 
 [EMAIL 
 PROTECTED]:~/haskellInstalls/smallInstalls/cabal-install/zlib-0.4.0.4runghc
 Setup.hs build out
 
 [EMAIL 
 PROTECTED]:~/haskellInstalls/smallInstalls/cabal-install/zlib-0.4.0.4head
 out
 Preprocessing library zlib-0.4.0.4...
 
 Stream.hsc:74:18:  error: zlib.h: No such file or directory
 Stream.hsc: In function 'main':
 
 Stream.hsc:254:0:
  error: 'z_stream' undeclared (first use in this function)
 
 Stream.hsc:254:0:
  error: (Each undeclared identifier is reported only once
 [EMAIL PROTECTED]:~/haskellInstalls/smallInstalls/cabal-install/zlib-0.4.0.4
 ___
 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] zlib, missing zlib.h

2008-05-29 Thread Marc Weber
On Thu, May 29, 2008 at 03:51:56PM -0700, Thomas Hartman wrote:

echoextra-lib-dirs: ${zlib}/lib  zlib.cabal
echoinclude-dirs: ${zlib}/include  zlib.cabal'';
Try patching the cabal file using something like that.

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


Re: [Haskell-cafe] zlib, missing zlib.h

2008-05-29 Thread Duncan Coutts

On Fri, 2008-05-30 at 01:10 +0200, Marc Weber wrote:
 On Thu, May 29, 2008 at 03:51:56PM -0700, Thomas Hartman wrote:
 
 echoextra-lib-dirs: ${zlib}/lib  zlib.cabal
 echoinclude-dirs: ${zlib}/include  zlib.cabal'';
 Try patching the cabal file using something like that.

Actually the .cabal file is fine, the machine is probably just missing
zlib.h which is in zlib-devel on debian based systems.

As don says, Cabal does not currently check that all required .h files
and C libs are available at configure time so you bump into them as
compile or linker errors. Obviously it should check for these things at
configure time and produce more helpful explanations. If anyone wants to
implement that for us that'd be a great service. The ticket is here:
http://hackage.haskell.org/trac/hackage/ticket/262

Duncan

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


Re: [Haskell-cafe] Question on type synonym definition and language extensions

2008-05-29 Thread Antoine Latter
2008/5/29 Olivier Boudry [EMAIL PROTECTED]:
 After some read, guess, try, error cycles I came up with this:

 type Matrix = forall m. forall a. forall i. forall n. (Ix i, MArray a n
 m, Num i, Num n) = m (a (i,i) n)

I've tried similar things before.  You may run into subtle problems later.

Such as:

 transpose :: Matrix - Matrix

won't expand into the type signature you want it to, I think.

You probably want that to be equivalent to:

transpose ::  forall m. forall a. forall i. forall n. (Ix i, MArray a
n m, Num i, Num n) = m (a (i,i) n) - m (a (i,i) n)

But you'll get:

transpose ::  forall m. forall a. forall i. forall n. (Ix i, MArray a
n m, Num i, Num n) = Matrix - m (a (i,i) n)

which means that the first argument must be a polymorphic value, which
isn't very useful.

-Antoine





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


[Haskell-cafe] test driving cabal install... cabal install and normal install (runghc Setup) don't mix... two package.conf files...

2008-05-29 Thread Thomas Hartman
After a little drama with zlib, I managed to get cabal-install installed.

I then attempted to do

cabal install HAppS-Server

since this is a module with a lot of dependencies, and in rapid
development flux, so perenially painful for me to install.

The result is that I managed to install everything up to HAppS-State,
which I think is the last dependency, but then seemed to hang
indefinitely in the middle of installing HAppS-Server at the end.

OK, I thought, then perhaps I can do normal runghc Setup.hs after
downloading and unzipping the tar from

http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HAppS-Server-0.9.2.1

However, this resulted in error

[EMAIL PROTECTED]:~/haskellInstalls/smallInstalls/HAppS-Server-0.9.2.1runghc
Setup.hs configure
...
Setup.hs: At least the following dependencies are missing:
HAppS-Data =0.9.2...

Strange, because I had just installed that module via cabal-install,
and I could load it in ghci with :m +HappS.Data.

I then ran ghc-pkg and got this strange result that my packages were
broken into two different files. Is this by design?

ghc-pkg list
/usr/local/lib/ghc-6.8.2/package.conf:
Cabal-1.2.3.0, Cabal-1.3.11, Cabal-1.5.2, DeepArrow-0.2,

/home/thartman/.ghc/i386-linux-6.8.2/package.conf:
HAppS-Data-0.9.2.1, HAppS-IxSet-0.9.2.1, HAppS-State-0.9.2.1,


I am curious if anybody else is able to install HAppS-Server using
cabal install, and whether they can shed any light on the other isuses
I raised.

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


Re: [Haskell-cafe] test driving cabal install... cabal install and normal install (runghc Setup) don't mix... two package.conf files...

2008-05-29 Thread Daniel Patterson
I think you need to install HAppS-Data etc globally... I'm not sure why
locally installed (ie, only your user) packages wouldn't be picked up by runghc
Setup.hs'ing, but if they are install system wide it should definitely work.

I think it is cabal --global install foo

On Thu, 29 May 2008 18:11:04 -0700
Thomas Hartman [EMAIL PROTECTED] wrote:

 After a little drama with zlib, I managed to get cabal-install installed.
 
 I then attempted to do
 
 cabal install HAppS-Server
 
 since this is a module with a lot of dependencies, and in rapid
 development flux, so perenially painful for me to install.
 
 The result is that I managed to install everything up to HAppS-State,
 which I think is the last dependency, but then seemed to hang
 indefinitely in the middle of installing HAppS-Server at the end.
 
 OK, I thought, then perhaps I can do normal runghc Setup.hs after
 downloading and unzipping the tar from
 
 http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HAppS-Server-0.9.2.1
 
 However, this resulted in error
 
 [EMAIL PROTECTED]:~/haskellInstalls/smallInstalls/HAppS-Server-0.9.2.1runghc
 Setup.hs configure
 ...
 Setup.hs: At least the following dependencies are missing:
 HAppS-Data =0.9.2...
 
 Strange, because I had just installed that module via cabal-install,
 and I could load it in ghci with :m +HappS.Data.
 
 I then ran ghc-pkg and got this strange result that my packages were
 broken into two different files. Is this by design?
 
 ghc-pkg list
 /usr/local/lib/ghc-6.8.2/package.conf:
 Cabal-1.2.3.0, Cabal-1.3.11, Cabal-1.5.2, DeepArrow-0.2,
 
 /home/thartman/.ghc/i386-linux-6.8.2/package.conf:
 HAppS-Data-0.9.2.1, HAppS-IxSet-0.9.2.1, HAppS-State-0.9.2.1,
 
 
 I am curious if anybody else is able to install HAppS-Server using
 cabal install, and whether they can shed any light on the other isuses
 I raised.
 
 Thomas.
 ___
 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] Question on type synonym definition and language extensions

2008-05-29 Thread Olivier Boudry
On Thu, May 29, 2008 at 7:36 PM, Antoine Latter [EMAIL PROTECTED] wrote:

 I've tried similar things before.  You may run into subtle problems later.

 Such as:

  transpose :: Matrix - Matrix

 won't expand into the type signature you want it to, I think.

 You probably want that to be equivalent to:

 transpose ::  forall m. forall a. forall i. forall n. (Ix i, MArray a
 n m, Num i, Num n) = m (a (i,i) n) - m (a (i,i) n)

 But you'll get:

 transpose ::  forall m. forall a. forall i. forall n. (Ix i, MArray a
 n m, Num i, Num n) = Matrix - m (a (i,i) n)

 which means that the first argument must be a polymorphic value, which
 isn't very useful.


Right, this is exactly what I'm getting when creating a transpose function:

*Main :t transpose
transpose :: (MArray a Double m) = Matrix Int Double - m (a (Int, Int)
Double)

Thanks for sharing your experience. I'll try to stay out of the subtle bugs
and keep it verbose but simple.

Regards,

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


Re: [Haskell-cafe] test driving cabal install... cabal install and normal install (runghc Setup) don't mix... two package.conf files...

2008-05-29 Thread Thomas Hartman
I see. I had done

sudo cabal install HAppS-Server

but this just installed with root ownership in my home directory.

I'm now trying with

sudo cabal install --global HAppS-Server


2008/5/29 Daniel Patterson [EMAIL PROTECTED]:
 I think you need to install HAppS-Data etc globally... I'm not sure why
 locally installed (ie, only your user) packages wouldn't be picked up by 
 runghc
 Setup.hs'ing, but if they are install system wide it should definitely work.

 I think it is cabal --global install foo

 On Thu, 29 May 2008 18:11:04 -0700
 Thomas Hartman [EMAIL PROTECTED] wrote:

 After a little drama with zlib, I managed to get cabal-install installed.

 I then attempted to do

 cabal install HAppS-Server

 since this is a module with a lot of dependencies, and in rapid
 development flux, so perenially painful for me to install.

 The result is that I managed to install everything up to HAppS-State,
 which I think is the last dependency, but then seemed to hang
 indefinitely in the middle of installing HAppS-Server at the end.

 OK, I thought, then perhaps I can do normal runghc Setup.hs after
 downloading and unzipping the tar from

 http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HAppS-Server-0.9.2.1

 However, this resulted in error

 [EMAIL PROTECTED]:~/haskellInstalls/smallInstalls/HAppS-Server-0.9.2.1runghc
 Setup.hs configure
 ...
 Setup.hs: At least the following dependencies are missing:
 HAppS-Data =0.9.2...

 Strange, because I had just installed that module via cabal-install,
 and I could load it in ghci with :m +HappS.Data.

 I then ran ghc-pkg and got this strange result that my packages were
 broken into two different files. Is this by design?

 ghc-pkg list
 /usr/local/lib/ghc-6.8.2/package.conf:
 Cabal-1.2.3.0, Cabal-1.3.11, Cabal-1.5.2, DeepArrow-0.2,
 
 /home/thartman/.ghc/i386-linux-6.8.2/package.conf:
 HAppS-Data-0.9.2.1, HAppS-IxSet-0.9.2.1, HAppS-State-0.9.2.1,


 I am curious if anybody else is able to install HAppS-Server using
 cabal install, and whether they can shed any light on the other isuses
 I raised.

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

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


Re: [Haskell-cafe] ambiguous constraint errors

2008-05-29 Thread Ryan Ingram
On 5/28/08, Evan Laforge [EMAIL PROTECTED] wrote:
 I have two related questions:

 #1

 I'm getting some annoying type errors that I don't fully understand,
 and wind up having to do a workaround that I don't totally like.
 Here's a simplified version of my situation:

 data Ambi m = Ambi {
ambi_monad :: m Int
, ambi_int :: Int
}

 some_ambi :: Monad m = Ambi m
 some_ambi = Ambi (return 5) 10

 ambi_table :: Monad m = [(String, Ambi m)]
 ambi_table = [(default, some_ambi)]

 get_int :: String - Maybe Int
 get_int sym = fmap ambi_int (lookup sym ambi_table)

 ---

 get_int produces:
Ambiguous type variable `m' in the constraint:
  `Monad m' arising from a use of `ambi_table' at ambi.hs:13:40-49

You can let the caller choose m:

get_int :: Monad m = m () - String - Maybe Int
get_int _ sym = fmap ambi_int (lookup sym ambi_table)

which can be called like so:

get_int (error shouldn't evaluate :: IO ()) test
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] test driving cabal install... cabal install and normal install (runghc Setup) don't mix... two package.conf files...

2008-05-29 Thread Thomas Hartman
By the way, it just finally finished.

I still think it took way too long.

thomas.

2008/5/29 Thomas Hartman [EMAIL PROTECTED]:
 I see. I had done

 sudo cabal install HAppS-Server

 but this just installed with root ownership in my home directory.

 I'm now trying with

 sudo cabal install --global HAppS-Server


 2008/5/29 Daniel Patterson [EMAIL PROTECTED]:
 I think you need to install HAppS-Data etc globally... I'm not sure why
 locally installed (ie, only your user) packages wouldn't be picked up by 
 runghc
 Setup.hs'ing, but if they are install system wide it should definitely work.

 I think it is cabal --global install foo

 On Thu, 29 May 2008 18:11:04 -0700
 Thomas Hartman [EMAIL PROTECTED] wrote:

 After a little drama with zlib, I managed to get cabal-install installed.

 I then attempted to do

 cabal install HAppS-Server

 since this is a module with a lot of dependencies, and in rapid
 development flux, so perenially painful for me to install.

 The result is that I managed to install everything up to HAppS-State,
 which I think is the last dependency, but then seemed to hang
 indefinitely in the middle of installing HAppS-Server at the end.

 OK, I thought, then perhaps I can do normal runghc Setup.hs after
 downloading and unzipping the tar from

 http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HAppS-Server-0.9.2.1

 However, this resulted in error

 [EMAIL 
 PROTECTED]:~/haskellInstalls/smallInstalls/HAppS-Server-0.9.2.1runghc
 Setup.hs configure
 ...
 Setup.hs: At least the following dependencies are missing:
 HAppS-Data =0.9.2...

 Strange, because I had just installed that module via cabal-install,
 and I could load it in ghci with :m +HappS.Data.

 I then ran ghc-pkg and got this strange result that my packages were
 broken into two different files. Is this by design?

 ghc-pkg list
 /usr/local/lib/ghc-6.8.2/package.conf:
 Cabal-1.2.3.0, Cabal-1.3.11, Cabal-1.5.2, DeepArrow-0.2,
 
 /home/thartman/.ghc/i386-linux-6.8.2/package.conf:
 HAppS-Data-0.9.2.1, HAppS-IxSet-0.9.2.1, HAppS-State-0.9.2.1,


 I am curious if anybody else is able to install HAppS-Server using
 cabal install, and whether they can shed any light on the other isuses
 I raised.

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


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


Re: happs install seems to have become very slow since upgrading cabal Re: [Haskell-cafe] test driving cabal install...

2008-05-29 Thread Thomas Hartman
It did finish, but I still feel like this took too long.

2008/5/29 Thomas Hartman [EMAIL PROTECTED]:
 sudo cabal install --global HAppS-State went fine, and ghc-pkg had
 output on just the one (global) file.

 but sudo cabal install --global HAppS-Server is slooow.

 I finally canceled this and did

 sudo runghc Setup.hs build -v3 with the same result: extremely,
 extremely slow compile.

 It seems to get hung up one one line:

 src/HAppS/Server/Facebook.hs:416:2:
Warning: Defined but not used: `a'
 *** Desugar:
Result size = 52971
 *** Simplify:
Result size = 34350
Result size = 33980
Result size = 33972
Result size = 33972
 *** Specialise:
Result size = 52989
 *** Float out (not lambdas, not constants):
Result size = 55269

 ... and more and more of same. for 15 minutes now. With verbose output
 on at least I can see there is something going on behind the scenes,
 but still.

 I don't remember things taking this long to compile before I upgraded
 to cabal v1.4... cabal bug?

 cabal --version
 cabal-install version 0.4.7
 using version 1.3.11 of the Cabal library

 thomas.





 2008/5/29 Thomas Hartman [EMAIL PROTECTED]:
 I see. I had done

 sudo cabal install HAppS-Server

 but this just installed with root ownership in my home directory.

 I'm now trying with

 sudo cabal install --global HAppS-Server


 2008/5/29 Daniel Patterson [EMAIL PROTECTED]:
 I think you need to install HAppS-Data etc globally... I'm not sure why
 locally installed (ie, only your user) packages wouldn't be picked up by 
 runghc
 Setup.hs'ing, but if they are install system wide it should definitely work.

 I think it is cabal --global install foo

 On Thu, 29 May 2008 18:11:04 -0700
 Thomas Hartman [EMAIL PROTECTED] wrote:

 After a little drama with zlib, I managed to get cabal-install installed.

 I then attempted to do

 cabal install HAppS-Server

 since this is a module with a lot of dependencies, and in rapid
 development flux, so perenially painful for me to install.

 The result is that I managed to install everything up to HAppS-State,
 which I think is the last dependency, but then seemed to hang
 indefinitely in the middle of installing HAppS-Server at the end.

 OK, I thought, then perhaps I can do normal runghc Setup.hs after
 downloading and unzipping the tar from

 http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HAppS-Server-0.9.2.1

 However, this resulted in error

 [EMAIL 
 PROTECTED]:~/haskellInstalls/smallInstalls/HAppS-Server-0.9.2.1runghc
 Setup.hs configure
 ...
 Setup.hs: At least the following dependencies are missing:
 HAppS-Data =0.9.2...

 Strange, because I had just installed that module via cabal-install,
 and I could load it in ghci with :m +HappS.Data.

 I then ran ghc-pkg and got this strange result that my packages were
 broken into two different files. Is this by design?

 ghc-pkg list
 /usr/local/lib/ghc-6.8.2/package.conf:
 Cabal-1.2.3.0, Cabal-1.3.11, Cabal-1.5.2, DeepArrow-0.2,
 
 /home/thartman/.ghc/i386-linux-6.8.2/package.conf:
 HAppS-Data-0.9.2.1, HAppS-IxSet-0.9.2.1, HAppS-State-0.9.2.1,


 I am curious if anybody else is able to install HAppS-Server using
 cabal install, and whether they can shed any light on the other isuses
 I raised.

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



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


Re: [Haskell-cafe] test driving cabal install... cabal install and normal install (runghc Setup) don't mix... two package.conf files...

2008-05-29 Thread Thomas Hartman
mistaske, that last comment should have gone on another thread.

2008/5/29 Thomas Hartman [EMAIL PROTECTED]:
 By the way, it just finally finished.

 I still think it took way too long.

 thomas.

 2008/5/29 Thomas Hartman [EMAIL PROTECTED]:
 I see. I had done

 sudo cabal install HAppS-Server

 but this just installed with root ownership in my home directory.

 I'm now trying with

 sudo cabal install --global HAppS-Server


 2008/5/29 Daniel Patterson [EMAIL PROTECTED]:
 I think you need to install HAppS-Data etc globally... I'm not sure why
 locally installed (ie, only your user) packages wouldn't be picked up by 
 runghc
 Setup.hs'ing, but if they are install system wide it should definitely work.

 I think it is cabal --global install foo

 On Thu, 29 May 2008 18:11:04 -0700
 Thomas Hartman [EMAIL PROTECTED] wrote:

 After a little drama with zlib, I managed to get cabal-install installed.

 I then attempted to do

 cabal install HAppS-Server

 since this is a module with a lot of dependencies, and in rapid
 development flux, so perenially painful for me to install.

 The result is that I managed to install everything up to HAppS-State,
 which I think is the last dependency, but then seemed to hang
 indefinitely in the middle of installing HAppS-Server at the end.

 OK, I thought, then perhaps I can do normal runghc Setup.hs after
 downloading and unzipping the tar from

 http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HAppS-Server-0.9.2.1

 However, this resulted in error

 [EMAIL 
 PROTECTED]:~/haskellInstalls/smallInstalls/HAppS-Server-0.9.2.1runghc
 Setup.hs configure
 ...
 Setup.hs: At least the following dependencies are missing:
 HAppS-Data =0.9.2...

 Strange, because I had just installed that module via cabal-install,
 and I could load it in ghci with :m +HappS.Data.

 I then ran ghc-pkg and got this strange result that my packages were
 broken into two different files. Is this by design?

 ghc-pkg list
 /usr/local/lib/ghc-6.8.2/package.conf:
 Cabal-1.2.3.0, Cabal-1.3.11, Cabal-1.5.2, DeepArrow-0.2,
 
 /home/thartman/.ghc/i386-linux-6.8.2/package.conf:
 HAppS-Data-0.9.2.1, HAppS-IxSet-0.9.2.1, HAppS-State-0.9.2.1,


 I am curious if anybody else is able to install HAppS-Server using
 cabal install, and whether they can shed any light on the other isuses
 I raised.

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



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


Re: [Haskell-cafe] type-level integers using type families

2008-05-29 Thread Manuel M T Chakravarty

Peter Gavin:
Has anyone else tried implementing type-level integers using type  
families?


I tried using a couple of other type level arithmetic libraries  
(including type-level on Hackage) and they felt a bit clumsy to  
use.  I started looking at type families and realized I could pretty  
much build an entire Scheme-like language based on them.


In short, I've got addition, subtraction,  multiplication working  
after just a days worth of hacking. I'm going to post the darcs  
archive sometime, sooner if anyone's interested.


I really like the type-families based approach to this, it's a lot  
easier to understand, and you can think about things functionally  
instead of relationally.  (Switching back and forth between Prolog- 
ish thinking and Haskell gets old quick.) Plus you can do type  
arithmetic directly in place, instead of using type classes  
everywhere.


I am glad to hear that type families work for you.

One thing that I'd like to be able to do is lazy unification on type  
instances, so that things like


data True
data False

type family Cond x y z
type instance Cond True y z = y
type instance Cond False y z = z

will work if the non-taken branch can't be unified with anything.   
Is this planned? Is it even feasible?


I don't think i entirely understand the question.  Do you mean that  
from an equality like


  Cond b Int Bool ~ Int

you want the type checker to infer that (b ~ True)?  This is generally  
not correct reasoning as type families are open; ie, subsequent  
modules might add


  data Bogus
  type instance Bogus y z = Int

and now there are two solutions to (Cond b Int Bool ~ Int).

Manuel

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


Re: [Haskell-cafe] test driving cabal install... cabal install and normal install (runghc Setup) don't mix... two package.conf files...

2008-05-29 Thread Philip Neustrom
Excerpts from Thomas Hartman's message of Thu May 29 18:11:04 -0700 2008:
 After a little drama with zlib, I managed to get cabal-install installed.
 
 I then attempted to do
 
 cabal install HAppS-Server
 
 since this is a module with a lot of dependencies, and in rapid
 development flux, so perenially painful for me to install.
 
 The result is that I managed to install everything up to HAppS-State,
 which I think is the last dependency, but then seemed to hang
 indefinitely in the middle of installing HAppS-Server at the end.
 
 OK, I thought, then perhaps I can do normal runghc Setup.hs after
 downloading and unzipping the tar from
 
 http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HAppS-Server-0.9.2.1
 
 However, this resulted in error
 
 [EMAIL PROTECTED]:~/haskellInstalls/smallInstalls/HAppS-Server-0.9.2.1ru
 nghc
 Setup.hs configure
 ...
 Setup.hs: At least the following dependencies are missing:
 HAppS-Data =0.9.2...
 
 Strange, because I had just installed that module via cabal-install,
 and I could load it in ghci with :m +HappS.Data.
 
 I then ran ghc-pkg and got this strange result that my packages were
 broken into two different files. Is this by design?
 
 ghc-pkg list
 /usr/local/lib/ghc-6.8.2/package.conf:
 Cabal-1.2.3.0, Cabal-1.3.11, Cabal-1.5.2, DeepArrow-0.2,
 
 /home/thartman/.ghc/i386-linux-6.8.2/package.conf:
 HAppS-Data-0.9.2.1, HAppS-IxSet-0.9.2.1, HAppS-State-0.9.2.1,
 
 
 I am curious if anybody else is able to install HAppS-Server using
 cabal install, and whether they can shed any light on the other isuses
 I raised.
 
 Thomas.

I'm having issues trying to get cabal-install (latest darcs) installed, as 
well.  I'm seeing the message:

Hackage/Types.hs:19:29:
Module `Distribution.Version' does not export `Dependency'

which was mentioned on this list earlier.  Updating to the latest darcs Cabal 
doesn't do the trick, it seems:

$ ghc-pkg list
/usr/local/lib/ghc-6.8.2/package.conf:
Cabal-1.3.10, Cabal-1.5.2, ...

I grabbed that 1.3.10 as a tarball snapshot.  The darcs cabal installs 
Cabal-1.5.2, and it seemed that the darcs
cabal-install wanted = 1.3.11   1.5, so I've no idea what to do here :)

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


[Haskell-cafe] reordering pure bindings in monads

2008-05-29 Thread Tim Newsham

Intuitively it seems like the applicative expression:

  (++) $ getLine * getLine

should represent the same thing as the more traditional liftM2 
expressions:


  do { x - getLine; y - getLine; return ((++) x y) }

but it seems to me that you cant directly manipulate the first into
the second.  I get:

  do x2' - getLine
 x1 - return ((++) x2')
 x2 - getLine
 return (x1 x2)

the only way I can get from here to the liftM2 definition is if I
treat x1 - return ((++) x2') as let x1 = (++) x2, and then
allow it to be reordered after the second getLine.  Then it is
straightforward to reduce to the liftM2 expression above.

It seems to me that this is a valid transformation if:
   - no side effects, including pattern match errors, can occur
 in the let (or x1 - return ...).
   - movement doesnt change the dependencies
 - x1 isnt used between the original line and its new position
 - there are no new bindings for x2' introduced between the original
   line and the new line.

Did I overlook anything?  Do any haskell implementations allow rewrites
like these to occur?

Tim Newsham
http://www.thenewsh.com/~newsham/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] WebSense doesn't like darcs.haskell.org

2008-05-29 Thread Benjamin L. Russell



--- On Fri, 5/30/08, Magnus Therning [EMAIL PROTECTED] wrote:

  I used to be able to get to darcs.haskell.org just
 fine, but apparently a
  /hacking directory was added somewhere, so WebSense
 put it on the naughty list.

Heh, unbelievable.  As if the type of hacker interested in DoD attacks 
(properly actually called a cracker, but not a hacker) would put related 
files in a directory actually labelled /hacking.

I'm not a hacker in that sense, but if I were, I would call such a directory 
something innocuous, such as /misc.

Perhaps now we need to consider renaming Hackage 
(http://haskell.org/haskellwiki/Hackage)?  ;-) 

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


Re: [Haskell-cafe] reordering pure bindings in monads

2008-05-29 Thread Dan Doel
On Thursday 29 May 2008, Tim Newsham wrote:
 Intuitively it seems like the applicative expression:

(++) $ getLine * getLine

 should represent the same thing as the more traditional liftM2
 expressions:

do { x - getLine; y - getLine; return ((++) x y) }

 but it seems to me that you cant directly manipulate the first into
 the second.  I get:

do x2' - getLine
   x1 - return ((++) x2')
   x2 - getLine
   return (x1 x2)

 the only way I can get from here to the liftM2 definition is if I
 treat x1 - return ((++) x2') as let x1 = (++) x2, and then
 allow it to be reordered after the second getLine.  Then it is
 straightforward to reduce to the liftM2 expression above.

 It seems to me that this is a valid transformation if:
 - no side effects, including pattern match errors, can occur
   in the let (or x1 - return ...).
 - movement doesnt change the dependencies
   - x1 isnt used between the original line and its new position
   - there are no new bindings for x2' introduced between the original
 line and the new line.

 Did I overlook anything?  Do any haskell implementations allow rewrites
 like these to occur?

Monad laws. Consider the following:

do x - getLine
   f - return ((++) x)
   y - getLine
   return (f y)

  === desugar

getLine = \x - return ((++) x) = \f - getLine = \y - return (f y)

  === return x = f = f x

getLine = \x - (\f - getLine = \y - return (f y)) ((++) x)

  === beta

getLine = \x - getLine = \y - return (x ++ y)

  == resugar

do x - getLine ; y - getLine ; return (x ++ y)

I don't know if GHC does any rewrites based on monad laws (I suspect not), but 
if you want to prove two such expressions equal, they're the ticket.

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


Re: [Haskell-cafe] So how do people pronounce 'cabal' around here?

2008-05-29 Thread Jonathan Cast

On 29 May 2008, at 10:44 AM, Dan Piponi wrote:

On Wed, May 28, 2008 at 6:38 PM, Richard A. O'Keefe  
[EMAIL PROTECTED] wrote:

I've always pronounced it k'BAHL, but was surprised to find that
the OED only countenances a short second syllable:


The reason I originally asked is that American, British and other
dialects of English handle French loanwords differently.


It's not French: http://en.wikipedia.org/wiki/Cabal

jcc

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


Re: [Haskell-cafe] test driving cabal install... cabal install and normal install (runghc Setup) don't mix... two package.conf files...

2008-05-29 Thread Spencer Janssen
On Thu, May 29, 2008 at 06:11:04PM -0700, Thomas Hartman wrote:
 After a little drama with zlib, I managed to get cabal-install installed.
 
 I then attempted to do
 
 cabal install HAppS-Server
 
 since this is a module with a lot of dependencies, and in rapid
 development flux, so perenially painful for me to install.
 
 The result is that I managed to install everything up to HAppS-State,
 which I think is the last dependency, but then seemed to hang
 indefinitely in the middle of installing HAppS-Server at the end.
 
 OK, I thought, then perhaps I can do normal runghc Setup.hs after
 downloading and unzipping the tar from
 
 http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HAppS-Server-0.9.2.1
 
 However, this resulted in error
 
 [EMAIL PROTECTED]:~/haskellInstalls/smallInstalls/HAppS-Server-0.9.2.1runghc
 Setup.hs configure
 ...
 Setup.hs: At least the following dependencies are missing:
 HAppS-Data =0.9.2...
 
 Strange, because I had just installed that module via cabal-install,
 and I could load it in ghci with :m +HappS.Data.

'cabal install' installs packages to your user database by default.  However,
'Setup configure' only uses packages from the global database unless the --user
flag is passed.

 I then ran ghc-pkg and got this strange result that my packages were
 broken into two different files. Is this by design?
 
 ghc-pkg list
 /usr/local/lib/ghc-6.8.2/package.conf:
 Cabal-1.2.3.0, Cabal-1.3.11, Cabal-1.5.2, DeepArrow-0.2,
 
 /home/thartman/.ghc/i386-linux-6.8.2/package.conf:
 HAppS-Data-0.9.2.1, HAppS-IxSet-0.9.2.1, HAppS-State-0.9.2.1,

Yep, this is by design.  The first is a global database that will require root
access to modify.  The second is your user database which you can modify
without root access.

 I am curious if anybody else is able to install HAppS-Server using
 cabal install, and whether they can shed any light on the other isuses
 I raised.
 
 Thomas.

I tried building HAppS-server the other day, and had a similar experience.  It
seems that HAppS uses some incredibly elaborate TH/typeclass hacks that take
gobs of resources to compile -- my box actually ran out of memory attempting to
build it.


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


Re: [Haskell-cafe] WebSense doesn't like darcs.haskell.org

2008-05-29 Thread Benjamin L. Russell



--- On Fri, 5/30/08, Benjamin L. Russell [EMAIL PROTECTED] wrote:

   I used to be able to get to darcs.haskell.org
 just
  fine, but apparently a
   /hacking directory was added somewhere, so
 WebSense
  put it on the naughty list.
 
 Heh, unbelievable.  As if the type of hacker interested in
 DoD attacks

Sorry, I meant DoS (Denial of Service) attacks.  That was a typo.  Time to 
reach for that cup of coffee

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


Re: [Haskell-cafe] appending an element to a list

2008-05-29 Thread Abhay Parvate
On Thu, May 29, 2008 at 11:48 PM, Tillmann Rendel [EMAIL PROTECTED]
wrote:



 Adrian Neumann wrote:

 Hello,

 I was wondering how expensive appending something to a list really is. Say
 I write

 I'd say longList ++ [5] stays unevaluated until I consumed the whole
 list and then appending should go in O(1). Similarly when concatenating two
 lists.

 Is that true, or am I missing something?


 I think that is true and you are missing something: You have to push the
 call to ++ through the whole longList while consuming it wholy one element
 at a time! So when longList has n elements, you have (n+1) calls of ++, each
 returning after O(1) steps. The first n calls return a list with the ++
 pushed down, and the last returns [5]. Summed together, that makes O(n)
 actual calls of ++ for one written by the programmer.

  Tillmann


In other words, if you look at the prototype of ++ given in the prelude, it
generates a new list with first (length longList) elements same as those of
longList, followed by the second list. So when you are accessing elements of
(longList ++ s), you are actually accessing the elements of this newly
generated list, which are generated as and when you access them, so that by
the time you reach the first element of s, you have generated (length
longList) elements of the result of ++.



 ___
 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: happs install seems to have become very slow since upgrading cabal Re: [Haskell-cafe] test driving cabal install...

2008-05-29 Thread Jeremy Shaw
At Thu, 29 May 2008 19:19:48 -0700,
Thomas Hartman wrote:
 
 It did finish, but I still feel like this took too long.

Facebook does take several minutes to compile and consumes quite a bit
of memory while doing it. If you machine does not have atleast 1GB of
memory it could be thrashing due to swapping.

If you have a relatively modern machine with plenty of RAM, then 15
mins does sound a bit long.

There are a few cases where GHC will take a very long time to compile
a file. I have only seen that happen on perhaps 2-3 files in 6+ years
of using Haskell though, and it all cases, the files contained a lot
of autogenerated code (either using Template Haskell, or some other
script which generated the code). 

j.

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


Re: [Haskell-cafe] HDBC with SQL Server / OBDC

2008-05-29 Thread Andrew Appleyard
On Wed, May 28, 2008 at 12:46 AM, Olivier Boudry
[EMAIL PROTECTED] wrote:
 If the calling convention is stdcall on Windows and ccall on other OS then
 it should be defined based on the OS. This can be done by updating the .hsc
 files to define the calling convention as a macro depending on the OS
 type.

 #ifdef mingw32_HOST_OS
 #let CALLCONV = stdcall
 #else
 #let CALLCONV = ccall
 #endif

 And the foreign import should use CALLCONV instead of ccall.

 This should make it work on Windows and not break it on Linux.

Thanks Olivier, that's neater than I thought.  I'll put a patch together.

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