[Haskell-cafe] getting fulling qualified names of types from hint/ghc api

2011-01-19 Thread Pasqualino Titto Assini
Hi,

I am using hint's Language.Haskell.Interpreter.typeOf function to
dynamically get the type of a haskell expression but, unfortunately
for my purposes, I see that it returns unqualified names (I see in
Hint.Conversions that it uses the GHC function GHC.getPrintUnqual).

Is there any function in the GHC api or any other simple way of
getting the fully qualified types?

Surprisingly, I could not find any.

Thanks,

   titto

-- 
Dr. Pasqualino Titto Assini
http://quid2.org/

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


Re: [Haskell-cafe] class-instance

2011-01-19 Thread Ryan Ingram
I don't think that's exactly what you want, though.  name (2::Int)
crashes your program.

I think you really want a data type.

data Person a b = P a b

pid :: Person a b - a
pid (P a _) = a

pname :: Person a b - b
pname (P _ b) = b

Now, what it looks like you want is some kind of extensible relation

name 1 = john
name 2 = julie
etc.

but there's no simple way to specify this as an open function at the
value level.  You can make a list of all the people:

people = [ P 1 john, P 2 julie ]

name :: Int - Maybe String
name x = fmap pname $ safeHead $ filter ((== x) . pid) people

safeHead [] = Nothing
safeHead (x:_) = Just x

It's still not really clear what you are trying to do.

  -- ryan

On Mon, Jan 17, 2011 at 9:15 AM, Patrick Browne patrick.bro...@dit.ie wrote:
 A functional dependency seems to allow me to express my rather strange
 requirement.

 class Person i n | i  - n where
     pid :: i
     name :: i - n

 instance Person Int String where
     pid = 1
     name(1) = john


 -- name(pid::Int) will produce john

 Thanks for your help

 Pat



 On 17/01/2011 14:07, Patrick Browne wrote:
 On 17/01/2011 13:04, Ketil Malde wrote:
 So other PERSONs would have different types, say:

 I think the problem is there is just one constant p1 in the class and
 there needs to be multiple constants in the implementation (one for each
 person). It seems difficult to specify this using type classes So, some
 data declaration as you suggest will probably be needed.

 Thanks,
 Pat



 This message has been scanned for content and viruses by the DIT Information 
 Services E-Mail Scanning Service, and is believed to be clean. 
 http://www.dit.ie

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


 This message has been scanned for content and viruses by the DIT Information 
 Services E-Mail Scanning Service, and is believed to be clean. 
 http://www.dit.ie

 ___
 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] Happstack events and web page refreshing

2011-01-19 Thread Bas van Dijk
On 17 January 2011 21:50, Jeremy Shaw jer...@n-heptane.com wrote:

 On Jan 17, 2011, at 2:19 PM, Corentin Dupont wrote:

 Indeed, I tried with META HTTP-EQUIV=Refresh CONTENT=n ?
 and it's unusable.
 It make blink the page, ungrey the stop button for a second and make the
 fields loose the focus
 so it's impossible to type in.

 I'll try with XMLHTTPRequest.


 Right. Using the jQuery library should make it easier to do ajax requests
 and modify the DOM on the fly,
 http://jquery.com/
 - jeremy
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe



A nice variation of polling is long polling:

http://en.wikipedia.org/wiki/Push_technology#Long_polling

This can easily be accomplished in Haskell by having an MVar per
session. Initially an empty MVar is created per new session. When a
client makes a request, the server thread that handles the request
takes the MVar belonging to the session. This thread will block until
the MVar is filled. When the server has an update it will fill all the
MVars. This causes all the blocked threads to continue with sending a
response to the client notifying it about the update.

Like Jeremy said it's a good idea to make these update requests asynchronous.

Regards,

Bas

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


[Haskell-cafe] Problems installing the haskell platform

2011-01-19 Thread Henry Laxen
Dear Group,

Greetings.  I've been using haskell for about a year now, though I
will readily admit I still don't really know what I am doing when I
get error messages.  Today I decided to reset my haskell environment
from scratch, avoiding the debian packages and going straight to the
source.



1. Install ghc from http://www.haskell.org/ghc/download_ghc_6_12_3

Success!!

ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.12.3

cabal update
Downloading the latest package list from hackage.haskell.org

2. Next I downloaded the haskell platform and ran cabal install
Problems!!

cabal: Error: some packages failed to install:
haskell-platform-2010.2.0.0 depends on stm-2.1.2.1 which failed to
install.
stm-2.1.2.1 failed during the building phase. The exception was:
ExitFailure 1

3. So I tried installing stm manually, which for some unknown reason
worked:

runghc Setup.hs install
Installing library in /usr/local/lib/stm-2.1.2.1/ghc-6.12.3
Registering stm-2.1.2.1...

4. back to the haskell-platform directory and try again:

cabal install
Resolving dependencies...
Configuring haskell-platform-2010.2.0.0...
setup: happy version ==1.18.5 is required but the version found at
/usr/local/bin/happy is version 1.18.6
cabal: Error: some packages failed to install:
haskell-platform-2010.2.0.0 failed during the configure step. The
exception
was:
ExitFailure 1

5. Crap.  Okay, maybe it will work with version 1.18.6 after all, so I
edit the .cabal and change happy ==1.18.5 to happy =1.18.5

  -- Depending on programs does not work, they are not registered
  -- We list them to help distro packaging.
  build-tools:
cabal-install ==0.8.2,
alex  ==2.3.3,
happy =1.18.5
-- haddock   ==2.7.2 -- valid, but needs ghc-paths

6. Try again

cabal install
Resolving dependencies...
Configuring haskell-platform-2010.2.0.0...
Preprocessing library haskell-platform-2010.2.0.0...
Building haskell-platform-2010.2.0.0...
Registering haskell-platform-2010.2.0.0...
Installing library in /usr/local/lib/haskell-platform-2010.2.0.0/
ghc-6.12.3
Registering haskell-platform-2010.2.0.0...

7. Success!!

Now even though I'm not sure what I am doing, it looks like it may
have worked.  I'm worried, though, about the first time user who tries
to go through this process.  They will probably stop at the first
error, when the haskell-platform fails to install.

I know some of you will say use the debian packages.  Well I did that,
but when I tried to install snap, which is not included in the debian
packages, I wound up with conflicting dependencies, and could not find
a way out.  I hope this dialog is helpful to whomever is in charge of
the haskell platform, a wonderful resource by the way.

Best wishes,
Henry Laxen



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


Re: [Haskell-cafe] Happstack events and web page refreshing

2011-01-19 Thread Corentin Dupont
Thanks.
There seems to be several technologies to realize this push or polling.

