Re: [Haskell-cafe] regex libraries: matching operators (=~) and (=~~) are not methods

2010-12-04 Thread José Romildo Malaquias
On Tue, Nov 30, 2010 at 05:50:02PM -0200, José Romildo Malaquias wrote:
 Hello.
 
 When learning how to use the many regular expression libraries for
 Haskell, I noticed that the interface API from the regex-base package
 introduces several high level operations that are abstracted from the
 implementations (backends). This is done by means of classes.
 
 For instance, there are methods for compiling an external representation
 (like a string or a bytestring) into a regular expression. There are
 also methods for matching a regular expression and some text (like a
 string, or a bytestring).
 
 But the most high level functions for pattern matching using regular
 expressions, (=~) and (=~~), are not defined as methods in a class.
 They are independent functions defined for each backend in the
 corresponding package.
 
 This prevents one from writing a general function using these operators
 without deliberately choosing a regex backend.
 
 Why are those operators not defined as methods, like all other relevant
 functions?

I think I have found the reason for that.

Let's consider the operator (=~ ). Its type in the Text.Regex.TDFA is:

( RegexMaker Regex CompOption ExecOption source
, RegexContext Regex source1 target
) =
source1 - source - target

It has two arguments: the text and the regex (in a textual format) used
in matching. They may be both of type String, or ByteString, for
instance. Therefore there is no way to infer which regex engine to use
when the regex text is compiled to an internal format. So the regex
engine cannot be deduced automatically from the arguments. Because of
that each regex backend has to define his own function, and a class is
of no help.

Romildo

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


Re: [Haskell-cafe] Out of memory if compiled with -O2, why?

2010-12-04 Thread Bulat Ziganshin
Hello Jason,

Wednesday, December 1, 2010, 8:54:58 PM, you wrote:


 I'm using ghc7 here.  If I run your program with -O2, it takes 1943 MB of 
 memory max.
 If I comment out everything except g then with -O2 it takes 1521 MB.

 I'm not sure where the extra 400 MB of memory are going.

i think, it's because memory isn't collected immediately, so in first
case you just have more garbage hanging around. if you need to measure
real workset of your program, you should apply very aggressive (and
slow) garbage collection settings

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


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


Re: [Haskell-cafe] Wondering if this could be done.

2010-12-04 Thread Henning Thielemann
 On 22 November 2010 07:48, Magicloud Magiclouds
 magicloud.magiclo...@gmail.com mailto:magicloud.magiclo...@gmail.com
 wrote:
 
 Hi,
  For example, I have a data A defined. Then I want to add (+) and (-)
 operators to it, as a sugar (compared to addA/minusA). But * or other
 stuff defined in class Num is meanless to A. So I just do:
 (+) :: A - A - A
 (+) a b =
  A (elem1 a + elem1 b) (elem2 a + elem2 b) -- I got errors here, for
 the (+) is ambiguous.
 
  So, just wondering, does this way work in Haskell?

(*) and (+) are in separate type classes in Numeric-Prelude.

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


Re: [Haskell-cafe] Reduceron: reduced to numbers.

2010-12-04 Thread Henning Thielemann
Serguey Zefirov schrieb:

 Of course, Reduceron in ASIC will require some cache memory, some
 controllers, etc. So it won't be that small, like 230K transistors.
 But, mzke it 2.3M transistors and it still be 2 orders of magnitude
 less than Core2 Duo... ;)

Cool! Do you have plans how it can be used eventually? As expansion
card? As main processor? How to compile Haskell to Reduceron code?

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


Re: [Haskell-cafe] Wondering if this could be done.

2010-12-04 Thread Sebastian Fischer
On Mon, 2010-11-22 at 14:48 +0800, Magicloud Magiclouds wrote:
 (+) :: A - A - A
 (+) a b =
   A (elem1 a + elem1 b) (elem2 a + elem2 b) -- I got errors here, for
 the (+) is ambiguous. 

That's because (+) is implicitly imported from the Prelude. If you

import Prelude hiding ((+))

the error disappears.

Sebastian


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


Re: [Haskell-cafe] Safer common subexpression elimination

