Re: [Haskell-cafe] [Haskell] haskell.org migration complete

2010-12-05 Thread Henning Thielemann
Thomas Schilling schrieb:
 I created http://www.haskell.org/haskellwiki/MigratingWikiContent to
 list known issues and workarounds.  Please feel free to extend that
 page where needed.

I liked to add that the Category link on each Wiki page is missing.

How about an alternate CSS layout for the old Wiki style?
Btw. unfortunately also in Konqueror CSS selections are not preserved
across sessions.

I did not like to add these items while having to log in over unsecure
HTTP connection. Formerly I could just replace http: by https: which
is no longer possible.

___
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-05 Thread Ivan Lazar Miljenovic
On 5 December 2010 18:41, Florian Lengyel florian.leng...@gmail.com wrote:
 Why is there even any consideration of some committee if someone wants to
 mirror the Hackage site? Why not mirror the site?

Presumably to make it an official mirror, and possibly due to the
licenses of some content on there.

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

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


Re: [Haskell-cafe] Offer to mirror Hackage

2010-12-05 Thread wren ng thornton

On 12/4/10 10:34 PM, wren ng thornton wrote:

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 tried cc-ing my previous to commit...@haskell.org but got

commit...@haskell.org: host haskell.org[78.46.100.180] said:
550 Unrouteable address (in reply to RCPT TO command)

Did I get the address wrong, or does this have to do with the electrical 
downtime?


--
Live well,
~wren

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


[Haskell-cafe] Hackage have ghc 7.0 false positives builds

2010-12-05 Thread Maciej Piechotka
Hackage seems to hae false positive builds. For example llvm is reported
to have been built with ghc despite problems with cabal (type errors and
after quick'n'dirty fix it has errors).

Regards


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

2010-12-05 Thread Uwe Schmidt
Hi Tobias,

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

I've uploaded a hxt-9.0.1 to hackage with that bug removed.

Cheers,

Uwe

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


Re: [Haskell-cafe] [Haskell] haskell.org migration complete

2010-12-05 Thread Mark Lentczner

On Dec 5, 2010, at 12:29 AM, Henning Thielemann wrote:

 How about an alternate CSS layout for the old Wiki style?
 Btw. unfortunately also in Konqueror CSS selections are not preserved
 across sessions.

When logged in:
My preferences  Skin  MonoBook


___
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-05 Thread Ketil Malde
Florian Lengyel florian.leng...@gmail.com writes:

 Why is there even any consideration of some committee if someone wants to
 mirror the Hackage site? Why not mirror the site?

+1

  Alright, Mr. Wiseguy, she said, if you're so clever, you tell us
  what colour it should be. 

We can either let Dan set up a mirror, and add it to the haskell.org DNS
(or just let it live at a different address), and have a mirror up in a
couple of hours -- or we can set up 501(c)(3)s (whatever they are),
decide on a payment service, write bylaws, hire lawyers etc.  All in the
name of not-dealing-with-this-shit¹?

In my experience, everything is a lot simpler if you can avoid dealing
directly with money.  The current problem is that hackage has sometimes
been unstable, having a mirror would fix or at least alleviate that.

-k

¹  As argued in the cited Reddit thread. Okay, in all fairness, the
shit being referred to is the current non-redundant DNS configuration,
not people volunteering to solve technical issues. :-)
-- 
If I haven't seen further, it is by standing in the footprints of giants

___
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-05 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 12/5/10 02:41 , Florian Lengyel wrote:
 Why is there even any consideration of some committee if someone wants to
 mirror the Hackage site? Why not mirror the site?

Because it would be nice to have a mirror run by someone (a) accountable (b)
who is unlikely to suddenly disappear due to loss of job, life becoming
hectic, etc.  (Consider that this is pretty much why *.haskell.org has been
unreliable and fixes have been slow in coming; the individual in question is
at Yale, and a good person but kinda snowed under of late.)

- -- 
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/

iEYEARECAAYFAkz7wrAACgkQIn7hlCsL25VrvACZAWZq4rYMM8PARZYvyFmnt1qZ
jX4An3fgSSsuFLHR0/HsEB8hEeyj4MCO
=MI9c
-END PGP SIGNATURE-

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


Re: [Haskell-cafe] the beginning of the end

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

On 12/4/10 21:35 , Jason Dagit wrote:
 In that case, here you go:
 http://twitter.com/statuses/user_timeline/216043045.rss
 http://twitter.com/statuses/user_timeline/17788765.rss
 
 You can get those by finding them on twitter and then clicking the RSS link.

Twitter might be the one idea worse than reddit for this kind of thing

- -- 
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/

iEYEARECAAYFAkz7xR8ACgkQIn7hlCsL25UpxQCeL/v4mUjYpESgQWpDbj2ZQuyx
96sAoLiPOfvdT5r2vIRg3GxTKXntf/0c
=0cvu
-END PGP SIGNATURE-

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


[Haskell-cafe] Strange error when using Attoparsec and Enumerator

2010-12-05 Thread Crutcher Dunnavant
I have spent a good chunk of the past week tracing code, trying to
solve this problem. I'm seeing an error when using Enumerator and
Attoparsec that I can't explain. This is a reduced form of the
problem.

In general, I've observed that debugging broken iterators and
enumerators is very hard. We probably want some tooling around that;
I'm looking at an identity enumeratee with debug.trace shoved in, or
something like that, not sure yet what would help.

{-
Haskell 2010, ghc 6.12.3
array-0.3.0.2
attoparsec-0.8.2.0
attoparsec-enumerator-0.2.0.2
bytestring-0.9.1.7
containers-0.4.0.0
deepseq-1.1.0.2
enumerator-0.4.2
text-0.10.0.0
transformers-0.2.2.0
-}
import Control.Applicative ((|))
import qualified Data.Attoparsec.Char8 as AP
import qualified Data.Attoparsec.Combinator as APC
import qualified Data.Attoparsec.Enumerator as APE
import qualified Data.ByteString.Char8 as B
import qualified Data.Enumerator as E
import Data.Enumerator (($$))
import System.IO as IO