Is what you explained feasible on the user's side of happstack-server (I
mean, if I can do it myself)?
If I take an empty MVar in my ServerPartTs, which are read over client's
request,
I think that nothing will be sent back to the browser and it will remain
blank!
Is that to be combined with an HTTP refresh timer on the client side?

By sessions, you mean sessions that I create myself for every client
connected?

Regards,
Corentin



On Wed, Jan 19, 2011 at 2:21 PM, Bas van Dijk v.dijk@gmail.com wrote:

 On 17 January 2011 21:50, Jeremy Shaw jer...@n-heptane.com wrote:
 
  On Jan 17, 2011, at 2:19 PM, Corentin Dupont wrote:
 
  Indeed, I tried with META HTTP-EQUIV=Refresh CONTENT=n ?
  and it's unusable.
  It make blink the page, ungrey the stop button for a second and make
 the
  fields loose the focus
  so it's impossible to type in.
 
  I'll try with XMLHTTPRequest.
 
 
  Right. Using the jQuery library should make it easier to do ajax requests
  and modify the DOM on the fly,
  http://jquery.com/
  - jeremy
  ___
  Haskell-Cafe mailing list
  Haskell-Cafe@haskell.org
  http://www.haskell.org/mailman/listinfo/haskell-cafe
 
 

 A nice variation of polling is long polling:

 http://en.wikipedia.org/wiki/Push_technology#Long_polling

 This can easily be accomplished in Haskell by having an MVar per
 session. Initially an empty MVar is created per new session. When a
 client makes a request, the server thread that handles the request
 takes the MVar belonging to the session. This thread will block until
 the MVar is filled. When the server has an update it will fill all the
 MVars. This causes all the blocked threads to continue with sending a
 response to the client notifying it about the update.

 Like Jeremy said it's a good idea to make these update requests
 asynchronous.

 Regards,

 Bas

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


Re: [Haskell-cafe] Happstack events and web page refreshing

2011-01-19 Thread Vo Minh Thu
Hi,

I've not really followed the thread, but on the client side, for
long-polling, you issue an XMLHttpRequest that will receive an answer
from the server only when the server has something to push to the
client (maybe done with a thread waiting on an MVar). XHR is
asynchronous as you have to supply a callback to process the server's
response.

Usually an XHR request is done from an already loaded page and will
update part of that page with the content of the server's response. So
no blank page.

(So no timer needed either, this is done asynchronously with callbacks.)

HTH,
Thu

2011/1/19 Corentin Dupont corentin.dup...@gmail.com:
 Thanks.
 There seems to be several technologies to realize this push or polling.

 Is what you explained feasible on the user's side of happstack-server (I
 mean, if I can do it myself)?
 If I take an empty MVar in my ServerPartTs, which are read over client's
 request,
 I think that nothing will be sent back to the browser and it will remain
 blank!
 Is that to be combined with an HTTP refresh timer on the client side?

 By sessions, you mean sessions that I create myself for every client
 connected?

 Regards,
 Corentin



 On Wed, Jan 19, 2011 at 2:21 PM, Bas van Dijk v.dijk@gmail.com wrote:

 On 17 January 2011 21:50, Jeremy Shaw jer...@n-heptane.com wrote:
 
  On Jan 17, 2011, at 2:19 PM, Corentin Dupont wrote:
 
  Indeed, I tried with META HTTP-EQUIV=Refresh CONTENT=n ?
  and it's unusable.
  It make blink the page, ungrey the stop button for a second and make
  the
  fields loose the focus
  so it's impossible to type in.
 
  I'll try with XMLHTTPRequest.
 
 
  Right. Using the jQuery library should make it easier to do ajax
  requests
  and modify the DOM on the fly,
  http://jquery.com/
  - jeremy
  ___
  Haskell-Cafe mailing list
  Haskell-Cafe@haskell.org
  http://www.haskell.org/mailman/listinfo/haskell-cafe
 
 

 A nice variation of polling is long polling:

 http://en.wikipedia.org/wiki/Push_technology#Long_polling

 This can easily be accomplished in Haskell by having an MVar per
 session. Initially an empty MVar is created per new session. When a
 client makes a request, the server thread that handles the request
 takes the MVar belonging to the session. This thread will block until
 the MVar is filled. When the server has an update it will fill all the
 MVars. This causes all the blocked threads to continue with sending a
 response to the client notifying it about the update.

 Like Jeremy said it's a good idea to make these update requests
 asynchronous.

 Regards,

 Bas


 ___
 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] Problems installing the haskell platform

2011-01-19 Thread Joachim Breitner
Hi,

Am Mittwoch, den 19.01.2011, 13:52 + schrieb Henry Laxen:
 I know some of you will say use the debian packages.  Well I did that,
 but when I tried to install snap, which is not included in the debian
 packages, I wound up with conflicting dependencies, and could not find
 a way out.  I hope this dialog is helpful to whomever is in charge of
 the haskell platform, a wonderful resource by the way. 

I’m not trying to talk you out of building everything on your own, which
is something where you learn a lot. Nevertheless I’m curious which kind
of problems you had when trying to use the Debian packages, and if they
are specific to the Debian packages?

My experience with ghc and lots of package from Debian, cabal-install
from Debian and then cabal install’ing (as a user!) everything not in
Debian is pretty good so far.

Greetings,
Joachim

-- 
Joachim nomeata Breitner
  mail: m...@joachim-breitner.de | ICQ# 74513189 | GPG-Key: 4743206C
  JID: nome...@joachim-breitner.de | http://www.joachim-breitner.de/
  Debian Developer: nome...@debian.org


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] Happstack events and web page refreshing

2011-01-19 Thread Bas van Dijk
On 19 January 2011 15:02, Corentin Dupont corentin.dup...@gmail.com wrote:
 Is what you explained feasible on the user's side of happstack-server (I
 mean, if I can do it myself)?

Yes, you can do it yourself.

 If I take an empty MVar in my ServerPartTs, which are read over client's
 request,
 I think that nothing will be sent back to the browser and it will remain
 blank!

Yes, which is the intention.

Here's a short incomplete and non type-checked snapshot of an
application I'm currently developing which uses long-polling:

Somewhere on the client you have the following Javascript which uses
the JQuery library:

update = function(){
  $.ajax({url: update, success: onUpdate});
}

onUpdate = function(data){
  // Update your page, possibly by making more ajax requests to the server...
  update();
}

Now when you call update() the client will asynchronously request the
server for updates. Each time there's an update the onUpdate function
is run which gives you a chance to update your page. onUpdate will
finally call update() again for the next iteration.

Now on the server side you need something like this:

main :: IO ()
main = do
  sessionStore  - newSessionStore
  forkIO (updateLoop sessionStore)
  simpleHTTP conf $ msum
[ dir  update (update sessionStore), ... ]

update :: SessionStore - ServerPartT IO Response
update sessionStore = do
  mvar - getSessionData sessionStore
  liftIO $ takeMVar mvar
  return someResponse

getSessionData will check if there's an active session and if so will
return the associated MVar. If there's no active session a new one
will be created which will have an empty MVar associated with it.

updateLoop is a loop that creates a new update and then notifies the clients:

updateLoop :: SessionStore - IO ()
updateLoop store = forever $ do
  makeNewUpdate
  notifySessions store

notifySessions :: SessionStore - IO ()
notifySessions store = do
  sessionData - getAllSessionData store
  mapM_ (\mv - tryPutMVar mv ()) sessionData

Note that it's not necessary to have a separate thread for creating
updates and notifying clients. You can just as well do this in one of
your request handlers.

I know the example is incomplete but I hope I got the essentials across.

 Is that to be combined with an HTTP refresh timer on the client side?

No, as Thu already explain, no HTTP refresh timer is needed.

 By sessions, you mean sessions that I create myself for every client
 connected?

Yes. However, I don't think sessions are required for long-polling. I
just used them in my example because I used them in a similar way in
an application I'm currently developing.

Regards,

Bas

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


Re: [Haskell-cafe] web-routes and forms

2011-01-19 Thread Corentin Dupont
Thanks Jeremy.
I had it to work now ;)

Corentin

On Tue, Jan 18, 2011 at 6:01 PM, Jeremy Shaw jer...@n-heptane.com wrote:

 Hello,

 trhsx will be installed in ~/.cabal/bin, so you will need to add that
 to your PATH.

 In order to use the demo code I provided you would need the latest
 happstack from darcs because it contains a few differences in the API.
 The code can be made to work with what is on hackage though.

 The submit issue is actually a bug in digestive-functors-blaze. The
 return type should be, Form m i e BlazeFormHtml (). jaspervdj is going
 to patch it and upload a new version.

 - jeremy


 On Thu, Jan 13, 2011 at 2:40 PM, Corentin Dupont
 corentin.dup...@gmail.com wrote:
  Hello,
 
  I'm using the combination happstack + digestive-functors + web-routes +
  blazeHTML.
  I'm not finding any examples on the net...
 
  I've tried to adapt your example (thanks):
 
  type NomicForm a = HappstackForm IO String BlazeFormHtml a
 
  demoForm :: NomicForm (Text, Text)
  demoForm =
  (,) $ ((TDB.label greeting:  ++ inputNonEmpty Nothing) * br)
  * ((TDB.label noun:  ++ inputNonEmpty Nothing) * br)
  *  (submit submit)
  where
br :: NomicForm ()
br = view H.br
-- make sure the fields are not blank, show errors in line if they
 are
inputNonEmpty :: Maybe Text - NomicForm Text
inputNonEmpty v =
(inputText v `validate` (TD.check You can not leave this field
  blank. (not . T.null)) ++ errors)
 
 
  But I've got a problem on submit and inputText. I don't see how they are
  compatible with HappstackForm.
  NomicForm a reduces to:
  Form (ServerPartT IO) Input String BlazeFormHtml a
 
  whereas the type of submit is:
 
  submit :: Monad m
 
 = String-- ^ Text on the submit
 button
 
 - Form m String e BlazeFormHtml ()  -- ^ Submit button
 
 
  Maybe I miss some instance?
 
  BTW, I also tried to execute your exemple, but I can't install some
  packages.
 
  cabal install digestive-functors-hsp
 
  cabal: Unknown build tool trhsx
 
  Whereas trhsx is in my PATH (under linux).
 
  You said I need the latest happstack from darcs, why?
 
  Cheers,
  Corentin
 
  On Sun, Jan 9, 2011 at 8:36 PM, Jeremy Shaw jer...@n-heptane.com
 wrote:
 
  Hello,
 
  newRule also needs to have the type, RoutedNomicServer. The
  transformation of RoutedNomicServer into NomicServer is done in the
  handleSite function. Something like this:
 
 
  nomicSpec :: ServerHandle - Site Route (ServerPartT IO Response)
  nomicSpec sh =
   Site { handleSite  = \f url - unRouteT (nomicSite sh url)
 f
  ...
 
  main =
 do ...
   simpleHTTP nullConf $ siteImpl (nomicSpec sh)
 
  Or something like that -- it's hard to tell exactly what is going on
  in your app based on the snippets you provided.
 
  Also, I highly recommend using digestive functors instead of formlets.
  It is the successor to formlets. Same core idea, better implementation
  and actively maintained.
 
  I have attached a quick demo of using:
 
  happstack+digestive-functors+web-routes+HSP
 
  To use it you will need the latest happstack from darcs plus:
 
   hsp
   web-routes
   web-routes-hsp
   web-routes-happstack
   web-routes-mtl
   digestive-functors
   digestive-functors-hsp
 
  I plan to clean up this example and document it better in the crash
  course for the upcoming release. Clearly things like the FormInput
  instance and the formPart function belong a library.
 
  let me know if you have more questions.
  - jeremy
 
  On Sat, Jan 8, 2011 at 6:44 PM, Corentin Dupont
  corentin.dup...@gmail.com wrote:
   Hello,
  
   I have difficulties mixing web-routes and forms:
   I have put routes in all my site, except for forms which remains with
   the
   type ServerPartT IO Response.
   How to make them work together?
  
   I have:
   type NomicServer = ServerPartT IO
   type RoutedNomicServer = RouteT PlayerCommand NomicServer
  
   newRule :: ServerHandle - NomicServer Response
   newRule sh = do
  methodM POST -- only accept a post method
  mbEntry - getData -- get the data
  case mbEntry of
 Nothing - error $ error: newRule
 Just (NewRule name text code pn) - do
html - nomicPageComm pn sh (submitRule name text code pn))
ok $ toResponse html
  
  
   nomicPageComm :: PlayerNumber - ServerHandle - Comm () -
   RoutedNomicServer Html
   nomicPageComm pn sh comm =
   (..)
  
  
   launchWebServer :: ServerHandle - IO ()
   launchWebServer sh = do
  putStrLn Starting web server...\nTo connect, drive your browser to
   \http://localhost:8000/Login\ http://localhost:8000/Login%5C
  d - liftIO getDataDir
  simpleHTTP nullConf $ mconcat [dir postLogin $ postLogin,
 fileServe [] d,
 dir Login $ ok $ toResponse $
   loginPage,
 dir NewRule $ 

[Haskell-cafe] pla...@community.haskell.org and Mailman Images

2011-01-19 Thread Jon Kristensen

Just two small comments:

The e-mail address pla...@community.haskell.org mentioned at 
http://planet.haskell.org/ bounces (connect to 
community.haskell.org[72.249.126.23]: Connection timed out). Also, 
registering on this mailing list to report the problem, I realized that 
the mailman images at pages such as 
http://www.haskell.org/mailman/subscribe/haskell-cafe are broken too. 
Something you might want to take a look at!


Warm regards,
Jon Kristensen

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


[Haskell-cafe] Adding a builder to the bytestring package?

2011-01-19 Thread John Millikin
Most people who work with binary data have had to construct
bytestrings at some point. The most common solution is to use a
Builder, a monoid representing how to construct a bytestring. There
are currently three packages (that I know of) which include builder
implementations: binary, cereal, and blaze-builder.

However, all of these libraries have additional dependencies beyond
just bytestring. All three depend on array and containers, and
blaze-builder additionally depends on text (and thus deepseq).
Since the current implementation of GHC uses static linking, every
additional dependency adds to the final size of a binary.

Obviously the Builder concept is very useful, as it has been
implemented at least three times. How about adding it to the
bytestring package itself? We could have a module
Data.ByteString.Builder, with functions (at minimum):

toByteString :: Builder - Data.ByteString.ByteString
toLazyByteString :: Builder - Data.ByteString.Lazy.ByteString

fromByteString :: Data.ByteString.ByteString - Builder
fromLazyByteString :: Data.ByteString.Lazy.ByteString - Builder

empty :: Builder
append :: Builder - Builder - Builder

Plus whatever implementation details might be useful to expose.

Existing libraries could then add their extra features (word -
builder for binary and cereal, UTF/HTTP for blaze-builder) on top of
the existing types.

Is this something the community is interested in? Is there any work
currently aimed at this goal?

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


Re: [Haskell-cafe] Problems installing the haskell platform

2011-01-19 Thread Henry Laxen

Dear Joachim,

Well, I got away with a lot of stuff, but as I said, when I tried to install 
snap via cabal-install, I could not break through the dependency jungle.  I 
believe the stumbling block was trying to install hint.  All of the debian 
packages installed just fine, but there is no debian package for snap, which I 
really wanted to try out.  

Best wishes,
Henry Laxen



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


[Haskell-cafe] Community.haskell.org is down

2011-01-19 Thread Neil Mitchell
http://www.downforeveryoneorjustme.com/http://community.haskell.org

Currently community is down for me. I remember some
infrastructure/website strike team was set up, but I couldn't find
where to get in contact with them?

Thanks, Neil

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


Re: [Haskell-cafe] Community.haskell.org is down

2011-01-19 Thread Antoine Latter
CCing commit...@haskell.org

Here's the wiki page: http://haskell.org/haskellwiki/Haskell.org_committee
And a neat twitter account, which can be viewed as RSS:
http://twitter.com/#!/haskellorg

Antoine

On Wed, Jan 19, 2011 at 1:07 PM, Neil Mitchell ndmitch...@gmail.com wrote:
 http://www.downforeveryoneorjustme.com/http://community.haskell.org

 Currently community is down for me. I remember some
 infrastructure/website strike team was set up, but I couldn't find
 where to get in contact with them?

 Thanks, Neil

 ___
 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] Adding a builder to the bytestring package?

2011-01-19 Thread Johan Tibell
On Wed, Jan 19, 2011 at 6:51 PM, John Millikin jmilli...@gmail.com wrote:
 Most people who work with binary data have had to construct
 bytestrings at some point. The most common solution is to use a
 Builder, a monoid representing how to construct a bytestring. There
 are currently three packages (that I know of) which include builder
 implementations: binary, cereal, and blaze-builder.

 However, all of these libraries have additional dependencies beyond
 just bytestring. All three depend on array and containers, and
 blaze-builder additionally depends on text (and thus deepseq).
 Since the current implementation of GHC uses static linking, every
 additional dependency adds to the final size of a binary.

 Obviously the Builder concept is very useful, as it has been
 implemented at least three times. How about adding it to the
 bytestring package itself? We could have a module
 Data.ByteString.Builder, with functions (at minimum):

 toByteString :: Builder - Data.ByteString.ByteString
 toLazyByteString :: Builder - Data.ByteString.Lazy.ByteString

 fromByteString :: Data.ByteString.ByteString - Builder
 fromLazyByteString :: Data.ByteString.Lazy.ByteString - Builder

 empty :: Builder
 append :: Builder - Builder - Builder

 Plus whatever implementation details might be useful to expose.

 Existing libraries could then add their extra features (word -
 builder for binary and cereal, UTF/HTTP for blaze-builder) on top of
 the existing types.

 Is this something the community is interested in? Is there any work
 currently aimed at this goal?

I think both Duncan and I agree that we should move
Data.Binary.Builder (which doesn't have any extra dependencies) to
bytestring. I've already added Data.Text.Lazy.Builder to text.

Johan

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


Re: [Haskell-cafe] Adding a builder to the bytestring package?

2011-01-19 Thread Michael Snoyman
On Wed, Jan 19, 2011 at 9:32 PM, Johan Tibell johan.tib...@gmail.com wrote:
 On Wed, Jan 19, 2011 at 6:51 PM, John Millikin jmilli...@gmail.com wrote:
 Most people who work with binary data have had to construct
 bytestrings at some point. The most common solution is to use a
 Builder, a monoid representing how to construct a bytestring. There
 are currently three packages (that I know of) which include builder
 implementations: binary, cereal, and blaze-builder.

 However, all of these libraries have additional dependencies beyond
 just bytestring. All three depend on array and containers, and
 blaze-builder additionally depends on text (and thus deepseq).
 Since the current implementation of GHC uses static linking, every
 additional dependency adds to the final size of a binary.

 Obviously the Builder concept is very useful, as it has been
 implemented at least three times. How about adding it to the
 bytestring package itself? We could have a module
 Data.ByteString.Builder, with functions (at minimum):

 toByteString :: Builder - Data.ByteString.ByteString
 toLazyByteString :: Builder - Data.ByteString.Lazy.ByteString

 fromByteString :: Data.ByteString.ByteString - Builder
 fromLazyByteString :: Data.ByteString.Lazy.ByteString - Builder

 empty :: Builder
 append :: Builder - Builder - Builder

 Plus whatever implementation details might be useful to expose.

 Existing libraries could then add their extra features (word -
 builder for binary and cereal, UTF/HTTP for blaze-builder) on top of
 the existing types.

 Is this something the community is interested in? Is there any work
 currently aimed at this goal?

 I think both Duncan and I agree that we should move
 Data.Binary.Builder (which doesn't have any extra dependencies) to
 bytestring. I've already added Data.Text.Lazy.Builder to text.

 Johan

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


Isn't Simon Meier working on migrating his code from blaze-builder
into binary? I agree with John that it would make more sense to go in
bytestring. Assuming that happens, would the builder from text end up
being based on it?

Michael

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


Re: [Haskell-cafe] Adding a builder to the bytestring package?

2011-01-19 Thread Johan Tibell
On Wed, Jan 19, 2011 at 8:37 PM, Michael Snoyman mich...@snoyman.com wrote:
 Isn't Simon Meier working on migrating his code from blaze-builder
 into binary?

So I heard (although not directly from Simon). I think it would be
nice to port the blaze-builder implementation to binary, but to keep
binaries current interface (for now).

 I agree with John that it would make more sense to go in
 bytestring. Assuming that happens, would the builder from text end up
 being based on it?

ByteString and Text don't share an underlying data structure at the
moment (one uses pinned ForeignPtrs and one unpinned ByteArray#s) so
they can use the same builder efficiently. Some day perhaps.

Johan

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


Re: [Haskell-cafe] Proposal: Applicative = Monad: Call for consensus

2011-01-19 Thread Conor McBride

Hi Tyson

(So OT, I'm switching to cafe.)

On 19 Jan 2011, at 18:24, Tyson Whitehead wrote:


On January 17, 2011 16:20:22 Conor McBride wrote:

Ahem


: )


The unfortunate pain you pay for this additional power is manually
having to
specify the application ($ and *) and merging (join).  If the
compiler
could figure this all out for you based on the underlying types,  
wow!


To achieve such a thing, one would need to ensure a slightly more
deliberate separation of value and computation in the  
presentation

of types. In Haskell, we use, e.g., [Int], for

  * pure computations of lists of integers
  * nondeterministic computations of integers


[..]

I'm pretty sure I know what pure computations of lists of integers  
is, but

I'm not so sure about nondeterministic computations of integers.

If it is not too much of an effort, could you clarify with a quick  
example?


Viewing [] as a monad, you can view [1,2] as a nondeterministic  
integer with

possible values 1 and 2. Lifting operations to this monad gives you
all possible combinations computation, so, as SHE would have it,

   (| [1,2] + [3,4] |)  =  pure (+) * [1,2] * [3,4]  =  [4,5,5,6]

It's not hard to come up with examples where lifted and unlifted both  
make

sense. With a bit of help from Twitter, we have

(courtesy of Andy Gimblett)

   ([under,over] ++ [state,wear]) =  
[under,over,state,wear]

but
   (|[under,over] ++ [state,wear]|)
 = [understate,underwear,overstate,overwear]

and (courtesy of Dan Piponi)

   ([plan,tan] ++ [gent,king]) = [plan,tan,gent,king]
but
   (|[plan,tan] ++ [gent,king]|)
 = [plangent,planking,tangent,tanking]

In each case, the former has (++) acting on lists of strings as pure  
values,

while the latter has (++) acting on strings as values given in
[]-computations.

The type [String] determines a domain, it does not decompose uniquely  
to a

notion of computation and a notion of value. We currently resolve this
ambiguity by using one syntax for pure computations with [String] values
and a different syntax for [] computations with String values.

Just as we use newtypes to put a different spin on types which are
denotationally the same, it might be worth considering a clearer (but
renegotiable) separation of the computation and value aspects of types,
in order to allow a syntax in which functions are typed as if they act  
on

*values*, but lifted to whatever notion of computation is ambient.

After types for representation, let us have types for explanation.

All the best

Conor


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


Re: [Haskell-cafe] Adding a builder to the bytestring package?

2011-01-19 Thread John Millikin
On Wed, Jan 19, 2011 at 12:04, Johan Tibell johan.tib...@gmail.com wrote:
 On Wed, Jan 19, 2011 at 8:37 PM, Michael Snoyman mich...@snoyman.com wrote:
 Isn't Simon Meier working on migrating his code from blaze-builder
 into binary?

 So I heard (although not directly from Simon). I think it would be
 nice to port the blaze-builder implementation to binary, but to keep
 binaries current interface (for now).

From the perspective of a library user, if there's to be code
shuffling, I'd much rather have it be one-time (blaze-builder -
bytestring) than having multiple merges/ports going on. Especially
since building bytestrings is a much more generic operation than
binary serialisation.

Regarding the interface, I think that as long as the same *basic*
operations are available, it's fine to have extra operations as well.
Several of blaze-builder's special-case functions (toByteStringIO ,
fromWriteList) allow more efficient operation than the generic
interface.

 I agree with John that it would make more sense to go in
 bytestring. Assuming that happens, would the builder from text end up
 being based on it?

 ByteString and Text don't share an underlying data structure at the
 moment (one uses pinned ForeignPtrs and one unpinned ByteArray#s) so
 they can use the same builder efficiently. Some day perhaps.

Can any of the blaze-builder optimizations be translated to the Text
builder? When I benchmark it against binary and cereal, blaze-builder
is approximately 2-3 times faster for most use cases.

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


Re: [Haskell-cafe] Adding a builder to the bytestring package?

2011-01-19 Thread Michael Snoyman
On Wed, Jan 19, 2011 at 10:04 PM, Johan Tibell johan.tib...@gmail.com wrote:
 On Wed, Jan 19, 2011 at 8:37 PM, Michael Snoyman mich...@snoyman.com wrote:
 Isn't Simon Meier working on migrating his code from blaze-builder
 into binary?

 So I heard (although not directly from Simon). I think it would be
 nice to port the blaze-builder implementation to binary, but to keep
 binaries current interface (for now).

What's the advantage to moving in into binary as opposed to bytestring?

 I agree with John that it would make more sense to go in
 bytestring. Assuming that happens, would the builder from text end up
 being based on it?

 ByteString and Text don't share an underlying data structure at the
 moment (one uses pinned ForeignPtrs and one unpinned ByteArray#s) so
 they can use the same builder efficiently. Some day perhaps.

I hadn't realized, I had just assumed it was using ByteString
underneath. I'll pay more attention next time, thanks for informing me
:).

Michael

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


Re: [Haskell-cafe] Adding a builder to the bytestring package?

2011-01-19 Thread Johan Tibell
On Wed, Jan 19, 2011 at 9:51 PM, John Millikin jmilli...@gmail.com wrote:
 Can any of the blaze-builder optimizations be translated to the Text
 builder? When I benchmark it against binary and cereal, blaze-builder
 is approximately 2-3 times faster for most use cases.

Yes, but I haven't had time to do so yet. I even wrote a blog post
about not having time to do it. ;)

http://blog.johantibell.com/2011/01/haskell-library-improvements-id-like-to.html

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


Re: [Haskell-cafe] Adding a builder to the bytestring package?

2011-01-19 Thread Johan Tibell
On Wed, Jan 19, 2011 at 10:30 PM, Michael Snoyman mich...@snoyman.com wrote:
 What's the advantage to moving in into binary as opposed to bytestring?

To test that the implementation can indeed be ported to that
interface. We could of course skip that step if we want to.

Johan

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


[Haskell-cafe] source line annotations

2011-01-19 Thread Evan Laforge
One of the first things I did when starting a larger haskell project
was to write a preprocessor that would replace certain tokens with
(token_srcpos (filename, func_name, lineno)) and then write x and
x_srcpos versions of the various 'throw' and logging functions.  This
is extremely handy to have, and since logs are part of my app's UI,
it's part of the app itself.

I found out later that jhc has a pragma that basically does the same
thing, only built in.  My preprocessor works but has some problems.
Namely, replacing non-qualified tokens requires parsing the source
because you want to replace only function calls, not declarations,
import / export lists, etc.  I get around this because I always import
qualified, but still I need to do some hacking to get qualified tokens
('lex' mysteriously doesn't understand them... aren't they in haskell
2010 now?) and not screw up on odd corners like backslash string
continuations.  Then I start wanting to e.g. replace 'throw' in the
same module it's defined in, which really lets the dragons out because
now I'm trying to replace unqualified names.

Another problem is that the names to replace are hardcoded in the
preprocessor.  Not a problem for me, but would be for a general tool.

My preprocessor works well, but occasionally I do have to go in and
fix yet another odd corner that came up.  Initially I thought I would
only simplistically replace tokens and avoid using a full syntax
parser, but to really do it correctly a full parser is needed.  And of
course this is specific to my style (qualified imports) and project.
To do this in full generality really requires the compiler's help.
But as I use it now, it's been extremely useful, especially for
exceptions which may not carry a unique or easily greppable msg.  Or
any msg at all.

Are there any more sophisticated tools out there that do this?
Interest in extending ghc to support SRCLOC_ANNOTATE?  Reasons why I
don't actually want this after all?

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


Re: [Haskell-cafe] Adding a builder to the bytestring package?

2011-01-19 Thread John Millikin
On Wed, Jan 19, 2011 at 14:06, Johan Tibell johan.tib...@gmail.com wrote:
 On Wed, Jan 19, 2011 at 10:30 PM, Michael Snoyman mich...@snoyman.com wrote:
 What's the advantage to moving in into binary as opposed to bytestring?

 To test that the implementation can indeed be ported to that
 interface. We could of course skip that step if we want to.

blaze-builder already implements the binary builder interface, minus
the putWord* functions. I think those would be trivial to reimplement
on top of Write.

Since it sounds like everyone agrees with / has already thought of
moving Builder into bytestring, I'll start poking at a patch. Who is
the current patch-reviewer for binary and bytestring?

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


Re: [Haskell-cafe] Adding a builder to the bytestring package?

2011-01-19 Thread Johan Tibell
On Thu, Jan 20, 2011 at 12:16 AM, John Millikin jmilli...@gmail.com wrote:
 blaze-builder already implements the binary builder interface, minus
 the putWord* functions. I think those would be trivial to reimplement
 on top of Write.

 Since it sounds like everyone agrees with / has already thought of
 moving Builder into bytestring, I'll start poking at a patch. Who is
 the current patch-reviewer for binary and bytestring?

I'd suggest addressing the patch to Don Stewart, Duncan Coutts, and
Lennart Kolmodin.

Johan

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


Re: [Haskell-cafe] source line annotations

2011-01-19 Thread Max Bolingbroke
On 19 January 2011 22:43, Evan Laforge qdun...@gmail.com wrote:
 Reasons why I
 don't actually want this after all?

Are you aware of the magic assert function?

http://hackage.haskell.org/packages/archive/base/latest/doc/html/Control-Exception-Base.html#v:assert

The compiler spots it and replaces it with a function that raises an
exception that contains the source location if the assert fails.
It is deeply evil, but you can write a library function like this (untested):

getSourceLoc :: (Bool - a - a) - String
getSourceLoc my_assert = unsafePerformIO (evaluate (my_assert False
(error Impossible)) `catch` (\(AssertionFailed s) - return s))

Now your consumers can write:

getSourceLoc assert :: String

And you will have a value that describes where you are. You can then
use this to implement logging, throw errors etc. The annoying part is
that you have to explicitly pass in assert from the call site to make
sure that you get the right source location reported.

Cheers,
Max

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


Re: [Haskell-cafe] source line annotations

2011-01-19 Thread Evan Laforge
 Now your consumers can write:

 getSourceLoc assert :: String

 And you will have a value that describes where you are. You can then
 use this to implement logging, throw errors etc. The annoying part is
 that you have to explicitly pass in assert from the call site to make
 sure that you get the right source location reported.

Yes, in fact the 'loch' package does this.  Initially I thought that
having a dummy argument on every single log call and throw (quite a
few of those) would be too much hassle, but if I have to keep fixing
the preprocessor I might start reconsidering.

Another thing is that performance in logging is pretty critical.  When
I profile, logging functions wind up in the expensive list if I'm not
careful.  I don't know bad an unsafePerformIO plus a catch for every
log msg is going to be, but it's not going to be as fast as doing the
work at compile time.

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


Re: [Haskell-cafe] Building lambdabot

2011-01-19 Thread Gwern Branwen
On Tue, Jan 18, 2011 at 3:41 PM, Max Bolingbroke
batterseapo...@hotmail.com wrote:
 That sounds like a good thing to do. Also, oo you know if there's any
 reason that the most recent lambdabot is not pushed to Hackage? That
 might make things even easier for others who wish to install it. It
 certainly confused me!

 Cheers,
 Max

It had a lot of issues which meant it wouldn't build anywhere, where
at least the Hackage version worked at some point. I spent this
evening working on fixing issues (rewriting the show package to use
QuickCheck 2 rather than QuickCheck 1 was not fun!) and have uploaded
a lambdabot and show that compile for me on GHC 6.12.1

-- 
gwern
http://www.gwern.net

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


[Haskell-cafe] Haskell Weekly News: Issue 165 - January 19, 2011

2011-01-19 Thread Daniel Santa Cruz
   Welcome to issue 165 of the HWN, a newsletter covering developments in
   the [1]Haskell community. This release covers the week of January 9 to
   15, 2011.

Announcements

   Brent Yorgey [2]announced the release of issue 17 of The Monad.Reader,
   containing the following three articles: List Leads Off with the Letter
   Lambda by Douglas M. Auclair, The InterleaveT Abstraction: Alternative
   with Flexible Ordering by Neil Brown, and The Reader Monad and
   Abstraction Elimination by Petr Pudlak.

   Andy Stewart [3]sent an invite to anyone interested in joining the
   Manatee team. Manatee is a Haskell integrated environment written in
   Haskell. Follow the link to see some videos posted for a better idea of
   what the tool is.

   Niklas Broberg [4]announced the release of version 1.10.1 of
   haskell-src-extensions.

   Huibiao Zhu [5]sent a call for papers to the 13th International
   Conference on Formal Engineering Methods to be held in Durham, UK on
   October 25-28 2011.

   Read on to see what was hot in the Haskell community around the net...

Quotes of the Week

 * ion: ddarius: Yeah, abstract concepts absolutely hate being
   anthropomorphized.
 * gwern: there are no beginnings or ends to the circular list; but a
   cons cell thunked in Amador...
 * tac-tics: If you wish to create the universe from scratch, you must
   first invent the continuation.
 * sproingie: hm. Â i can't remember how to use @remember
 * NOTE: Just say @remember :) I'm grepping the logs to find these
   things
 * Kaidelong: Kaidelong take 6 bananas lambdabot banana
   Kaidelong clearly lambdabot is keeping the bananas to itself and
   lying about it
 * hpc: functor and applicative are easy, since you can remember them
   as those things what look like function application, sort of

Top Reddit Stories

   * RFC: migrating GHC development to git
 Domain: haskell.org, Score: 51, Comments: 66
 On Reddit:
http://www.reddit.com/r/haskell/comments/ezgvs/rfc_migrating_ghc_development_to_git/
 Original:
http://www.haskell.org/pipermail/glasgow-haskell-users/2011-January/019752.html

   * [CCC] On how Haskell’s Arrows are NOT just function compositions with a
fancier name
 Domain: ro-che.info, Score: 38, Comments: 4
 On Reddit:
http://www.reddit.com/r/haskell/comments/f3e06/ccc_on_how_haskells_arrows_are_not_just_function/
 Original: http://ro-che.info/ccc/12.html

   * foldl vs foldl', and why you should always use the latter
 Domain: reddit.com, Score: 35, Comments: 8
 On Reddit:
http://www.reddit.com/r/haskell/comments/f25iv/foldl_vs_foldl_and_why_you_should_always_use_the/
 Original:
http://www.reddit.com/r/haskell/comments/f150x/whats_wrong_with_my_haskell_noob_question/c1ck6ey

   * ~Haskell 2011
 Domain: haskell.org, Score: 32, Comments: 5
 On Reddit: http://www.reddit.com/r/haskell/comments/ezmzh/haskell_2011/
 Original:
http://www.haskell.org/pipermail/haskell/2011-January/022497.html

   * The Monad.Reader: Issue 17
 Domain: themonadreader.wordpress.com, Score: 30, Comments: 10
 On Reddit:
http://www.reddit.com/r/haskell/comments/ezft9/the_monadreader_issue_17/
 Original: http://themonadreader.wordpress.com/2011/01/09/issue-17/

   * Painless NP-complete problems: an embedded DSL for SMT solving
 Domain: donsbot.wordpress.com, Score: 27, Comments: 2
 On Reddit:
http://www.reddit.com/r/haskell/comments/f3fp6/painless_npcomplete_problems_an_embedded_dsl_for/
 Original:
http://donsbot.wordpress.com/2011/01/16/painless-np-complete-problems-an-embedded-dsl-for-smt-solving/

   * Oregon Programming Languages Summer School: Types, Semantics, and
Verification
 Domain: lists.seas.upenn.edu, Score: 22, Comments: 20
 On Reddit:
http://www.reddit.com/r/haskell/comments/f15rm/oregon_programming_languages_summer_school_types/
 Original:
http://lists.seas.upenn.edu/pipermail/types-announce/2011/002241.html

   * Announcing Web Application Interface 0.3.0 (now with more speed)
 Domain: docs.yesodweb.com, Score: 20, Comments: 2
 On Reddit:
http://www.reddit.com/r/haskell/comments/f0e6f/announcing_web_application_interface_030_now_with/
 Original: http://docs.yesodweb.com/blog/announcing-wai-0-3/

   * A bran new functional programming (Haskell inter alia) jobs site
(corrected link)
 Domain: functionaljobs.com, Score: 19, Comments: 11
 On Reddit:
http://www.reddit.com/r/haskell/comments/ezqst/a_bran_new_functional_programming_haskell_inter/
 Original: http://functionaljobs.com/

   * [PDF] Orthogonal Serialization For Haskell
 Domain: mathematik.uni-marburg.de, Score: 17, Comments: 3
 On Reddit:
http://www.reddit.com/r/haskell/comments/f1o8t/pdf_orthogonal_serialization_for_haskell/
 Original:
http://www.mathematik.uni-marburg.de/~berthold/papers/mainIFL10-withCopyright.pdf

Top StackOverflow Questions

   * Monads as adjunctions
 votes: 15, answers: 3
  

[Haskell-cafe] Call for Submissions: Special Poetry and Fiction Edition of the Monad.Reader

2011-01-19 Thread Brent Yorgey
Submissions are now being accepted for a special POETRY AND FICTION
edition of the Monad.Reader.  Poems about Haskell, short stories about
Haskell, poems about poems about Haskell, elaborate monad tutorial
allegories, Haskell/Dinosaur Comics crossovers: all fair game!

If you want a bit of inspiration, check out the links at the end of
this message [1,2,3].  But you are a creative bunch, I'm sure you can
come up with all sorts of fun ideas and formats.

The submission deadline will be

 **Friday, February 18**

but feel free to send submissions at any time between now and then.


Questions That May Be Asked Frequently (QTMBAF)
---

Q. Are you serious?
A. Absolutely.

Q. The deadline is only four weeks away!  It will take me at least
   five weeks to write my incredible masterpiece!
A. Are you serious?

Q. Will you take every submission or will there be some sort of
   selection process?
A. I hope to publish every submission, although not without going
   through a process of editing and suggested revisions.  Ultimately,
   it depends on the number of submissions.

Q. Can I submit the same poem multiple times to increase my chances?
A. I have written a sophisticated, 5000-line Haskell program to detect
   this and alter your submission in a subtle yet highly embarrassing
   (for you) way.