2010-12-04 Thread Henning Thielemann
Joachim Breitner schrieb:
 Hi,
 
 although semantically it could, ghc does not do common subexpression
 elimination (CSE), at least not in every case. The canonical example
 where it would be bad is the function (with div to avoid numerical
 casting):
 
 avg :: [Int] - Int
 avg n = (sum [0..n] `div` length [0..n])
 
 The reason why [0..n] is not shared is because then it would be kept in
 memory completely after the evaluation of sum, because length will still
 need it, possibly overflowing the memory. In the non-shared form,
 though, the garbage collector can clean up directly behind sum and
 length, and the program runs in constant space.
 
 Note that the shared expression would be very large compared to the
 thunks.
 
 Now consider the program:
 
 avg' :: [Int] - (Int, Int)
 avg' n = (sum [0..n] `div` length [0..n], length [0..n])

It think this is not typecorrect, since 'n' denotes a list and is used
as upper bound in [0..n]. Should it be

 avg' ns = (sum ns `div` length ns, length ns)

?

 I’d say that CSE to 
 avg n = (sum [0..n] `div` l, l)
   where l = length [0..n]
 is safe, because the shared expression (an Int) is smaller than the
 thunks and the compiler can tell.

If this is meant to be

 avg n = (sum ns `div` l, l)
   where l = length ns

according to my substitution above, then 'ns' still has to be shared and
stored completely.

I think the general problem is more complicated than common
subexpression elimination, because lazy evaluation sometimes forces an
inefficient order of computation. Other examples are

 viewR xs = (init xs, last xs)

and an elegant Haskell implementation of the Unix command 'wc' like

 wc text = (length text, length (words text), length (lines text))




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


Re: [Haskell-cafe] Safer common subexpression elimination

2010-12-04 Thread Joachim Breitner
Hello Henning,


Am Samstag, den 04.12.2010, 12:41 +0100 schrieb Henning Thielemann:
 Joachim Breitner schrieb:
  Now consider the program:
  
  avg' :: [Int] - (Int, Int)
  avg' n = (sum [0..n] `div` length [0..n], length [0..n])
 
 It think this is not typecorrect, since 'n' denotes a list and is used
 as upper bound in [0..n]. Should it be
 
  avg' ns = (sum ns `div` length ns, length ns)
 
 ?

Thanks for noting. The type annotation is wrong. In your case (which I
had first), ns is shared and thus would not allow for constant-space
calculation of sum and length and would fail to demonstrate my point.

  I’d say that CSE to 
  avg n = (sum [0..n] `div` l, l)
where l = length [0..n]
  is safe, because the shared expression (an Int) is smaller than the
  thunks and the compiler can tell.
 
 If this is meant to be
 
  avg n = (sum ns `div` l, l)
where l = length ns
 
 according to my substitution above, then 'ns' still has to be shared and
 stored completely.

Right, sorry for the confusion by the wrong type.

Greetings,
Joachim
-- 
Joachim Breitner
  e-Mail: m...@joachim-breitner.de
  Homepage: http://www.joachim-breitner.de
  ICQ#: 74513189
  Jabber-ID: nome...@joachim-breitner.de


signature.asc
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Reduceron: reduced to numbers.

2010-12-04 Thread Serguey Zefirov
2010/12/4 Henning Thielemann schlepp...@henning-thielemann.de:
 Serguey Zefirov schrieb:

 Of course, Reduceron in ASIC will require some cache memory, some
 controllers, etc. So it won't be that small, like 230K transistors.
 But, mzke it 2.3M transistors and it still be 2 orders of magnitude
 less than Core2 Duo... ;)
 Cool! Do you have plans how it can be used eventually? As expansion
 card? As main processor? How to compile Haskell to Reduceron code?

I don't know answers to most of your questions.

But colleague of mine said that reduceron could be programmed into
FPGA part of upcoming Atom E600 - the one with Altera FPGA nearby.

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


[Haskell-cafe] OverloadedStrings mixed with type classes leads to boilerplate type signatures

2010-12-04 Thread Johan Tibell
Hi,