parseLine :: AP.Parser B.ByteString
parseLine = do
  AP.char '+'
  return . B.pack = APC.manyTill AP.anyChar endOfLineOrInput

endOfLineOrInput :: AP.Parser ()
endOfLineOrInput = AP.endOfInput | AP.endOfLine

pp :: Show a = AP.Parser a - String - IO ()
pp p s = do
  result - E.run $
E.enumList 1 [ B.pack s ]
$$ E.sequence (APE.iterParser p)
$$ E.printChunks False
  case result of
(Right _) - return ()
(Left e)  - IO.hPutStrLn stderr $ show e

main = pp parseLine +OK
{-
Observed output:
[OK]
*** Exception: enumEOF: divergent iteratee

Problems with this:
1) I didn't write an iteratee, enumerator, or enumeratee in this code.
Something's wrong.

2) If the parser is divergent, I _should_ be getting the error message:
  iterParser: divergent parser
-}

--
Crutcher Dunnavant crutc...@gmail.com

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


Re: [Haskell-cafe] the beginning of the end

2010-12-05 Thread Daniel Peebles
Oh yeah, the 2.0 stuff that snobby techies love to hate :) hrrmpf back in my
day we programmed in binary using a magnetized needle on the exposed tape! I
don't need any of this newfangled bull.

I kid! But I am curious to see why people are so opposed to this stuff? The
attitude I can't see any reason for it to exist (without having seriously
tried it) seems similar to that our (haskell's) detractors use when taking a
cursory glance at it and saying the syntax doesn't make sense.



On Sun, Dec 5, 2010 at 12:00 PM, Brandon S Allbery KF8NH 
allb...@ece.cmu.edu wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 On 12/4/10 21:35 , Jason Dagit wrote:
  In that case, here you go:
  http://twitter.com/statuses/user_timeline/216043045.rss
  http://twitter.com/statuses/user_timeline/17788765.rss
 
  You can get those by finding them on twitter and then clicking the RSS
 link.

 Twitter might be the one idea worse than reddit for this kind of thing

 - --
 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/

 iEYEARECAAYFAkz7xR8ACgkQIn7hlCsL25UpxQCeL/v4mUjYpESgQWpDbj2ZQuyx
 96sAoLiPOfvdT5r2vIRg3GxTKXntf/0c
 =0cvu
 -END PGP SIGNATURE-

 ___
 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] the beginning of the end

