Re: [Haskell-cafe] Trapping getChar before echo

2010-01-31 Thread Michael Hartl
import System.IO
import Data.Char

main = do
  hSetEcho stdin False
  hSetBuffering stdin NoBuffering
  hSetBuffering stdout NoBuffering
  scanLine
  where scanLine = do 
  c - hGetChar stdin
  putChar . toUpper $ c
  scanLine


Am Sonntag, den 31.01.2010, 19:17 +1030 schrieb Mark Spezzano:
 Hi,
 
 Is there any way of trapping keystrokes in Haskell, modifying them, and then 
 echoing?
 
 Basically I want to give the user a prompt  like:
 
 
 and then have whatever they type appear in UPPERCASE regardless of whether 
 caps lock was on or not.
 
 By default Haskell seems to echo characters in whatever case they were typed. 
 I want to sneak in a toUpper in before the Chars get echoed.
 
 Thanks
 
 Mark Spezzano
 
 
 ___
 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] Takusen - reading from one db inserting into another

2010-01-18 Thread Michael Hartl
Don't know if you can have two connections, sounds difficult in regard
to the DBM monad. Only the deveolopers will know.

However, two obvious solutions come to my mind: 1) build a result set
and process it after returning from DBM or 2) use two separate threads
and send the queried data from your source db to the other thread using
an STM channel. 
You will have to think about lazyness, performance and space usage in
both cases, however.

Am Sonntag, den 17.01.2010, 20:48 +0100 schrieb Günther Schmidt:
 Hi,
 
 I know how to use Takusen with a *single* connection, but I cannot 
 figure out how to read from one database while inserting to another.
 
 
 Could someone please explain to me how I can do that?
 
 Günther
 
 
 ___
 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] Language simplicity

2010-01-12 Thread Michael Hartl
Am Dienstag, den 12.01.2010, 22:22 + schrieb Andrew Coppin:
 Niklas Broberg wrote:
  Haskell '98 apparently features 25 reserved words. (Not counting forall
  and mdo and so on, which AFAIK are not in Haskell '98.)
  
 
  21 actually. case, class, data, default, deriving, do, else, if,
  import, in, infix, infixl, infixr, instance, let, module, newtype, of,
  then, type, where. There's also three special words that can still be
  used as identifiers, so aren't reserved: as, qualified, hiding.

 
 OK. Well the list I saw was for Haskell plus extensions, and I visually 
 filtered out the inapplicable stuff. Apparently I missed something.
 
 Also, the number varies depending on whether you consider reversed 
 words or keywords, and I suspect the situation is subtly different 

reversed words? There are some in sh for example, namely 'fi' and
'esac', but other than that they are not that common... ;-)

 for each possible language. I was going vaguely for anything that's 
 hard-wired into a language, and not just part of the standard libraries. 
 (E.g., return is definitely NOT any kind of reversed word or keyword.)
 
 ___
 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] Happstack with XML-RPC

2009-12-22 Thread Michael Hartl
Hello,

has anybody ever used Happstack as XML-RPC-Server? Perhaps in
conjunction with HaXR? I like the architecture of Happstack and would
like to use it in a project where I have to use HTML as well as XML-RPC,
now to me it would make sense to integrate XML-RPC abilities into
Happstack, since HaXR only provides a CGI-based server.

Any experiences?

BTW, what's the status of HaXR? Is it being actively developed?

regards
Mike

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


Re: [Haskell-cafe] ANN: Happstack 0.4.1

2009-12-20 Thread Michael Hartl
What is the relationship between HAppS and Happstack? I actually thought
that Happstack was the former name of HAppS, but now it seems that I'm
wrong...?

Regards

Am Samstag, den 19.12.2009, 18:17 -0600 schrieb Jeremy Shaw:
 Happstack 0.4.1 STABLE is now available.
 
 We recommend that all users of Happstack update to 0.4.1
 immediately. Migration from Happstack 0.3 should be trivial. There was
 one race condition in happstack-state which could cause a state event
 to fail under heavy congestion.
 
 Happstack is the Haskell Application Server Stack. It is a scalable
 framework for developing web applications. It is similar in purpose to
 Django, RoR, Turbogears, Grails, Seaside, etc.
 
 Using less buzzwords, it is a collection of libraries which can be
 used to develop a self-contained server application which does not
 require SQL or Apache (though it can integrate with both).
 
 It includes:
 
 * an HTTP server
 * a rich DSL for deconstructing HTTP Requests and generating  
 Responses
 * HTML/XML/etc templating via HStringTemplate, HSP, or Text.XHtml
 * a persistent data store based on user defined Haskell data types
   with ACID properties and state migration
 * and more!!
 
 Happstack's modular nature means it is easy to integrate unrelated 3rd
 party modules such as Pandoc, or to add support for an alternative
 templating system. Additionally, it does not exclude you from using
 SQL, or supporting other protocols besides HTTP.
 
 HOMEPAGE:
 
 http://www.happstack.com/
 
 SUPPORTED PLATFORMS:
 
 Happstack supports GHC 6.8, 6.10, and 6.12, under GNU/Linux,
 FreeBSD, OS X, and Windows.
 
 GHC 6.12 currently requires a minor patch to HJScript. Details here:
 
  
 http://groups.google.com/group/haskell-server-pages/browse_thread/thread/56f388fdbaec1420
 
 INSTALL:
 
 1. ensure that ~/.cabal/bin is in your $PATH
 2. cabal update
 3. cabal install happstack
 
 * see SUPPORTED PLATFORMS for information about GHC 6.12
 
 
 NOTABLE CHANGES:
 
   For a complete list of changes see:
 
  http://www.patch-tag.com/r/mae/happstack/snapshots/all/history
 
Removed:
 
   * happstack-contrib has been completely removed. If you were  
 using something in it, please complain on the mailing list.
   * removed Happstack.Server.S3 -- newer, better maintained S3  
 libraries are on hackage now
   * removed unsupported spread-based multimaster support
 
fileServe:
 
   * now with sendfile() support! On supported platforms sendfile
   allows files to be served from the disk to the network in a
   zero-copy fashion. This means faster transfers, less memory and
   CPU usage, and no file handle leaks. (hopefully). sendfile uses
   native sendfile() support on Linux, Windows, OS X, and
   FreeBSD. Other platforms will use a sendfile emulation mode. We
   recommend that you use sendFile instead of sendFileStrict or
   sendFileLazy, unless you have specific needs and know some reason
   why you must use sendFileStrict or sendFileLazy.
 
   * FileServe internals majorly refactored. FileServe now provides
   a modular way of building your own fileServe-like functions. Also
   includes functions for serving a single file instead of the
   contents of a directory.
 
   * added more complete list of mime-types
   * automatically redirect from foo to foo/ if foo is a directory
   * filter . and .. from request path, but allow filenames and  
 directories which start with .
 
happstack-server:
 
   * ServerMonad instance for ErrorT
   * Added ServerMonad, FilterMonad, and WebMonad for XMLGenT
   * Added secure flag to cookies. Defaults to False.
   * fix supportsIPv6 to work with newer versions of network library
   * simpleHTTPWithSocket + bindPort for H.S.SimpleHTTP (you can  
 use this to start the server as root, bind to the socket, and then  
 drop privileges.)
   * Fixed Accept-Encoding parser to accepts encodings with a - in  
 them. Added additional tests to acceptEncodingParserTest
   * fix so basicAuth sets correct response code and headers.
   * SimpleHTTP: added trailingSlash. Guard which checks that  
 Request URI ends with a /
   * decode body of PUT requests not just POST
   * added ifModifiedSince guard
   * added host and withHost guards to SimpleHTTP (similar to dir  
 and path, but for the requested hostname)
 
   other:
 
   * happstack-state: Correct an embarrassing race condition bug.
   * happstack-data: Exported getSafeGet and getSafePut
   * happstack: add state transition code to guestbook (add email  
 to form, handler, and state), and tar of example _local state before  
 transition
 
   experimental:
 
   * happstack-state: now has experimental replication support using
 Amazon Web Services. This support is disabled by default. This
 feature is highly experimental, may not work, and may 

Re: [Haskell-cafe] ANN: Happstack 0.4.1

2009-12-20 Thread Michael Hartl
Ah, that's it. ;-) Thanks!

Am Sonntag, den 20.12.2009, 22:23 +1000 schrieb Ivan Lazar Miljenovic:
 Michael Hartl mikeha...@web.de writes:
 
  What is the relationship between HAppS and Happstack? I actually thought
  that Happstack was the former name of HAppS, but now it seems that I'm
  wrong...?
 
 Other way round: Happstack is the new revamped HAppS.
 


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