Q. Seriously, this is a dumb idea.
A. Please try to phrase your question in the form of a question.

Q. Seriously, is this a dumb idea?
A. No, I'm pretty sure it is awesome.


Submission Details
--

Submissions should be sent to (byorgey at cis.upenn.edu).  Simple text
submissions are fine for short submissions such as poetry.  For longer
submissions, LaTeX is appreciated.  See the guidelines here to get
started:

  http://themonadreader.wordpress.com/contributing/

If submitting in LaTeX is a hardship, text submissions will be
accepted.  Submissions in Microsoft Word format will be deleted and
then overwritten fifty times with random bits.


[1] http://haskell.org/haskellwiki/Humor/Poetry
[2] http://haskell.org/haskellwiki/Haiku
[3] http://www.cis.upenn.edu/~byorgey/haskell-alphabet/index.html

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


[Haskell-cafe] Haskell time line?

2011-01-19 Thread michael rice
The Haskell language is some twenty years old. Is there a time line for what 
features were in the language's initial release and what has been added along 
the way?

Michael



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


Re: [Haskell-cafe] Haskell time line?

2011-01-19 Thread Brent Yorgey
On Wed, Jan 19, 2011 at 06:49:49PM -0800, michael rice wrote:
 The Haskell language is some twenty years old. Is there a time line
 for what features were in the language's initial release and what has
 been added along the way?

See A History of Haskell: Being Lazy with Class by Hudak, Hughes,
and Jones.  It's a few years out of date now and doesn't cover
absolutely everything, but it's an excellent place to start.

-Brent

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


Re: [Haskell-cafe] Haskell time line?

2011-01-19 Thread michael rice
I found a copy. Thanks!

Michael

--- On Wed, 1/19/11, Brent Yorgey byor...@seas.upenn.edu wrote:

From: Brent Yorgey byor...@seas.upenn.edu
Subject: Re: [Haskell-cafe] Haskell time line?
To: Haskell Cafe haskell-cafe@haskell.org
Date: Wednesday, January 19, 2011, 10:03 PM

On Wed, Jan 19, 2011 at 06:49:49PM -0800, michael rice wrote:
 The Haskell language is some twenty years old. Is there a time line
 for what features were in the language's initial release and what has
 been added along the way?

See A History of Haskell: Being Lazy with Class by Hudak, Hughes,
and Jones.  It's a few years out of date now and doesn't cover
absolutely everything, but it's an excellent place to start.

-Brent

___
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] Wondering about networking programming in Haskell.

2011-01-19 Thread Magicloud Magiclouds
Hi,
  Originally, my idea for networking programming is like: read some
bytes, judge if this is enough for a packet (defined in certain
protocol), if not, read more until the packet is complete, then parse
it into a message.
  Now we have lazy in Haskell. Can I do it as:
buffer - hGetContents handle
(message1, leftData1) - parse1 buffer
(message2, leftData2) - parse2 leftData2
...
-- 
竹密岂妨流水过
山高哪阻野云飞

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


[Haskell-cafe] Formal Program verification in Meta-Haskell

2011-01-19 Thread Alexander McPhail
Hi,

I have no understanding of template haskell and thus this message is
uninformed speculation.  Would it not be possible to write a function
verifier in TH that, unlike QuickCheck which provides bounds on a function
being probably approximately correct, is given a list over properties which
are proven over a quasi-quoted syntax tree?

For example:

 multiply :: Num a = a - a - a

 multiply_group :: Proof Bool
 multiply_group = group multiply 1

 group :: (a - a - a) - a - Proof Bool
 group f ident = [proof| f, [associative, identity 1]]

where `associative` and `ident` are proof-constructing functions that act
over the `f` syntax tree.  (Maybe some invokation of an Isabelle-like
theorem prover or an SMT-like solver as part of the 'proof' module).

Then we might even be able to list properties with class declarations.  The
properties get verified at compile time.

 class Monoid a where
   mzero :: a
   msum :: a - a - a

   property a [associative msum, identity mzero msum]

Any thoughts?

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


Re: [Haskell-cafe] A question about monad based on http://en.wikipedia.org/wiki/Monad_(category_theory)

2011-01-19 Thread wren ng thornton

On 1/17/11 10:46 PM, C K Kashyap wrote:

Hi,
I was going through http://en.wikipedia.org/wiki/Monad_(category_theory) -
under Formal Definition I notice that monad is a Functor T:C -  C

My question is - when we think of Maybe as a functor T:C -  C  should we
think that C here refers to Hakell types?


Not quite. A functor is a mapping between categories.

Well, then what's a mapping between categories? It's a pair of maps, one 
mapping objects to objects and the other mapping arrows to arrows, such 
that they preserve the category structure (i.e., obey the functor laws). 
For categories like the ones for lambda calculi, the objects are types 
and the arrows are functions.


Thus, the C there is referring to some category (namely a category 
modeling Haskell's type system). If you wish, you can think of 
categories as being like Either Object Arrow, for a particular class of 
objects and a particular class of arrows. So we'd have,


T : Either Ob Hom - Either Ob Hom
T (Left ob) = ...
T (Right hom) = ...

Though nobody does that and we prefer our notation to slide over the 
fact that functors and categories have two parts, and so we actually write:


T : C - C
T ob = ...
T hom = ...

So we might have that T Int = Bool, or T Int = [Int], or whatever. But 
we don't usually give types for the components of a functor, since we 
care more about the functor as a whole (e.g., we don't give types to 
individual lines of a function definition either, we only give a type 
for the whole function).




As in,
(Int and Maybe Int are objects in C) and (Int -  Int and Maybe Int -  Maybe
Int are arrows in C) and T is an arrow between them. Is that right? For some
reason, I was
imagining them as two different categories C and D.


Generally speaking functors do go between different categories, but 
there's no reason they can't be on the same category (e.g., the identity 
functor :)


Conventional monads are always endofunctors though, since otherwise we 
couldn't talk about the natural transformations like return and join (we 
don't have arrows between objects in different categories). There are 
some generalizations of monads that relax this however.


--
Live well,
~wren

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


Re: [Haskell-cafe] class-instance

2011-01-19 Thread Patrick Browne
On 19/01/2011 10:41, Ryan Ingram wrote:
 It's still not really clear what you are trying to do.
 
I am trying to see what how this requirement can be represented using
just the normal instance-implements-class relation for a comparison with
a specification language approach.

If there is no simple way to do this using type classes then I am
obviously mis-using the technique.


Regards,
Pat



This message has been scanned for content and viruses by the DIT Information 
Services E-Mail Scanning Service, and is believed to be clean. http://www.dit.ie

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