2010-12-05 Thread Christopher Done
On 5 December 2010 18:34, Daniel Peebles pumpkin...@gmail.com wrote:

 Oh yeah, the 2.0 stuff that snobby techies love to hate :) hrrmpf back in
 my day we programmed in binary using a magnetized needle on the exposed
 tape! I don't need any of this newfangled bull.

 I kid! But I am curious to see why people are so opposed to this stuff? The
 attitude I can't see any reason for it to exist (without having seriously
 tried it) seems similar to that our (haskell's) detractors use when taking a
 cursory glance at it and saying the syntax doesn't make sense.


Of course, their use lies in their popularity. To be popular you have to be
(1) well designed/usable and (2) stable/aka never down. This is why e.g.
Github is extremely useful. It's well designed so it's easy to use, it's
popular so most people are familiar with the interface, and it has
near-perfect uptime. I frown a bit when someone provides a link to their Git
repository and it's some custom repo viewer or non at all on a domain that
may or may not exist next week. Twitter, reddit and blogspot are pretty much
ideal for reporting on uptime issues.

On 5 December 2010 18:00, Brandon S Allbery KF8NH allb...@ece.cmu.edu
 wrote:

 Twitter might be the one idea worse than reddit for this kind of thing


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


Re: [Haskell-cafe] the beginning of the end

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

On 12/5/10 12:34 , Daniel Peebles wrote:
 Oh yeah, the 2.0 stuff that snobby techies love to hate :) hrrmpf back in my
 day we programmed in binary using a magnetized needle on the exposed tape! I
 don't need any of this newfangled bull.
 
 I kid! But I am curious to see why people are so opposed to this stuff? The
 attitude I can't see any reason for it to exist (without having seriously
 tried it) seems similar to that our (haskell's) detractors use when taking a
 cursory glance at it and saying the syntax doesn't make sense. 

My problem with reddit is (a) I always have to click through the reddit
entry to see the article it's about; this is a usability botch as far as I'm
concerned (b) I already have to follow too many sources of information, and
would really like to get it under control.

As for twitter, one word:  firehose.  *Way* too easy to miss things, even
with Tweetdeck and the like.

- -- 
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/

iEYEARECAAYFAkz70L0ACgkQIn7hlCsL25VOjACghY40T+eHMEeQSAtmjxkXFoXr
53IAnRR4j9xF/TiHmlAQAswjzju3Zf/7
=oOFZ
-END PGP SIGNATURE-

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


Re: [Haskell-cafe] the beginning of the end

2010-12-05 Thread Darrin Chandler
On Sun, Dec 05, 2010 at 06:48:20PM +0100, Christopher Done wrote:
 Of course, their use lies in their popularity. To be popular you have to be
 (1) well designed/usable and (2) stable/aka never down. This is why e.g.
 Github is extremely useful. It's well designed so it's easy to use, it's
 popular so most people are familiar with the interface, and it has
 near-perfect uptime. I frown a bit when someone provides a link to their Git
 repository and it's some custom repo viewer or non at all on a domain that
 may or may not exist next week. Twitter, reddit and blogspot are pretty much
 ideal for reporting on uptime issues.

Twitter and Reddit both have periods of unavailability almost on a daily
basis, often several times per day. They always come back, but they are
hardly models of availability. Just saying...

dwc

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


[Haskell-cafe] LLVM, getElementPtr?

2010-12-05 Thread Lally Singh
Hey all, I'm trying to get started generating LLVM code, but I'm
getting a rather cryptic error.

I wanted to create a function that takes a string and generates a
function calling to puts with that string as an argument:


buildReaderFun :: String - CodeGenModule (Function (IO ()))
buildReaderFun nm = do
  puts - newNamedFunction ExternalLinkage puts :: TFunction (Ptr
Word8 - IO Word32)
  greetz - createStringNul nm
  func - createFunction ExternalLinkage $ do
tmp - getElementPtr0 greetz (0 :: Word32, ())
call puts  tmp -- Throw away return value.
ret ()
  return func

(based off of some code at this blog post:
http://augustss.blogspot.com/2009/01/llvm-llvm-low-level-virtual-machine-is.html
)

But, I get this error:

/research/phd/libmet/Listener.hs:16:11:
Ambiguous type variable `n' in the constraint:
  `Data.TypeLevel.Num.Sets.NatI n'
arising from a use of `getElementPtr0'
 at /research/phd/libmet/Listener.hs:16:11-49
Probable fix: add a type signature that fixes these type variable(s)

My attempts at figuring out what type-level has to do with this, and
how to satisfy it have so far proven unsuccessful.

Can anyone shed a little light on what's going on?  Or pointers to
some documentation on any of this?

Cheers,
-Lally

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


Re: [Haskell-cafe] the beginning of the end

2010-12-05 Thread Ðavîd Låndïs
On Sun, Dec 5, 2010 at 12:48 PM, Christopher Done
chrisd...@googlemail.com wrote:
 Twitter, reddit and blogspot are pretty much
 ideal for reporting on uptime issues.
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


FYI, as someone who frequents Reddit, I can say that it goes down all
the time. Its Under heavy load message is well known by now to
anyone who uses the site.

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


Re: [Haskell-cafe] LLVM, getElementPtr?

2010-12-05 Thread Henning Thielemann


On Sun, 5 Dec 2010, Lally Singh wrote:


Hey all, I'm trying to get started generating LLVM code, but I'm
getting a rather cryptic error.


Btw. there is haskell-l...@projects.haskell.org


buildReaderFun :: String - CodeGenModule (Function (IO ()))
buildReaderFun nm = do
 puts - newNamedFunction ExternalLinkage puts :: TFunction (Ptr
Word8 - IO Word32)
 greetz - createStringNul nm
 func - createFunction ExternalLinkage $ do
   tmp - getElementPtr0 greetz (0 :: Word32, ())


You have to add a type annotation to greetz like
   (greetz :: Array D42 Word8)
 which limits your string to a length of 42 bytes.

If you do not know the length, better use withStringNul.
I implemented the current behavior, because the former implementation was 
unsafe.



   call puts  tmp -- Throw away return value.
   ret ()
 return func

My attempts at figuring out what type-level has to do with this, and
how to satisfy it have so far proven unsuccessful.


type-level provides type level integers, and thus allows for static 
checking of sizes, such as the number of bits of an integer type.


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


Re: [Haskell-cafe] [Haskell] haskell.org migration complete

2010-12-05 Thread Thomas Schilling
On 5 December 2010 08:29, Henning Thielemann
schlepp...@henning-thielemann.de wrote:
 Thomas Schilling schrieb:
 I created http://www.haskell.org/haskellwiki/MigratingWikiContent to
 list known issues and workarounds.  Please feel free to extend that
 page where needed.

 I liked to add that the Category link on each Wiki page is missing.

It's at the bottom of each page.

 How about an alternate CSS layout for the old Wiki style?
 Btw. unfortunately also in Konqueror CSS selections are not preserved
 across sessions.

 I did not like to add these items while having to log in over unsecure
 HTTP connection. Formerly I could just replace http: by https: which
 is no longer possible.

As Mark mentioned, there's the MonoBook theme which you can set as
your default when you log in.  Of course, if you don't want to log in
that doesn't help.  I'll talk to Ian and see what we can do about SSL
support.

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


Re: [Haskell-cafe] the beginning of the end

2010-12-05 Thread Andrew Coppin

On 05/12/2010 05:34 PM, Daniel Peebles wrote:
Oh yeah, the 2.0 stuff that snobby techies love to hate :) hrrmpf back 
in my day we programmed in binary using a magnetized needle on the 
exposed tape! I don't need any of this newfangled bull.


I'm still just miffed that people are trying to use HTTP to serve 
interactive desktop applications. Talk about abusing a technology to try 
to make it do things it's simply not designed for and not appropriate 
for... But hey, it's popular now, so we're stuck with it forever. *sigh*


I kid! But I am curious to see why people are so opposed to this 
stuff? The attitude I can't see any reason for it to exist (without 
having seriously tried it) seems similar to that our (haskell's) 
detractors use when taking a cursory glance at it and saying the 
syntax doesn't make sense.




A while back Don (I think) sent out an email saying hey people, follow 
X, Y and Z - most of which I never go anywhere near. When I look at 
things like Reddit, Twitter, Stack Overflow, Planet Haskell and so on, I 
guess I just don't get it.


I get Haskell. It's a programming language. You write programs with it. 
I get VB - even if I think it sucks. But something like Stack Overflow, 
I find myself just staring at it thinking what the hell /is/ this thing?


I sound as if I'm old or something.

About the only one I've been able to figure out is Twitter. As best as I 
can tell, it lets you post a textual status line. THAT'S IT. That's ALL 
it does. Rather like what MSN Messenger let you do 10 years ago... 
except without the bit where it also does useful stuff as well. Like 
what Facebook lets you do today, but without all the other useful 
features. Worse, as far as I can tell, half of the things posted are 
replies to other things, and there is /no way/ to figure out what 
they're replies to. Oh, you can tell /who/ they're replies to, just not 
which specific post they relate to. I spent about an hour trying to 
figure out how to do this, because I just refuse to believe that sound a 
trivial feature could be missing, but no... you actually cannot do 
something as trivial as follow a conversation. You can only read one 
half of it and try to guess where the various bits of the other half 
are. What the hell?


...OK, I am now officially old.


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


Re: [Haskell-cafe] the beginning of the end

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

On 12/5/10 15:07 , Andrew Coppin wrote:
 you actually cannot do something as trivial as follow a conversation

You can, just not via the web site.  I do it in Tweetdeck all the time.

That said, the important thing about Twitter is that it's *broadcast*.  If
you try to force it to be an AIM/Windows Live Messenger etc. replacement,
you will be unhappy; if you use it as itself, it actually works fairly well.

But for itself doesn't include reliable delivery in any sense; not only
does it not provide any guarantees that the recipient(s) received or saw any
given message, but the service itself is unreliable (constant outages, and
the fail whale (referring to the message the web site displays when the
service is overloaded) shows up a lot even when Twitter's up.

- -- 
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/

iEYEARECAAYFAkz79HEACgkQIn7hlCsL25UlZwCgzJ76zZtLTixa3uf1Pi2sN2CA
PVoAoK/ekbBEz+xUQbWiPLM7q14evyXp
=wGeu
-END PGP SIGNATURE-

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


Re: [Haskell-cafe] LLVM, getElementPtr?

2010-12-05 Thread Lally Singh
Thanks for your help.  Replying inline

On Sun, Dec 5, 2010 at 1:28 PM, Henning Thielemann
lemm...@henning-thielemann.de wrote:

 On Sun, 5 Dec 2010, Lally Singh wrote:

 Hey all, I'm trying to get started generating LLVM code, but I'm
 getting a rather cryptic error.

 Btw. there is haskell-l...@projects.haskell.org

 buildReaderFun :: String - CodeGenModule (Function (IO ()))
 buildReaderFun nm = do
  puts - newNamedFunction ExternalLinkage puts :: TFunction (Ptr
 Word8 - IO Word32)
  greetz - createStringNul nm
  func - createFunction ExternalLinkage $ do
   tmp - getElementPtr0 greetz (0 :: Word32, ())

 You have to add a type annotation to greetz like
   (greetz :: Array D42 Word8)
  which limits your string to a length of 42 bytes.

 If you do not know the length, better use withStringNul.
 I implemented the current behavior, because the former implementation was
 unsafe.

I'm sorry, the type signature for withStringNul is over my head.
withStringNul ::
   String -
   (forall n. (Nat n) = Global (Array n Word8) - CodeGenModule a) -
   CodeGenModule a

On the LLVM side, I'm looking to simply create a string constant I can
pass in, such as ConstantArray::get(..).

I *think* withStringNul will generate code to build a runtime-length
determined string?   Sorry, I'm a little thick.

   call puts  tmp -- Throw away return value.
   ret ()
  return func

 My attempts at figuring out what type-level has to do with this, and
 how to satisfy it have so far proven unsuccessful.

 type-level provides type level integers, and thus allows for static checking
 of sizes, such as the number of bits of an integer type.

Thanks -- sorry -- I'm guessing it's to make sure we're generating valid code?

Cheers,
-Lally

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


Re: [Haskell-cafe] the beginning of the end

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

On 10-12-05 12:34 PM, Daniel Peebles wrote:

Oh yeah, the 2.0 stuff that snobby techies love to hate :) hrrmpf back
in my day we programmed in binary using a magnetized needle on the
exposed tape! I don't need any of this newfangled bull.

I kid! But I am curious to see why people are so opposed to this stuff?
The attitude I can't see any reason for it to exist (without having
seriously tried it) seems similar to that our (haskell's) detractors use
when taking a cursory glance at it and saying the syntax doesn't make
sense.


I pointed out one pragmatic problem, and even a workaround; this is not 
a case of hugging an old magnetized needle. Perhaps you should take more 
than a cursory glance of my message before saying that the stance 
doesn't make sense. If you have misplaced it, here it is again:

http://article.gmane.org/gmane.comp.lang.haskell.cafe/84003

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


Re: [Haskell-cafe] LLVM, getElementPtr?

2010-12-05 Thread Lally Singh
No wait, sorry.

buildReaderFun :: String - CodeGenModule (Function (IO ()))
buildReaderFun nm = do
  puts - newNamedFunction ExternalLinkage puts :: TFunction (Ptr
Word8 - IO Word32)
  let callPuts greetz = createFunction ExternalLinkage $ do
  tmp - getElementPtr greetz (0 :: Word32,(0 :: Word32, ()))
  call puts  tmp -- Throw away return value.
  ret ()
  withStringNul nm callPuts

Is that how it's intended?

Cheers,
-Lally


On Sun, Dec 5, 2010 at 3:35 PM, Lally Singh lally.si...@gmail.com wrote:
 Thanks for your help.  Replying inline

 On Sun, Dec 5, 2010 at 1:28 PM, Henning Thielemann
 lemm...@henning-thielemann.de wrote:

 On Sun, 5 Dec 2010, Lally Singh wrote:

 Hey all, I'm trying to get started generating LLVM code, but I'm
 getting a rather cryptic error.

 Btw. there is haskell-l...@projects.haskell.org

 buildReaderFun :: String - CodeGenModule (Function (IO ()))
 buildReaderFun nm = do
  puts - newNamedFunction ExternalLinkage puts :: TFunction (Ptr
 Word8 - IO Word32)
  greetz - createStringNul nm
  func - createFunction ExternalLinkage $ do
   tmp - getElementPtr0 greetz (0 :: Word32, ())

 You have to add a type annotation to greetz like
   (greetz :: Array D42 Word8)
  which limits your string to a length of 42 bytes.

 If you do not know the length, better use withStringNul.
 I implemented the current behavior, because the former implementation was
 unsafe.

 I'm sorry, the type signature for withStringNul is over my head.
 withStringNul ::
   String -
   (forall n. (Nat n) = Global (Array n Word8) - CodeGenModule a) -
   CodeGenModule a

 On the LLVM side, I'm looking to simply create a string constant I can
 pass in, such as ConstantArray::get(..).

 I *think* withStringNul will generate code to build a runtime-length
 determined string?   Sorry, I'm a little thick.

   call puts  tmp -- Throw away return value.
   ret ()
  return func

 My attempts at figuring out what type-level has to do with this, and
 how to satisfy it have so far proven unsuccessful.

 type-level provides type level integers, and thus allows for static checking
 of sizes, such as the number of bits of an integer type.

 Thanks -- sorry -- I'm guessing it's to make sure we're generating valid code?

 Cheers,
 -Lally


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


Re: [Haskell-cafe] Strange error when using Attoparsec and Enumerator

2010-12-05 Thread John Millikin
I swear attoparsec-enumerator is going to give me grey hair; the error
you're receiving is because iterParser itself is divergent. Fixed in
0.2.0.3, with my sincere apologies.

On Sun, Dec 5, 2010 at 09:14, Crutcher Dunnavant crutc...@gmail.com wrote:
 I have spent a good chunk of the past week tracing code, trying to
 solve this problem. I'm seeing an error when using Enumerator and
 Attoparsec that I can't explain. This is a reduced form of the
 problem.

 In general, I've observed that debugging broken iterators and
 enumerators is very hard. We probably want some tooling around that;
 I'm looking at an identity enumeratee with debug.trace shoved in, or
 something like that, not sure yet what would help.

 {-
 Haskell 2010, ghc 6.12.3
 array-0.3.0.2
 attoparsec-0.8.2.0
 attoparsec-enumerator-0.2.0.2
 bytestring-0.9.1.7
 containers-0.4.0.0
 deepseq-1.1.0.2
 enumerator-0.4.2
 text-0.10.0.0
 transformers-0.2.2.0
 -}
 import Control.Applicative ((|))
 import qualified Data.Attoparsec.Char8 as AP
 import qualified Data.Attoparsec.Combinator as APC
 import qualified Data.Attoparsec.Enumerator as APE
 import qualified Data.ByteString.Char8 as B
 import qualified Data.Enumerator as E
 import Data.Enumerator (($$))
 import System.IO as IO

 parseLine :: AP.Parser B.ByteString
 parseLine = do
  AP.char '+'
  return . B.pack = APC.manyTill AP.anyChar endOfLineOrInput

 endOfLineOrInput :: AP.Parser ()
 endOfLineOrInput = AP.endOfInput | AP.endOfLine

 pp :: Show a = AP.Parser a - String - IO ()
 pp p s = do
  result - E.run $
    E.enumList 1 [ B.pack s ]
    $$ E.sequence (APE.iterParser p)
    $$ E.printChunks False
  case result of
    (Right _) - return ()
    (Left e)  - IO.hPutStrLn stderr $ show e

 main = pp parseLine +OK
 {-
 Observed output:
 [OK]
 *** Exception: enumEOF: divergent iteratee

 Problems with this:
 1) I didn't write an iteratee, enumerator, or enumeratee in this code.
 Something's wrong.

 2) If the parser is divergent, I _should_ be getting the error message:
  iterParser: divergent parser
 -}

 --
 Crutcher Dunnavant crutc...@gmail.com

 ___
 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] Strange error when using Attoparsec and Enumerator

2010-12-05 Thread Crutcher Dunnavant
Oh thank you!

I can't believe the number of times I read through that code without
seeing that.

On Sun, Dec 5, 2010 at 12:49 PM, John Millikin jmilli...@gmail.com wrote:
 I swear attoparsec-enumerator is going to give me grey hair; the error
 you're receiving is because iterParser itself is divergent. Fixed in
 0.2.0.3, with my sincere apologies.

 On Sun, Dec 5, 2010 at 09:14, Crutcher Dunnavant crutc...@gmail.com wrote:
 I have spent a good chunk of the past week tracing code, trying to
 solve this problem. I'm seeing an error when using Enumerator and
 Attoparsec that I can't explain. This is a reduced form of the
 problem.

 In general, I've observed that debugging broken iterators and
 enumerators is very hard. We probably want some tooling around that;
 I'm looking at an identity enumeratee with debug.trace shoved in, or
 something like that, not sure yet what would help.

 {-
 Haskell 2010, ghc 6.12.3
 array-0.3.0.2
 attoparsec-0.8.2.0
 attoparsec-enumerator-0.2.0.2
 bytestring-0.9.1.7
 containers-0.4.0.0
 deepseq-1.1.0.2
 enumerator-0.4.2
 text-0.10.0.0
 transformers-0.2.2.0
 -}
 import Control.Applicative ((|))
 import qualified Data.Attoparsec.Char8 as AP
 import qualified Data.Attoparsec.Combinator as APC
 import qualified Data.Attoparsec.Enumerator as APE
 import qualified Data.ByteString.Char8 as B
 import qualified Data.Enumerator as E
 import Data.Enumerator (($$))
 import System.IO as IO

 parseLine :: AP.Parser B.ByteString
 parseLine = do
  AP.char '+'
  return . B.pack = APC.manyTill AP.anyChar endOfLineOrInput

 endOfLineOrInput :: AP.Parser ()
 endOfLineOrInput = AP.endOfInput | AP.endOfLine

 pp :: Show a = AP.Parser a - String - IO ()
 pp p s = do
  result - E.run $
    E.enumList 1 [ B.pack s ]
    $$ E.sequence (APE.iterParser p)
    $$ E.printChunks False
  case result of
    (Right _) - return ()
    (Left e)  - IO.hPutStrLn stderr $ show e

 main = pp parseLine +OK
 {-
 Observed output:
 [OK]
 *** Exception: enumEOF: divergent iteratee

 Problems with this:
 1) I didn't write an iteratee, enumerator, or enumeratee in this code.
 Something's wrong.

 2) If the parser is divergent, I _should_ be getting the error message:
  iterParser: divergent parser
 -}

 --
 Crutcher Dunnavant crutc...@gmail.com

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





-- 
Crutcher Dunnavant crutc...@gmail.com

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


Re: [Haskell-cafe] the beginning of the end

2010-12-05 Thread Ozgur Akgun
On 5 December 2010 20:22, Brandon S Allbery KF8NH allb...@ece.cmu.eduwrote:

 On 12/5/10 15:07 , Andrew Coppin wrote:
  you actually cannot do something as trivial as follow a conversation

 You can, just not via the web site.  I do it in Tweetdeck all the time.


You can also do it via the website, sort of.

If a tweet is a reply to another one, there is a in reply to link right
under the tweet. I guess other client applications (like tweetdeck) use this
link to create a conversation view.

I suppose, it is quite similar to what happens with e-mail.

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


[Haskell-cafe] New Xmobar maintainer: request for comments

2010-12-05 Thread Jose A. Ortega Ruiz

Hi,

I've recently accepted Andrea Rossato's kind offer to take over
maintainership of xmobar, and i wanted to ask for feedback to the
community. My apologies for cross-posting to the cafe and xmonad, but
xmobar didn't have a mailing list until a couple days ago.

My immediate plans are to fix some low-hanging bugs, incorporate a
handful of patches and contributions i have in my repo and make a new
release (0.12). Besides that, i've created a mailing list
(xmo...@projects.haskell.org,
http://projects.haskell.org/cgi-bin/mailman/listinfo/xmobar, also
mirrored at gmane.comp.lang.haskell.xmobar) and i will move xmobar's
homepage to http://projects.haskell.org/xmobar (not done yet).

Perhaps more disruptingly, i'm thinking of moving source code management
from darcs to git (right now, i maintain a _mirror_ at github,
http://github.com/jaor/xmobar). But xmobar has a very lively user base
and many contributors, and i wouldn't like to alienate or disturb
anyone: would that move be frown upon by the community?

I also plan to keep hacking and adding (not many) features to xmobar in
the future, and would be delighted to hear from you: please, do not
hesitate to send your feature requests or any other comment directly to
me or to the new list.

Thanks in advance for your feedback, and special thanks to Andrea for
creating xmobar and giving me this great chance of being more than a
mere spectator of the haskell world.

Cheers,
jao
-- 
Fools ignore complexity. Pragmatists suffer it. Some can avoid it.
Geniuses remove it.
  - Alan Perlis, Epigrams in Programing

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


Re: [Haskell-cafe] [Haskell] haskell.org migration complete

2010-12-05 Thread Henning Thielemann
Thomas Schilling schrieb:

 On 5 December 2010 08:29, Henning Thielemann

 I liked to add that the Category link on each Wiki page is missing.
 
 It's at the bottom of each page.

I promise that I scrolled up and down several times before complaining,
but I did not find it, and still do not see it. I use Konqueror/KDE3.

 As Mark mentioned, there's the MonoBook theme which you can set as
 your default when you log in.  Of course, if you don't want to log in
 that doesn't help.

It would be good, if it would be consistent with Hackage-DB.


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


Re: [Haskell-cafe] Conditional compilation for different versions of GHC?

2010-12-05 Thread Henning Thielemann
Jason Dagit schrieb:

 I see that others have provided answers on here, but another way is to
 change the check from:
 
if flag(ghc7)
build-depends:   base  = 4.35
cpp-options: -DGHC7
else
build-depends:   base  = 4  4.3
 
 to this:
if impl(ghc = 7)
build-depends:   base  = 4.35
cpp-options: -DGHC7
else
build-depends:   base  = 4  4.3

Isn't it better to move the dependency on 'base' out of the If block? I
mean, someone might succeed to use GHC-7 with base-4.2 or GHC7 or a
different compiler with base-4.3.


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


Re: [Haskell-cafe] Strange error when using Attoparsec and Enumerator

2010-12-05 Thread Gregory Collins
On Sun, Dec 5, 2010 at 6:14 PM, Crutcher Dunnavant crutc...@gmail.com wrote:

 In general, I've observed that debugging broken iterators and
 enumerators is very hard. We probably want some tooling around that;
 I'm looking at an identity enumeratee with debug.trace shoved in, or
 something like that, not sure yet what would help.

Hi Crutcher,

I have some enumerator debug code here:

  
https://github.com/snapframework/snap-core/blob/8c9b7098751784b9d88dff68524ed2558c03c3d8/src/Snap/Internal/Iteratee/Debug.hs

It's a little bit snap-specific (uses our debug machinery) but helps
me a lot when debugging iteratee stuff. Shouldn't be hard to port.

It contains a debug iteratee (which just prints its input to stdout)
and an iteratee wrapper which logs its input using the Snap debug
mechanism before passing it on to the wrapped iteratee.

G
-- 
Gregory Collins g...@gregorycollins.net

___
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-05 Thread wren ng thornton

On 12/5/10 11:23 AM, Ketil Malde wrote:

Florian Lengyelflorian.leng...@gmail.com  writes:


Why is there even any consideration of some committee if someone wants to
mirror the Hackage site? Why not mirror the site?


+1

   Alright, Mr. Wiseguy, she said, if you're so clever, you tell us
   what colour it should be.

We can either let Dan set up a mirror, and add it to the haskell.org DNS
(or just let it live at a different address), and have a mirror up in a
couple of hours -- or we can set up 501(c)(3)s (whatever they are),
decide on a payment service, write bylaws, hire lawyers etc.  All in the
name of not-dealing-with-this-shit¹?


Or? There's no need to be exclusive. Fact is that haskell.org has some 
money and needs to deal with that, so incorporating is just a matter of 
time. But that doesn't preclude folks setting up mirrors or doing 
anything non-money related. All one needs to do is convince the DNS 
owners to add your IP# to their entry.


501(c)(3) is the legal term for a class of US organizations more 
typically known as non-profit organizations. By incorporating as a 
501(c)(3) you get the benefits and responsibilities of being a 
government-recognized organization (e.g., rights to use a company name 
and prevent others from using it, certain kinds of indemnification 
against legal action, ability to act as a legal entity in other ways, 
rights to collect money, responsibility to pay taxes,...)


--
Live well,
~wren

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


Re: [Haskell-cafe] OverloadedStrings mixed with type classes leads toboilerplate type signatures

2010-12-05 Thread Claus Reinke

   ghci :set -XOverloadedStrings
   ghci $name ate a banana. % [(name, Johan)]
   Johan ate a banana.



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

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


This instance only applies if the pair components are Texts.

With OverloadedStrings, your unannotated String-like Pairs
have variable type components, so the instances neither
matches nor forces the type variables to be Text.

It sounds as if you want an instance that always applies for
lists of pairs, instantiates type variable components to Texts,
and fails if the components cannot be Texts. Untested:

   instance (key~T.Text,value~T.Text) = Context [(key, value)] where

You might also want to parameterize Context over the
type of template, but then you might need to annotate
the template type, or use separate ops for different types
of template?

Claus


   --  $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 mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Conditional compilation for different versions of GHC?

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

On 12/5/10 17:05 , Henning Thielemann wrote:
 Isn't it better to move the dependency on 'base' out of the If block? I
 mean, someone might succeed to use GHC-7 with base-4.2 or GHC7 or a
 different compiler with base-4.3.

Since the base package is (with good reason) part of the compiler, anyone
smart enough to get that to work is smart enough to edit the cabal file.

- -- 
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/

iEYEARECAAYFAkz8GukACgkQIn7hlCsL25WTxACfc4k/3GoQr402TbVFmabRD7sJ
7WEAoMnmLeaKGfjQdjdP4K60Ch6g72md
=LZuU
-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-05 Thread John D. Ramsdell
I forgot to say what performance I got out of the new version of the
compiler on my application.  I turns out a standard benchmark ran ever
so slightly slower after being compiled by 7.0.1 as compared with
6.12.1.  Nothing exciting to report here.

John

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


Re: [Haskell-cafe] the beginning of the end

2010-12-05 Thread Jason Dagit
On Sun, Dec 5, 2010 at 9:00 AM, Brandon S Allbery KF8NH allb...@ece.cmu.edu
 wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 On 12/4/10 21:35 , Jason Dagit wrote:
  In that case, here you go:
  http://twitter.com/statuses/user_timeline/216043045.rss
  http://twitter.com/statuses/user_timeline/17788765.rss
 
  You can get those by finding them on twitter and then clicking the RSS
 link.

 Twitter might be the one idea worse than reddit for this kind of thing


The point is: The OP asked for an email notification, and failing that RSS
feeds.   Twitter, whether you want to use it or not, provides RSS feeds.
 You don't even need a twitter account to view them.

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


[Haskell-cafe] Storables and Ptrs

2010-12-05 Thread Tyler Pirtle
Hi cafe,

I'm just getting into Foreign.Storable and friends and I'm confused
about the class storable. For GHC, there are instances of storable for
all kinds of basic types (bool, int, etc) - but I can't find the
actual declaration of those instances.

I'm confused that it seems that all Storable instances operate on a
Ptr, yet none of these types allow access to an underlying Ptr. I
noticed that it's possible via Foreign.Marshal.Utils to call 'new' and
get a datatype wrapped by a Ptr, but this isn't memory managed - I'd
have to explicitly free it? Is that my only choice?

Is there a way that given just simply an Int I could obtain a Ptr from
it, and then invoke the storable functions on it? Or for that matter,
if I go and create some new data type, is there some generic
underlying thing (ghc-only or otherwise) that would let me have a Ptr
of it?

Thanks,


Tyler

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


Re: [Haskell-cafe] Storables and Ptrs

2010-12-05 Thread Antoine Latter
On Sun, Dec 5, 2010 at 10:45 PM, Tyler Pirtle tee...@gmail.com wrote:
 Hi cafe,

 I'm just getting into Foreign.Storable and friends and I'm confused
 about the class storable. For GHC, there are instances of storable for
 all kinds of basic types (bool, int, etc) - but I can't find the
 actual declaration of those instances.

 I'm confused that it seems that all Storable instances operate on a
 Ptr, yet none of these types allow access to an underlying Ptr. I
 noticed that it's possible via Foreign.Marshal.Utils to call 'new' and
 get a datatype wrapped by a Ptr, but this isn't memory managed - I'd
 have to explicitly free it? Is that my only choice?

The Storable class defines how to copy a particular Haskell type to or
from a raw memory buffer - specifically represented by the Ptr type.
It is most commonly used when interacting with non-Haskell (or
'Foreign') code, which is why a lot of the tools look like they
require manual memory management (because foreign-owned resources must
often be managed separately anyway).

Not all of the means of creating a Ptr type require manual memory
management - the 'alloca' family of Haskell functions allocate a
buffer and then free it automatically when outside the scope of the
passed-in callback (although 'continuation' or 'action' would be the
more Haskell-y way to refer to the idea):

alloca :: Storable a = (Ptr a - IO b) - IO b

This can be used to call into C code expecting pointer input or output
types to great effect:

wrapperAroundForeignCode :: InputType - IO OutputType
wrapperAroundForeignCode in =
  alloca $ \inPtr -
  alloca $ outPtr - do
poke inPtr in
c_call inPtr outPtr
peek outPtr

The functions 'peek' and 'poke' are from the Storable class, and I
used the 'alloca' function to allocate temporary storage for the
pointers I pass into C-land.

Is there a particular problem you're trying to solve? We might be able
to offer more specific advice. The Storable and Foreign operations may
not even be the best solution to what you're trying to do.

Take care,
Antoine



 Is there a way that given just simply an Int I could obtain a Ptr from
 it, and then invoke the storable functions on it? Or for that matter,
 if I go and create some new data type, is there some generic
 underlying thing (ghc-only or otherwise) that would let me have a Ptr
 of it?

 Thanks,


 Tyler

 ___
 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] Small strings

2010-12-05 Thread Antoine Latter
Hi Haskell,

I've recently created the 'smallstring' package[1] and put it on
Hackage. The goal was to create a string-like type with as little
memory overhead as possible, and to have equality and comparison
operations be competitive with the native String type. The idea is
that this type would make ideal keys into data structures like
Data.Map.

I've taken pains to make the library portable to other compilers, but
this isn't really tested, and most of my recent development has been
on GHC 7. The library is young and likely has places it could be
improved, so your feedback is welcome.

The API provided is small - to/fromString along with Eq and Ord instances.

This isn't meant to be a replacement for the text[2] or bytestring[3]
packages - the reduced size comes at a cost. Both of these libraries
offer substring manipulation functions which allow the sharing of the
backing memory buffers. Also, I haven't implemented any sort of
string-like operations on the type as it isn't the right thing for
that.

I've borrowed heavily from the previously mentioned text package for
the underlying array implementation, so thanks goes to Bryan
O'Sullivan for maintaining the package and to all of the other authors
as well.

Take care,
Antoine

[1] http://hackage.haskell.org/package/smallstring
[2] http://hackage.haskell.org/package/text
[3] http://hackage.haskell.org/package/bytestring

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


Re: [Haskell-cafe] Small strings

2010-12-05 Thread Michael Snoyman
On Mon, Dec 6, 2010 at 8:04 AM, Antoine Latter aslat...@gmail.com wrote:
 Hi Haskell,

 I've recently created the 'smallstring' package[1] and put it on
 Hackage. The goal was to create a string-like type with as little
 memory overhead as possible, and to have equality and comparison
 operations be competitive with the native String type. The idea is
 that this type would make ideal keys into data structures like
 Data.Map.

 I've taken pains to make the library portable to other compilers, but
 this isn't really tested, and most of my recent development has been
 on GHC 7. The library is young and likely has places it could be
 improved, so your feedback is welcome.

 The API provided is small - to/fromString along with Eq and Ord instances.

 This isn't meant to be a replacement for the text[2] or bytestring[3]
 packages - the reduced size comes at a cost. Both of these libraries
 offer substring manipulation functions which allow the sharing of the
 backing memory buffers. Also, I haven't implemented any sort of
 string-like operations on the type as it isn't the right thing for
 that.

 I've borrowed heavily from the previously mentioned text package for
 the underlying array implementation, so thanks goes to Bryan
 O'Sullivan for maintaining the package and to all of the other authors
 as well.

Is there a reason that you don't include an IsString instance?

Michael

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


Re: [Haskell-cafe] Small strings

2010-12-05 Thread Alexander Dunlap
On Sun, Dec 5, 2010 at 10:04 PM, Antoine Latter aslat...@gmail.com wrote:
 Hi Haskell,

 I've recently created the 'smallstring' package[1] and put it on
 Hackage. The goal was to create a string-like type with as little
 memory overhead as possible, and to have equality and comparison
 operations be competitive with the native String type. The idea is
 that this type would make ideal keys into data structures like
 Data.Map.

 I've taken pains to make the library portable to other compilers, but
 this isn't really tested, and most of my recent development has been
 on GHC 7. The library is young and likely has places it could be
 improved, so your feedback is welcome.

 The API provided is small - to/fromString along with Eq and Ord instances.

 This isn't meant to be a replacement for the text[2] or bytestring[3]
 packages - the reduced size comes at a cost. Both of these libraries
 offer substring manipulation functions which allow the sharing of the
 backing memory buffers. Also, I haven't implemented any sort of
 string-like operations on the type as it isn't the right thing for
 that.

 I've borrowed heavily from the previously mentioned text package for
 the underlying array implementation, so thanks goes to Bryan
 O'Sullivan for maintaining the package and to all of the other authors
 as well.

 Take care,
 Antoine

 [1] http://hackage.haskell.org/package/smallstring
 [2] http://hackage.haskell.org/package/text
 [3] http://hackage.haskell.org/package/bytestring

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


This looks really cool! Suggestion - would it be more efficient to
provide direct text - smallstring or bytestring - smallstring
functions rather than forcing clients to go through String? That might
be useful e.g. if you were parsing (bytestring/text) data and building
a Map in the process.

Alex

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


Re: [Haskell-cafe] Small strings

2010-12-05 Thread Antoine Latter
On Mon, Dec 6, 2010 at 12:09 AM, Alexander Dunlap
alexander.dun...@gmail.com wrote:

 This looks really cool! Suggestion - would it be more efficient to
 provide direct text - smallstring or bytestring - smallstring
 functions rather than forcing clients to go through String? That might
 be useful e.g. if you were parsing (bytestring/text) data and building
 a Map in the process.


I'll try to come up with a direct writer from text/bytestring and see
how they stack up against going via list. I expect the direct approach
to be faster if only because asking text/bytestring for their length
will be cheaper than asking a String for its length.

I'm a bit skeptical about the to/from bytestring function, though, as
I then provide a convenient way to get to String without specifying an
encoding. But I suppose folks will want it.

On Mon, Dec 6, 2010 at 12:08 AM, Michael Snoyman mich...@snoyman.com wrote:

 Is there a reason that you don't include an IsString instance?

 Michael


Laziness! This one should be easy.

Antoine

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


Re: [Haskell-cafe] the beginning of the end

2010-12-05 Thread David Virebayre
2010/12/5 Andrew Coppin andrewcop...@btinternet.com

 I get Haskell. It's a programming language. You write programs with it. I get 
 VB - even if I think it sucks. But something like Stack Overflow, I find 
 myself just staring at it thinking what the hell /is/ this thing?

It's quite simple.

Level 1

- You have an unresolved programming problem. You ask the question on
stack overflow. People give you answers.
- You can (if you wish) provide answers for questions others have asked.

Level 2

To weed out bad material, answers and questions are voted up or down
(supposedly) based on their pertinence, by the users.

Level 3

Each upvote earns a user some points, and the opposite for a downvote.
Users then have a score. Answers from a user with a high score might
be more reliable.

Level 4

There is a system of badges to earn, perhaps so that one finds some
extra amusement in helping others.

Level 5

I'm out of layers here. I think this is all there is to it.

David.

___
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-05 Thread Vincent Hanquez

 I would really like mirrors too.

But before that happens it would be nice to have signed packages on 
Hackage, preventing

a mirror to distribute compromised stuff (intentionally or unintentionally).

--
Vincent

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