I'm trying to generalize my string substitution library
(http://hackage.haskell.org/package/template) to allow users to
provide different kinds of key/value mappings (e.g. functions and
association lists) for filling in the placeholders in a template. Here
are two examples I'd like to work:

ghci :set -XOverloadedStrings
ghci $name ate a banana. % [(name, Johan)]
Johan ate a banana.
ghci $name ate a banana. % (\v - if v == name then Johan
else error KeyError)
Johan ate a banana.

At the moment the context (i.e. the second argument to %) is always a function

type Context = T.Text - T.Text

I would like to generalize that to

class Context a where
lookup :: a - T.Text - T.Text

Different key/value mappings fulfill different use cases:

 * Association lists have a small syntactic overhead, great for
one-off string substitution.
 * Functions are flexible, allowing for arbitrary complex lookup
logic, but are syntactically heavy (in this case.)

Here's the gist of my implementation:

{-# LANGUAGE FlexibleInstances #-}
module Template where

import Data.Maybe (fromMaybe)
import qualified Data.Text as T
import qualified Data.Text.Lazy as LT
import Prelude as P

class Context a where
lookup :: a - T.Text - T.Text

instance Context (T.Text - T.Text) where
lookup f = f

instance Context [(T.Text, T.Text)] where
lookup xs k = fromMaybe (error $ KeyError:  ++ show k) (P.lookup k xs)

-- | Perform string substitution.  Example:
--
--  $foo % [(foo :: T.Text, bar :: T.Text)]
(%) :: Context c = T.Text - c - LT.Text
(%) = undefined

The problem is that the compiler is not able to deduce that string
literals should have type 'Text' when used in 'Context's. For example

ghci :t $foo % [(foo, bar)]

interactive:1:8:
No instance for (Context [(a, a1)])
  arising from a use of `%'
Possible fix: add an instance declaration for (Context [(a, a1)])
In the expression: $foo % [(foo, bar)]

This forces the user to provide explicit type signatures, which makes
the construct more heavy weight and defeats the whole purpose of
introducing the 'Context' class:

ghci :t $foo % [(foo :: T.Text, bar :: T.Text)]
$foo % [(foo :: T.Text, bar :: T.Text)] :: LT.Text

Is there any way to make the syntactically short `$foo % [(foo,
bar)]` work but still keep the 'Context' class?

Johan

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


[Haskell-cafe] Hackage down?

2010-12-04 Thread Ozgur Akgun
http://downforeveryoneorjustme.com/http://hackage.haskell.org

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


Re: [Haskell-cafe] Hackage down?

2010-12-04 Thread Ross Paterson
On Sat, Dec 04, 2010 at 02:01:44PM +, Ozgur Akgun wrote:
 http://downforeveryoneorjustme.com/http://hackage.haskell.org

Apparently {darcs,hackage}.haskell.org is out for the day -- announced
on Reddit but not here.

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


[Haskell-cafe] Offer to mirror Hackage

2010-12-04 Thread Dan Knapp
With Hackage down, now seemed like a good time to push this issue
again.  It's such an important site to us that it's really rather a
shame there are no mirrors of it.  I have a personal-and-business
server in a data center in Newark, with a fair chunk of bandwidth,
which I'd like to offer for a permanent mirror.  Is there interest in
this?  Who do I need to talk to for it to happen?

Strategy-wise, I think the best approach is round-robin DNS, since
that's transparent to the end user - everything would still appear at
the URL it's at now, but behind-the-scenes magic would let things keep
working when one or the other site is down.  I haven't personally set
up such a system before but I'm willing to take on the burden of
figuring it out.

So I have a better idea of what I'm signing up for, can anyone tell me
how much disk space and how much bandwidth per month Hackage uses?  I
have a fair chunk of both, as I say, but I'd like to know in advance
to ensure that things go smoothly.

As for what I'd want in return for this, really nothing.  I wouldn't
say no to an unobtrusive mention somewhere on the site, but I'd be
happy just knowing I'd given something back to the Haskell community,
which has given a lot to me.

-- 
Dan Knapp
An infallible method of conciliating a tiger is to allow oneself to
be devoured. (Konrad Adenauer)

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


Re: [Haskell-cafe] Offer to mirror Hackage

2010-12-04 Thread Jake McArthur
I am no decision maker regarding Hackage, but I would like to echo my 
support for this offer. Hackage is a vital part of my workflow, and I'm 
sure I'm not the only one. Its importance to the Haskell community has 
grown quickly and is continuing to do so. Each time it goes down, the 
impact is larger than before. We should have a mirror in place for 
situations like these.


- Jake

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


Re: [Haskell-cafe] getErrorStatus in HXT

2010-12-04 Thread Uwe Schmidt
Hi Tobias,

 I have some problems with the error processing in HXT.
 
 Here is a trivial example:
 
 e - runX (transformDoc [] someRules src dst)
 
 transformDoc cfg rules src dst =
 configSysVars cfg 
 readDocument  [] src 
 rules  -- some transformations
 writeDocument [] dst 
 getErrStatus
 
 I would expect e to contain an error value = c_err for the case where 
 any of the processing steps in transformDoc fails. But it does not, even 
 with an io error on writeDocument.
 
 I guess I misunderstand getErrStatus in some way. Any idea?

no, you've got it as it should be. This is an error introduced hxt-9.0
when changing the internals of the global hxt state. I've removed that
bug in the head of the development version.
If there's no time for you to wait until hxt-9.1, the dev. version is available
from github at https://github.com/UweSchmidt/hxt;.

Sorry for that inconvenience,

  Uwe

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


Re: [Haskell-cafe] Hackage down?

2010-12-04 Thread Antoine Latter
Thanks, Ross.

Here's a Reddit post:
http://www.reddit.com/r/haskell/comments/efw38/reminder_hackagehaskellorg_outage_tomorrow_due_to/

Antoine

On Sat, Dec 4, 2010 at 8:20 AM, Ross Paterson r...@soi.city.ac.uk wrote:
 On Sat, Dec 04, 2010 at 02:01:44PM +, Ozgur Akgun wrote:
 http://downforeveryoneorjustme.com/http://hackage.haskell.org

 Apparently {darcs,hackage}.haskell.org is out for the day -- announced
 on Reddit but not here.

 ___
 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] getErrorStatus in HXT

2010-12-04 Thread Tobias Schoofs

Hi Uwe,

thanks a lot for the clarification!

Indeed, I was a bit confused since all other concepts in HXT are 
straight forward and easy to grasp.


When is the release of hxt-9.1 on hackage expected?



On 12/04/2010 05:49 PM, Uwe Schmidt wrote:

Hi Tobias,

   

I have some problems with the error processing in HXT.

Here is a trivial example:

e- runX (transformDoc [] someRules src dst)

transformDoc cfg rules src dst =
 configSysVars cfg
 readDocument  [] src
 rules  -- some transformations
 writeDocument [] dst
 getErrStatus

I would expect e to contain an error value= c_err for the case where
any of the processing steps in transformDoc fails. But it does not, even
with an io error on writeDocument.

I guess I misunderstand getErrStatus in some way. Any idea?
 

no, you've got it as it should be. This is an error introduced hxt-9.0
when changing the internals of the global hxt state. I've removed that
bug in the head of the development version.
If there's no time for you to wait until hxt-9.1, the dev. version is available
from github at https://github.com/UweSchmidt/hxt;.

Sorry for that inconvenience,

   Uwe

   



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


Re: [Haskell-cafe] Hackage down?

2010-12-04 Thread aditya siram
What the heck does a full torque of the electrical bus riser mean?
Don't get me wrong, it sounds badass.

-deech

On Sat, Dec 4, 2010 at 12:03 PM, Antoine Latter aslat...@gmail.com wrote:
 Thanks, Ross.

 Here's a Reddit post:
 http://www.reddit.com/r/haskell/comments/efw38/reminder_hackagehaskellorg_outage_tomorrow_due_to/

 Antoine

 On Sat, Dec 4, 2010 at 8:20 AM, Ross Paterson r...@soi.city.ac.uk wrote:
 On Sat, Dec 04, 2010 at 02:01:44PM +, Ozgur Akgun wrote:
 http://downforeveryoneorjustme.com/http://hackage.haskell.org

 Apparently {darcs,hackage}.haskell.org is out for the day -- announced
 on Reddit but not here.

 ___
 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] Offer to mirror Hackage

2010-12-04 Thread Ozgur Akgun
This is a very generous offer. However, I must say I like the following idea
more:

http://www.reddit.com/r/haskell/comments/efw38/reminder_hackagehaskellorg_outage_tomorrow_due_to/c17u7nk

On 4 December 2010 16:31, Dan Knapp dan...@gmail.com wrote:

 With Hackage down, now seemed like a good time to push this issue
 again.  It's such an important site to us that it's really rather a
 shame there are no mirrors of it.  I have a personal-and-business
 server in a data center in Newark, with a fair chunk of bandwidth,
 which I'd like to offer for a permanent mirror.  Is there interest in
 this?  Who do I need to talk to for it to happen?

 Strategy-wise, I think the best approach is round-robin DNS, since
 that's transparent to the end user - everything would still appear at
 the URL it's at now, but behind-the-scenes magic would let things keep
 working when one or the other site is down.  I haven't personally set
 up such a system before but I'm willing to take on the burden of
 figuring it out.

 So I have a better idea of what I'm signing up for, can anyone tell me
 how much disk space and how much bandwidth per month Hackage uses?  I
 have a fair chunk of both, as I say, but I'd like to know in advance
 to ensure that things go smoothly.

 As for what I'd want in return for this, really nothing.  I wouldn't
 say no to an unobtrusive mention somewhere on the site, but I'd be
 happy just knowing I'd given something back to the Haskell community,
 which has given a lot to me.

 --
 Dan Knapp
 An infallible method of conciliating a tiger is to allow oneself to
 be devoured. (Konrad Adenauer)

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




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


Re: [Haskell-cafe] GHC 7.0.1 developer challenges

2010-12-04 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 11/24/10 20:59 , John D. Ramsdell wrote:
 Due to a security concern, GHC 7.0.1 disables all runtime flags unless
 a new flag is provided during linking.  Since limiting memory usage is
 so important, many developers will modify their cabal files to add the
 linker flag or prepare for complaints from users that the developer's
 program caused their machine to freeze and lose their work.

We went over this some time back; the GHC runtime is wrong here, it should
only disable flags when running with geteuid() == 0.  Also, the current
mechanism for specifying runtime flags at compile time is horridly ugly and
this really needs to be fixed before any such runtime limitation is viable.
 I hope that will be fixed in a later point release.

- -- 
brandon s. allbery [linux,solaris,freebsd,perl]  allb...@kf8nh.com
system administrator  [openafs,heimdal,too many hats]  allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon university  KF8NH
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.10 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkz6i6gACgkQIn7hlCsL25VajgCeKqReTXt0JlQ90iTPtvU6VRXy
1PkAoJC83Glcy3jurrxH7eoiNGFZdazJ
=Zi+B
-END PGP SIGNATURE-

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


Re: [Haskell-cafe] GHC 7.0.1 developer challenges

2010-12-04 Thread Edward Z. Yang
Excerpts from Brandon S Allbery KF8NH's message of Sat Dec 04 13:42:48 -0500 
2010:
 We went over this some time back; the GHC runtime is wrong here, it should
 only disable flags when running with geteuid() == 0.  Also, the current
 mechanism for specifying runtime flags at compile time is horridly ugly and
 this really needs to be fixed before any such runtime limitation is viable.
  I hope that will be fixed in a later point release.

There are many setuid binaries to non-root users, so getuid() != geteuid()
would probably make more sense, though I'm not 100% it has all the correct
security properties.

Edward

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


Re: [Haskell-cafe] Offer to mirror Hackage

2010-12-04 Thread Riad S. Wahby
Ozgur Akgun ozgurak...@gmail.com wrote:
 This is a very generous offer. However, I must say I like the following idea
 more:
 
 http://www.reddit.com/r/haskell/comments/efw38/
 reminder_hackagehaskellorg_outage_tomorrow_due_to/c17u7nk

I'd support this, but I'm strongly in favor of the use of WePay.com over
PayPal for collecting funds. The former's shady history is a matter of
public record.

Alternatively, I'd also be willing to throw some of my own bandwidth and
disk space towards a mirror.

-=rsw

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


Re: [Haskell-cafe] GHC 7.0.1 developer challenges

2010-12-04 Thread Riad S. Wahby
Edward Z. Yang ezy...@mit.edu wrote:
 There are many setuid binaries to non-root users, so getuid() != geteuid()
 would probably make more sense, though I'm not 100% it has all the correct
 security properties.

Might as well throw in getegid() != getgid() for good measure.

Another issue with this: in the next couple years it looks like Fedora
and Ubuntu will both be going towards filesystem capabilities instead of
suid. If access to +RTS is restricted for suid binaries, it should
probably also be restricted for binaries with elevated capabilities.

-=rsw

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


Re: [Haskell-cafe] Safer common subexpression elimination

2010-12-04 Thread Henning Thielemann
Joachim Breitner schrieb:

 Am Samstag, den 04.12.2010, 12:41 +0100 schrieb Henning Thielemann:
 Joachim Breitner schrieb:
 Now consider the program:

 avg' :: [Int] - (Int, Int)
 avg' n = (sum [0..n] `div` length [0..n], length [0..n])
 It think this is not typecorrect, since 'n' denotes a list and is used
 as upper bound in [0..n]. Should it be

 avg' ns = (sum ns `div` length ns, length ns)
 ?
 
 Thanks for noting. The type annotation is wrong. In your case (which I
 had first), ns is shared and thus would not allow for constant-space
 calculation of sum and length and would fail to demonstrate my point.

I see. It may be that GHC actually eliminates common subexpression of
primitive types. Its Core output will tell you.

Nonetheless, maybe it is more sensible for a compiler not to answer the
question whether a common subexpression should be shared or not, but it
may try to evaluate the depending expressions in a way such that the
shared data structure can be garbage collected as computation goes on.


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


[Haskell-cafe] Data.Typeable TypeRep Ord instance.

2010-12-04 Thread Serguey Zefirov
Why TypeRep does have equality and doesn't have ordering?

It would be good to have that.

Right now when I have to order two type representations I convert them
to string and then compare. This is somewhat inefficient and not quite
straightforward.

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


Re: [Haskell-cafe] GHC 7.0.1 developer challenges

2010-12-04 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 12/4/10 14:35 , Riad S. Wahby wrote:
 Edward Z. Yang ezy...@mit.edu wrote:
 There are many setuid binaries to non-root users, so getuid() != geteuid()
 would probably make more sense, though I'm not 100% it has all the correct
 security properties.
 
 Might as well throw in getegid() != getgid() for good measure.
 
 Another issue with this: in the next couple years it looks like Fedora
 and Ubuntu will both be going towards filesystem capabilities instead of
 suid. If access to +RTS is restricted for suid binaries, it should
 probably also be restricted for binaries with elevated capabilities.

Yes to both.  And on Windows I wonder if it makes sense to try to detect
that a program is running with restricted permissions (lack of membership in
certain groups) and likewise restrict use of runtime options.  (I don't
think there's anything like setuid, though, and it probably makes no sense
to try to detect that someone installed the program as a service running as
LSA or used RunAs.)

- -- 
brandon s. allbery [linux,solaris,freebsd,perl]  allb...@kf8nh.com
system administrator  [openafs,heimdal,too many hats]  allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon university  KF8NH
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.10 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkz6xIQACgkQIn7hlCsL25XuiACfbUPTtk1Qkvo5fpWJzhX/WrbL
A54An2CLYNa6Rza5KmswyrRJlKAb/w0G
=X0nY
-END PGP SIGNATURE-

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


Re: [Haskell-cafe] Data.Typeable TypeRep Ord instance.

2010-12-04 Thread Tianyi Cui
Why should they? You can compare them in whatever way you like. And there
isn't a natural/inherent sense of total order between types.

On Sun, Dec 5, 2010 at 6:08 AM, Serguey Zefirov sergu...@gmail.com wrote:

 Why TypeRep does have equality and doesn't have ordering?

 It would be good to have that.

 Right now when I have to order two type representations I convert them
 to string and then compare. This is somewhat inefficient and not quite
 straightforward.

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




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


[Haskell-cafe] the beginning of the end (was: Hackage down?)

2010-12-04 Thread Albert Y. C. Lai

On 10-12-04 01:03 PM, Antoine Latter wrote:

Here's a Reddit post:
http://www.reddit.com/r/haskell/comments/efw38/reminder_hackagehaskellorg_outage_tomorrow_due_to/


This is the second consecutive time a planned downtime is not announced 
on either mailing lists.


This seems to me planned obsoletion of the mailing lists.
http://article.gmane.org/gmane.comp.lang.haskell.cafe/82673

Was the planned obsoletion of the mailing lists also announced on reddit?

Personally I refuse to use reddit and many web 2.0 things for both 
pragmatic (usability) and ideological reasons.


The most important pragmatic reason for me is retarded or no attempt at 
mark-as-read and show-all-and-only-those-unread.


For now, if a web 2.0 source I care enough about provides RSS, I make do 
with adding it to Google Reader, which provides mark-as-read and 
show-all-and-only-those-unread as perfectly as long-existing email programs.


But it is always refreshing to see that our young ones are heading to a 
brave new world of synergy in which the only web 2.0 programmers who 
have heard of the discrete math idea of subset are the elite ones at 
Google.


And to think that I once joked that in the future only math PhDs, and 
only some of them, know how to divide.

http://groups.google.com/group/k12.chat.teacher/msg/62eccc5e1916a1da

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


Re: [Haskell-cafe] Data.Typeable TypeRep Ord instance.

2010-12-04 Thread Serguey Zefirov
2010/12/5 Tianyi Cui tianyi...@gmail.com:
 Why should they? You can compare them in whatever way you like. And there
 isn't a natural/inherent sense of total order between types.

I cannot compare then the way I'd like. ;)

Consider the following:

data BiMap a = BiMap {
 values :: Map Int a
,indices :: Map a Int
}

It will serve well for Int's, Bool's and Expr's.

Then I decided to store typed Expr's, based on GADTs. Those Expr's
contains type indices and it would be natural to classify BiMaps by
their type indices and look up in there. If I require type indices to
be Typeable, all I need is ordering on TypeRep.

Also, I prototyped hypergraph library with hyperedges as types with
type family as HList of types denoting labels. There I needed ordering
on TypeRep too, again, for efficiency reasons.

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


Re: [Haskell-cafe] the beginning of the end (was: Hackage down?)

2010-12-04 Thread Don Stewart
trebla:
 On 10-12-04 01:03 PM, Antoine Latter wrote:
 Here's a Reddit post:
 http://www.reddit.com/r/haskell/comments/efw38/reminder_hackagehaskellorg_outage_tomorrow_due_to/

 This is the second consecutive time a planned downtime is not announced  
 on either mailing lists.

 This seems to me planned obsoletion of the mailing lists.
 http://article.gmane.org/gmane.comp.lang.haskell.cafe/82673

 For now, if a web 2.0 source I care enough about provides RSS, I make do  
 with adding it to Google Reader, which provides mark-as-read and  
 show-all-and-only-those-unread as perfectly as long-existing email 
 programs.


You can get a feed of haskell.org announcements here:

http://twitter.com/statuses/user_timeline/216043045.rss

Particularly when the mailing lists are down (e.g. due to server
migration), cloud-hosted services have proven invaluable for getting the
word out.

-- Don

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


Re: [Haskell-cafe] Offer to mirror Hackage

2010-12-04 Thread wren ng thornton

On 12/4/10 11:31 AM, Dan Knapp wrote:

With Hackage down, now seemed like a good time to push this issue
again.  It's such an important site to us that it's really rather a
shame there are no mirrors of it.  I have a personal-and-business
server in a data center in Newark, with a fair chunk of bandwidth,
which I'd like to offer for a permanent mirror.

Is there interest in this?


Absolutely.


Who do I need to talk to for it to happen?


I'd guess that'd be the haskell.org steering committee:


http://haskellorg.wordpress.com/2010/11/15/the-haskell-org-committee-has-formed/

--
Live well,
~wren

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


Re: [Haskell-cafe] Offer to mirror Hackage

2010-12-04 Thread wren ng thornton

On 12/4/10 2:21 PM, Riad S. Wahby wrote:

Ozgur Akgunozgurak...@gmail.com  wrote:

This is a very generous offer. However, I must say I like the following idea
more:

http://www.reddit.com/r/haskell/comments/efw38/
reminder_hackagehaskellorg_outage_tomorrow_due_to/c17u7nk


That sounds like a great idea.

The 501(c)(3) I mean. The distributed hosting is nice too, though I'd 
like to see the 501(c)(3) formed before donating, just so we can get 
official reports and all that. But once that's up, I'm definitely 
willing to contribute.


FWIW, I've been on the board of directors for a 501(c)(3), helped write 
their bylaws, and know a few people in the business (lawyers, etc). I'm 
willing to offer advice, effort, and references whenever the committee 
decides to do this.





I'd support this, but I'm strongly in favor of the use of WePay.com over
PayPal for collecting funds. The former's shady history is a matter of
public record.


Semantic Parse Fail: did you mean the latter or strongly opposed to?



Alternatively, I'd also be willing to throw some of my own bandwidth and
disk space towards a mirror.


For a scalable solution I think we should be aiming for both (1) a 
distributed central server, and (2) mirrors around the globe. The 
former gives reliability to the main site, but the latter help for 
locality and loadbalancing as well as failover.


--
Live well,
~wren

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


Re: [Haskell-cafe] Offer to mirror Hackage

2010-12-04 Thread Riad S. Wahby
wren ng thornton w...@freegeek.org wrote:
 Semantic Parse Fail: did you mean the latter or strongly opposed to?

s/former/latter/

:)

-=rsw

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


Re: [Haskell-cafe] Offer to mirror Hackage

2010-12-04 Thread Florian Lengyel
Why is there even any consideration of some committee if someone wants to
mirror the Hackage site? Why not mirror the site?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe