[Haskell-cafe] Happstack basic question

2010-03-11 Thread Dmitry V'yal

Hello haskellers,

I want to host a simple happstack application behind a reverse proxy. So 
ideally would be to bind it to localhost only.


According to
http://hackage.haskell.org/packages/archive/happstack-server/0.4.1/doc/html/Happstack-Server-HTTP-Types.html#t%3AConf
Conf datatyle has only Port field. Does it mean, there is currently no 
way to prevent binding happstack to all available interfaces?


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


[Haskell-cafe] Re: [Haskell] ANNOUNCE: Bravo-0.1.0

2010-03-11 Thread Marc Weber
Hi Matthias,


 Bravo is inspired by the PHP template engine Smarty and the Haskell 

Smarty is also about caching. Can you say whether your library support
kind of caching as well?

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


[Haskell-cafe] Cabal and LLVM bindings

2010-03-11 Thread Ville Tirronen
Hi!

I'm trying to get cabal build my toy compiler, which is based on llvm
bindings on hackage. Everything is fine with ghc --make,
but with cabal install I get:

Loading package llvm-0.7.1.1 ... command line: can't load .so/.DLL
for: LLVMSystem (dlopen(libLLVMSystem.dylib, 9): image not found)
cabal: Error: some packages failed to install:
QV-0.1 failed during the building phase. The exception was:
ExitFailure 1

This is done on os x 10.5.8, if that has any relevance.

Anyone got any hints on how to proceed with this?

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


Re: [Haskell-cafe] ANN: powerpc-0.0.1

2010-03-11 Thread Serguey Zefirov
2010/3/10 Tom Hawkins tomahawk...@gmail.com:
 On Wed, Mar 10, 2010 at 8:07 AM, Warren Henning
 warren.henn...@gmail.com wrote:
 Wow. Quite ambitious.

 Was this inspired by work at your current employer like with Atom and
 some of the other stuff you've released?

 Yes, we had an immediate need to debug some machine code.  I looked
 around, but all the emulators I found (PSIM, et al.) were too
 complicated.

 I'm also intrigued by the emphasis on software verification at the
 object code level for aerospace (DO-178).  I figure better tools in
 this area may open the door to using advanced design methods like Atom
 for avionics.  Of course it's unlikely this project will reach that
 level of maturity, but you never know.

We wrote the debugger and simulator for AVR line of microcontroller cores.

We used a DSEL to describe inner workings of commands and now try to
apply it to ARM ISA.

The Haskell code is heavy on the use of type-level computations and,
especially, assiciated types.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Happstack basic question

2010-03-11 Thread Martin Kiefel
Hi Dmitry,

On Thu, Mar 11, 2010 at 11:38:44AM +0300, Dmitry V'yal wrote:
 Hello haskellers,
 
 I want to host a simple happstack application behind a reverse proxy. So 
 ideally would be to bind it to localhost only.
 
 According to
 http://hackage.haskell.org/packages/archive/happstack-server/0.4.1/doc/html/Happstack-Server-HTTP-Types.html#t%3AConf
 Conf datatyle has only Port field. Does it mean, there is currently no 
 way to prevent binding happstack to all available interfaces?

I think you are looking for simpleHTTPWithSocket [1]. You can use
whatever socket you like.

 
 Regards,
 Dmitry

Cheers,
Martin

[1] 
http://happstack.com/docs/0.4/happstack-server/Happstack-Server-SimpleHTTP.html#v%3AsimpleHTTPWithSocket
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Anyone up for Google SoC 2010?

2010-03-11 Thread Andrew Coppin

Yakov Zaytsev wrote:

I've got N900 recently and saw that according to this page

http://hackage.haskell.org/trac/ghc/wiki/Platforms

it's not possible to run GHC and GHCi easily on ARM. This sucks.
  


According to this page, shared libraries are not supported on *any* 
platform except MacOS. Surely that's no longer true?


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


Re: [Haskell-cafe] Re: Anyone up for Google SoC 2010?

2010-03-11 Thread Alp Mestanogullari
On Thu, Mar 11, 2010 at 2:13 PM, Andrew Coppin
andrewcop...@btinternet.comwrote:

 According to this page, shared libraries are not supported on *any*
 platform except MacOS. Surely that's no longer true?


They are supported on Linux too now [1]. I don't know the status regarding
Windows though.

[1]
http://haskell.org/ghc/docs/latest/html/users_guide/using-shared-libs.html

-- 
Alp Mestanogullari
http://alpmestan.wordpress.com/
http://alp.developpez.com/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Anyone up for Google SoC 2010?

2010-03-11 Thread Andrew Coppin

Alp Mestanogullari wrote:
On Thu, Mar 11, 2010 at 2:13 PM, Andrew Coppin 
andrewcop...@btinternet.com mailto:andrewcop...@btinternet.com wrote:


According to this page, shared libraries are not supported on
*any* platform except MacOS. Surely that's no longer true?


They are supported on Linux too now [1]. I don't know the status 
regarding Windows though.


Yeah, I thought the IHG recently spent a bunch of money on getting it 
working on Linux. I gather Windows is a lowER priority (although it IS 
on the to-do list).


It seems there's a bunch of information about GHC on the GHC developer's 
website, but it's often not especially up-to-date. (I guess the GHC devs 
have code to write, after all...)


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


Re: [Haskell-cafe] definition of sum

2010-03-11 Thread Yitzchak Gale
TeXitoi wrote:
 why is foldl used by Data.List for sum?

Daniel Fischer wrote:
 Because Haskell is a non-strict language, and foldl' is strict -- someone
 might write a (legitimate) Num instance for a datatype such that
 foldl (+) 0 xs returns a good value, but foldl' (+) 0 xs gives
 ***Exception: Prelude.undefined for some lists xs.

It is possible to define such a Num instance, but it is extremely rare
for anything like that to come up in practice.

 However, with optimisations turned on... GHC knows that sum is
 actually strict

GHC does that when optimizations are turned on, but that behavior
is not required by the Haskell standard. So there is no guarantee
that any given compiler will produce usable output if you use foldl
instead of foldl' for sum.

In GHCi sum is broken, because optimizations are not in
effect there. You have to define your own version of sum
using foldl' for every GHCi session (or put it in your .ghci file).

So it's a trade-off between a slight convenience in a bizarre
corner case and general usability. I agree with Don that this is
a bug in the Haskell 98 standard.

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


Re: [Haskell-cafe] Happstack basic question

2010-03-11 Thread Kyle Murphy
You misunderstand his question. He's trying to setup happstack behind a
reverse proxy running on the same system, so he needs to be able to bind it
only to the loopback interface (127.0.0.1), as opposed to all the interfaces
on the system (thereby making it inaccessible from the network unless
accessed through the proxy). I don't know enough about happstack to answer
his question, but I can see from the documentation you provided that there
doesn't seem to be any way to specify address to bind to as Dmitry stated in
his original e-mail.

-R. Kyle Murphy
--
Curiosity was framed, Ignorance killed the cat.


On Thu, Mar 11, 2010 at 07:39, Martin Kiefel m...@nopw.de wrote:

 Hi Dmitry,

 On Thu, Mar 11, 2010 at 11:38:44AM +0300, Dmitry V'yal wrote:
  Hello haskellers,
 
  I want to host a simple happstack application behind a reverse proxy. So
  ideally would be to bind it to localhost only.
 
  According to
 
 http://hackage.haskell.org/packages/archive/happstack-server/0.4.1/doc/html/Happstack-Server-HTTP-Types.html#t%3AConf
  Conf datatyle has only Port field. Does it mean, there is currently no
  way to prevent binding happstack to all available interfaces?

 I think you are looking for simpleHTTPWithSocket [1]. You can use
 whatever socket you like.

 
  Regards,
  Dmitry

 Cheers,
 Martin

 [1]
 http://happstack.com/docs/0.4/happstack-server/Happstack-Server-SimpleHTTP.html#v%3AsimpleHTTPWithSocket
 ___
 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 basic question

2010-03-11 Thread Martin Kiefel
On Thu, Mar 11, 2010 at 09:24:05AM -0500, Kyle Murphy wrote:
 You misunderstand his question. He's trying to setup happstack behind a
 reverse proxy running on the same system, so he needs to be able to bind it
 only to the loopback interface (127.0.0.1), as opposed to all the interfaces
 on the system (thereby making it inaccessible from the network unless
 accessed through the proxy). I don't know enough about happstack to answer
 his question, but I can see from the documentation you provided that there
 doesn't seem to be any way to specify address to bind to as Dmitry stated in
 his original e-mail.

But I'm doing exactly that.

Here is some of the code:

main = do

  ...

  s - socket AF_INET Stream defaultProtocol
  setSocketOption s ReuseAddr 1
  h - getHostByName localhost
  let p = toEnum $ port $ httpConf appConf
  bindSocket s (SockAddrInet p (hostAddress h))
  listen s 10

  -- start the state system
  control - startSystemState' (store appConf) stateProxy

  -- start the http server
  httpTid - forkIO $ simpleHTTPWithSocket s (httpConf appConf)

  ...

And then my happstack server is just listening on 127.0.0.1.

To access it, I'm using Apache Proxy.

- Martin

 
 -R. Kyle Murphy
 --
 Curiosity was framed, Ignorance killed the cat.
 
 
 On Thu, Mar 11, 2010 at 07:39, Martin Kiefel m...@nopw.de wrote:
 
  Hi Dmitry,
 
  On Thu, Mar 11, 2010 at 11:38:44AM +0300, Dmitry V'yal wrote:
   Hello haskellers,
  
   I want to host a simple happstack application behind a reverse proxy. So
   ideally would be to bind it to localhost only.
  
   According to
  
  http://hackage.haskell.org/packages/archive/happstack-server/0.4.1/doc/html/Happstack-Server-HTTP-Types.html#t%3AConf
   Conf datatyle has only Port field. Does it mean, there is currently no
   way to prevent binding happstack to all available interfaces?
 
  I think you are looking for simpleHTTPWithSocket [1]. You can use
  whatever socket you like.
 
  
   Regards,
   Dmitry
 
  Cheers,
  Martin
 
  [1]
  http://happstack.com/docs/0.4/happstack-server/Happstack-Server-SimpleHTTP.html#v%3AsimpleHTTPWithSocket
  ___
  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] Problem installing wxHaskell on Haskell Platform on OSX.

2010-03-11 Thread David Place

On Mar 10, 2010, at 6:33 PM, Daniel Fischer wrote:

 cabal install wx-0.12.1.2 wxcore-0.12.1.2 wxdirect-0.12.1.1
 
 has good chances to work on 6.10.*


I have managed to install and compile this version of wxHaskell.  Now, I have a 
problem using it.  The instructions on the use of wxHaskell on OSX say to 
follow this recipe:

  cd samples/wx
  ghc -package wx -o helloworld HelloWorld.hs
  /usr/local/wxhaskell/bin/macosx-app -v helloworld
  open helloworld.app


The installation did not create the directory /usr/local/wxhaskell and I can't 
find the macosx-app anywhere else.   Help, please.  
Thanks.___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Space leak

2010-03-11 Thread Stephen Tetley
Hi Arnoldo

This doesn't address the space leak, but your parseChromosome function
looks very inefficient - isInfixOf is repeatedly checking the prefix
chromosome for C1 to CY. If you have a lot of CY's in a file then it
will do a lot of work parsing them.

The cleanest way of handling this would be to use a parser combinator
library with keywords for chromosome and mitochondrion - however
that might add a performance penalty itself.

Here is a version that should be fairly efficient although a little
ugly due to how it has to match literal chars in prefix of the string:

Add a import for Data.Char to the import list:

 import Data.Char

Add Enum to the deriving clause of the Chromosome data type:

| C19
| CX
| CY
| CMT
  deriving (Show,Enum)


Replace parseChromosome with the one below.

Note that the derived Enum functions for Chromosome are indexed from
0.. whereas when you read one from the file it is indexed from 1.. so
you have to sub1 before using toEnum:


sub1 :: Int - Int
sub1 x = x-1

parseChromosome :: [Char] - Chromosome
parseChromosome ('c':'h':'r':'o':'m':'o':'s':'o':'m':'e':' ':xs) = chro xs
  where
   chro ('X' :_)  = CX
   chro ('Y' :_)  = CY
   chro ( x  : ',' :_)| isDigit x  = toEnum (sub1 $ digitToInt x)
   chro ('1' :  x  : ',' :_ ) | isDigit x  = toEnum (sub1 $ (10+) $
digitToInt x)
   chro ('1' :  x  :_ )   | isDigit x  = toEnum (sub1 $ (10+) $
digitToInt x)
   chro _ = error BAD header

parseChromosome ('m':'i':'t':'o':'c':'h':'o':'n':'d':'r':'i':'o':'n':_) = CMT
parseChromosome _ = error BAD header



Best wishes

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


Re: [Haskell-cafe] Cabal and LLVM bindings

2010-03-11 Thread Thomas Schilling
Do you happen to use template haskell?  It looks like the interpreter
is trying to load llvm, which is currently not supported.  That
doesn't explain why it works with ghc --make though.  Do you do
anything special in your .cabal file?


On 11 March 2010 12:30, Ville Tirronen alea...@gmail.com wrote:
 Hi!

 I'm trying to get cabal build my toy compiler, which is based on llvm
 bindings on hackage. Everything is fine with ghc --make,
 but with cabal install I get:

 Loading package llvm-0.7.1.1 ... command line: can't load .so/.DLL
 for: LLVMSystem (dlopen(libLLVMSystem.dylib, 9): image not found)
 cabal: Error: some packages failed to install:
 QV-0.1 failed during the building phase. The exception was:
 ExitFailure 1

 This is done on os x 10.5.8, if that has any relevance.

 Anyone got any hints on how to proceed with this?

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




-- 
Push the envelope.  Watch it bend.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Happstack basic question

2010-03-11 Thread Kyle Murphy
Ah, I see, I was looking at the example code in the Happstack documentation
you linked. Looking at the documentation of Network.Socket I can see where
it provides an option to bind on a particular address. The example given in
the Happstack docs uses bindPort to get the socket which confused me as
didn't realize you could initialize a socket using the Network.Socket
functions and just pass that instead. The example in your latest mail is
much clearer.

-R. Kyle Murphy
--
Curiosity was framed, Ignorance killed the cat.


On Thu, Mar 11, 2010 at 09:35, Martin Kiefel m...@nopw.de wrote:

 On Thu, Mar 11, 2010 at 09:24:05AM -0500, Kyle Murphy wrote:
  You misunderstand his question. He's trying to setup happstack behind a
  reverse proxy running on the same system, so he needs to be able to bind
 it
  only to the loopback interface (127.0.0.1), as opposed to all the
 interfaces
  on the system (thereby making it inaccessible from the network unless
  accessed through the proxy). I don't know enough about happstack to
 answer
  his question, but I can see from the documentation you provided that
 there
  doesn't seem to be any way to specify address to bind to as Dmitry stated
 in
  his original e-mail.

 But I'm doing exactly that.

 Here is some of the code:

 main = do

  ...

  s - socket AF_INET Stream defaultProtocol
  setSocketOption s ReuseAddr 1
  h - getHostByName localhost
  let p = toEnum $ port $ httpConf appConf
  bindSocket s (SockAddrInet p (hostAddress h))
  listen s 10

  -- start the state system
  control - startSystemState' (store appConf) stateProxy

  -- start the http server
  httpTid - forkIO $ simpleHTTPWithSocket s (httpConf appConf)

  ...

 And then my happstack server is just listening on 127.0.0.1.

 To access it, I'm using Apache Proxy.

 - Martin

 
  -R. Kyle Murphy
  --
  Curiosity was framed, Ignorance killed the cat.
 
 
  On Thu, Mar 11, 2010 at 07:39, Martin Kiefel m...@nopw.de wrote:
 
   Hi Dmitry,
  
   On Thu, Mar 11, 2010 at 11:38:44AM +0300, Dmitry V'yal wrote:
Hello haskellers,
   
I want to host a simple happstack application behind a reverse proxy.
 So
ideally would be to bind it to localhost only.
   
According to
   
  
 http://hackage.haskell.org/packages/archive/happstack-server/0.4.1/doc/html/Happstack-Server-HTTP-Types.html#t%3AConf
Conf datatyle has only Port field. Does it mean, there is currently
 no
way to prevent binding happstack to all available interfaces?
  
   I think you are looking for simpleHTTPWithSocket [1]. You can use
   whatever socket you like.
  
   
Regards,
Dmitry
  
   Cheers,
   Martin
  
   [1]
  
 http://happstack.com/docs/0.4/happstack-server/Happstack-Server-SimpleHTTP.html#v%3AsimpleHTTPWithSocket
   ___
   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] definition of sum

2010-03-11 Thread Daniel Fischer
Am Donnerstag 11 März 2010 15:23:32 schrieb Yitzchak Gale:
 TeXitoi wrote:
  why is foldl used by Data.List for sum?

 Daniel Fischer wrote:
  Because Haskell is a non-strict language, and foldl' is strict --
  someone might write a (legitimate) Num instance for a datatype such
  that foldl (+) 0 xs returns a good value, but foldl' (+) 0 xs gives
  ***Exception: Prelude.undefined for some lists xs.

 It is possible to define such a Num instance, but it is extremely rare
 for anything like that to come up in practice.


Yes. And I'd expect foldr (+) 0 to be much more useful for lazy Num 
instances than foldl (+) 0. Nevertheless, one has to take that possibility 
into account.

  However, with optimisations turned on... GHC knows that sum is
  actually strict

 GHC does that when optimizations are turned on, but that behavior
 is not required by the Haskell standard. So there is no guarantee
 that any given compiler will produce usable output if you use foldl
 instead of foldl' for sum.

 In GHCi sum is broken, because optimizations are not in
 effect there. You have to define your own version of sum
 using foldl' for every GHCi session (or put it in your .ghci file).

 So it's a trade-off between a slight convenience in a bizarre
 corner case and general usability. I agree with Don that this is
 a bug in the Haskell 98 standard.

I'm not sure whether it's a wart or a bug, but I agree that it would be 
better to have the default sum strict (and provide lazysum for the cases 
where it's useful).


 Regards,
 Yitz

Cheers,
Daniel

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


Re: [Haskell-cafe] definition of sum

2010-03-11 Thread David Leimbach


   However, with optimisations turned on... GHC knows that sum is
   actually strict
 
  GHC does that when optimizations are turned on, but that behavior
  is not required by the Haskell standard. So there is no guarantee
  that any given compiler will produce usable output if you use foldl
  instead of foldl' for sum.
 
  In GHCi sum is broken, because optimizations are not in
  effect there. You have to define your own version of sum
  using foldl' for every GHCi session (or put it in your .ghci file).
 
  So it's a trade-off between a slight convenience in a bizarre
  corner case and general usability. I agree with Don that this is
  a bug in the Haskell 98 standard.

 I'm not sure whether it's a wart or a bug, but I agree that it would be
 better to have the default sum strict (and provide lazysum for the cases
 where it's useful).


That would be really inconsistent with the way the rest of the Haskell
language and libraries works.

Note that foldl' has a ' to indicate that it's not the same as foldl
exactly.  I would propose that sum' exist as well as sum, and that sum be
lazy.

Part of what's interesting about Haskell is the default non-strict
evaluation of the language, and even if it's hard for newcomers to get used
to it, they're better off having a consistent space to work in rather than
all these exceptions to make algorithms like sum work more efficiently
when the problem was one of documentation and education about the language.

Of course if you want a strict functional language there's plenty of those
out there.

Dave



 
  Regards,
  Yitz

 Cheers,
 Daniel

 ___
 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] ANN: powerpc-0.0.1

2010-03-11 Thread John Van Enk
Serguey,

I'm working on a similar project. What's the chance you have your source
code in the open?

/jve

On Thu, Mar 11, 2010 at 7:30 AM, Serguey Zefirov sergu...@gmail.com wrote:

 2010/3/10 Tom Hawkins tomahawk...@gmail.com:
  On Wed, Mar 10, 2010 at 8:07 AM, Warren Henning
  warren.henn...@gmail.com wrote:
  Wow. Quite ambitious.
 
  Was this inspired by work at your current employer like with Atom and
  some of the other stuff you've released?
 
  Yes, we had an immediate need to debug some machine code.  I looked
  around, but all the emulators I found (PSIM, et al.) were too
  complicated.
 
  I'm also intrigued by the emphasis on software verification at the
  object code level for aerospace (DO-178).  I figure better tools in
  this area may open the door to using advanced design methods like Atom
  for avionics.  Of course it's unlikely this project will reach that
  level of maturity, but you never know.

 We wrote the debugger and simulator for AVR line of microcontroller cores.

 We used a DSEL to describe inner workings of commands and now try to
 apply it to ARM ISA.

 The Haskell code is heavy on the use of type-level computations and,
 especially, assiciated types.
 ___
 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] ANN: powerpc-0.0.1

2010-03-11 Thread Serguey Zefirov
2010/3/11 John Van Enk vane...@gmail.com:
 Serguey,
 I'm working on a similar project. What's the chance you have your source
 code in the open?
 /jve

I'll ask.

But chances are pretty small.

I'll think about reimplementing command description from scratch.

 On Thu, Mar 11, 2010 at 7:30 AM, Serguey Zefirov sergu...@gmail.com wrote:

 2010/3/10 Tom Hawkins tomahawk...@gmail.com:
  On Wed, Mar 10, 2010 at 8:07 AM, Warren Henning
  warren.henn...@gmail.com wrote:
  Wow. Quite ambitious.
 
  Was this inspired by work at your current employer like with Atom and
  some of the other stuff you've released?
 
  Yes, we had an immediate need to debug some machine code.  I looked
  around, but all the emulators I found (PSIM, et al.) were too
  complicated.
 
  I'm also intrigued by the emphasis on software verification at the
  object code level for aerospace (DO-178).  I figure better tools in
  this area may open the door to using advanced design methods like Atom
  for avionics.  Of course it's unlikely this project will reach that
  level of maturity, but you never know.

 We wrote the debugger and simulator for AVR line of microcontroller cores.

 We used a DSEL to describe inner workings of commands and now try to
 apply it to ARM ISA.

 The Haskell code is heavy on the use of type-level computations and,
 especially, assiciated types.
 ___
 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] ANN: powerpc-0.0.1

2010-03-11 Thread John Van Enk
Serguey,

The system I'm writing has a type in place for the AVR instruction set. I'm
working on writing an assembler/disassembler for it as well. It might make
sense, if your employer deems it worthwhile to release the code, to
collaborate.

/jve

On Thu, Mar 11, 2010 at 11:35 AM, Serguey Zefirov sergu...@gmail.comwrote:

 2010/3/11 John Van Enk vane...@gmail.com:
  Serguey,
  I'm working on a similar project. What's the chance you have your source
  code in the open?
  /jve

 I'll ask.

 But chances are pretty small.

 I'll think about reimplementing command description from scratch.

  On Thu, Mar 11, 2010 at 7:30 AM, Serguey Zefirov sergu...@gmail.com
 wrote:
 
  2010/3/10 Tom Hawkins tomahawk...@gmail.com:
   On Wed, Mar 10, 2010 at 8:07 AM, Warren Henning
   warren.henn...@gmail.com wrote:
   Wow. Quite ambitious.
  
   Was this inspired by work at your current employer like with Atom and
   some of the other stuff you've released?
  
   Yes, we had an immediate need to debug some machine code.  I looked
   around, but all the emulators I found (PSIM, et al.) were too
   complicated.
  
   I'm also intrigued by the emphasis on software verification at the
   object code level for aerospace (DO-178).  I figure better tools in
   this area may open the door to using advanced design methods like Atom
   for avionics.  Of course it's unlikely this project will reach that
   level of maturity, but you never know.
 
  We wrote the debugger and simulator for AVR line of microcontroller
 cores.
 
  We used a DSEL to describe inner workings of commands and now try to
  apply it to ARM ISA.
 
  The Haskell code is heavy on the use of type-level computations and,
  especially, assiciated types.
  ___
  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] Re: Cabal dependency hell

2010-03-11 Thread Rogan Creswick
On Mon, Mar 8, 2010 at 2:31 PM, Maciej Piechotka uzytkown...@gmail.com wrote:
 On Mon, 2010-03-08 at 15:37 +0100, Marc Weber wrote:
 We can't expect package maintainers to test everything.
 So it must be people like you and me who fixes those changes.


 Well. Except that it require bumping versions. Which according to
 hackage policy requires to fork a project (which makes it pointless in
 the first place)

This isn't quite that dire -- I've adopted the following practice when
I encounter a cabal dependency issue:

 (a) identify the problem (eg: observing `cabal install foo` fails)
 (b) get the source via hackage: `cabal unpack foo`
 (c) fix the unpacked version, and increment the version number by
adding a new level of detail (so, 3.1.0 becomes 3.1.0.1).  This
version number never leaves my system -- it only exists to keep my
cabal/ghc-pkg consistent!
 (d) if possible, verify that the problem still exists in the
project's actual source control
 (e) email the maintainer, and if possible, including a patch to the
current head of the revision control system for the project.

So far, it's worked pretty well :) Everyone I've sent patches to has
been very responsive and helpful, often pushing updated versions to
hackage by the end of the day.

 The way to go is make hackage allow changing constraints on the fly
 notifying the author that he can update his repository.

You can, at times, do this by forcing constraints via cabal command
line flags, or by installing packages with a version specification.

$ cabal install foo-1.2.3

will install that specific version of foo.

--Rogan


 This will work in most cases.

 Bumping versions because a dependency has changed is bad as well.

 This will cause to much overhead (and it dosen't solve the problem
 because the old package is still wrong).

 Specifying dependencies must be decoupled from bumping versions.

 It's because dep specs do depend on the world which can change..

 At least that's what I think.


 Hmm. When I was returning home I thought about some wiki-like system
 that would allow to say 'Package X is compatible/not compatible with Y'.

 Possibly something like:
  - Only the 'sure' deps are installed in default mode
  - When in 'expert' mode I can install any package which has not been
 marked as incompatible

 Then I can say that I tested built and:
  - It failed to built
  - It failed the automatic tests (if they exists)/does not work
  - It success

 So if there is versions:
 0.7 0.8 0.9 1.0 1.0.1 1.1 1.2 1.3 1.4

 And:
  - 0.8 failed to built
  - =1.0 1.1 was marked by author
  - 1.1 was marked as success
  - 1.3 failed to build

 Then
  - In default/normal mode it can be used with 1.0, 1.0.1 and 1.1
  - In expert mode 0.9 and 1.2 can be installed in addition to above
  - Any version can be installed in 'I'm feeling lucky' mode when I
 explicitly say package to ignore some restriction

 Possibly it is needed to collect user karma (or possibly already account
 verification is sufficient).

 If you're interested in Nix and hack-nix I can show you how everything
 works using an SSH session.


 Ekhm... SSH?

 Marc Weber

 Regards

 ___
 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] ANN: powerpc-0.0.1

2010-03-11 Thread Serguey Zefirov
2010/3/11 John Van Enk vane...@gmail.com:
 Serguey,
 The system I'm writing has a type in place for the AVR instruction set. I'm
 working on writing an assembler/disassembler for it as well. It might make
 sense, if your employer deems it worthwhile to release the code, to
 collaborate.
 /jve

Our work is concerned with semantics of operations.

So we build a list of Commands:

data Command cpu = Command {
 cmdName :: String -- right now it's just a string, but it could
be a pretty printer
 -- with calculations for disasm.
,cmdFormat :: [Match cpu] -- when we decode a command in a simulation,
-- we set some CPU variables.
-- that's what Match encode.
,cmdStatements :: [Stat cpu] -- the semantics of command.
}

And then we use that list to generate code for our simulation package.

Lately we found that we could use those command descriptions for other
purposes, like automatic code generator generators, etc, but we didn't
explored all that yet.

So we don't have a specific type of AVR commands. We have general
description of (almost) arbitrary CPU commands which we successfully
applied to AVR line of microcontroller cores.

Statements contains assignments (Variable cpu size := Expression cpu
size), conditionals and various CPU- and bus-specific function
invocation (like read from memory or write to it).

 On Thu, Mar 11, 2010 at 11:35 AM, Serguey Zefirov sergu...@gmail.com
 wrote:

 2010/3/11 John Van Enk vane...@gmail.com:
  Serguey,
  I'm working on a similar project. What's the chance you have your source
  code in the open?
  /jve

 I'll ask.

 But chances are pretty small.

 I'll think about reimplementing command description from scratch.

  On Thu, Mar 11, 2010 at 7:30 AM, Serguey Zefirov sergu...@gmail.com
  wrote:
 
  2010/3/10 Tom Hawkins tomahawk...@gmail.com:
   On Wed, Mar 10, 2010 at 8:07 AM, Warren Henning
   warren.henn...@gmail.com wrote:
   Wow. Quite ambitious.
  
   Was this inspired by work at your current employer like with Atom
   and
   some of the other stuff you've released?
  
   Yes, we had an immediate need to debug some machine code.  I looked
   around, but all the emulators I found (PSIM, et al.) were too
   complicated.
  
   I'm also intrigued by the emphasis on software verification at the
   object code level for aerospace (DO-178).  I figure better tools in
   this area may open the door to using advanced design methods like
   Atom
   for avionics.  Of course it's unlikely this project will reach that
   level of maturity, but you never know.
 
  We wrote the debugger and simulator for AVR line of microcontroller
  cores.
 
  We used a DSEL to describe inner workings of commands and now try to
  apply it to ARM ISA.
 
  The Haskell code is heavy on the use of type-level computations and,
  especially, assiciated types.
  ___
  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] ANN: HaskellTorrent v0.1.1

2010-03-11 Thread Jesper Louis Andersen
Hello Cafe,

I am pleased to announce yet another release of the HaskellTorrent
project. In this release, focus has been on improving upon the work
laid in v0.0. Highlights include:

* Certain data structures have changed from Data.List to Data.IntSet,
yielding much improved performance.
* Addition of a GetOpt option parser.
* Use of test-framework to run unit-tests.
* Assertion optimization, cutting down CPU usage by quite a margin.
* Change SHA1 checksumming to use Peter Simons hopenssl package. This
plugged some serious memory leaks.

* Support for listen() on port 1579 so incoming connections get
handled correctly.
* Support for more graceful stopping. The supervisor tree is now
terminated in the opposite order of creation.
* When closing down, tell the tracker we are stopping.
* Add KeepAlive messages on idle socket connections.
* Improve the console interface a bit so it is quasi-usable.

* Change the logging framework from my own to hslogger by John
Goerzen. It is better than my attempts and it shaves 150 lines of code
from the project not having to maintain a logging framework.

This also makes the client BEP003 compliant, so we can now claim to be
a full BitTorrent client. Looking forward, I'd like to get less CPU
usage, and support for more BitTorrent extensions.

--

There are still bugs in the code, so watch out for spinning processes.
Also, performance is still far from optimal. From a profiler run, we
get the following:

total time  =   64.26 secs   (3213 ticks @ 20 ms)
total alloc = 6,712,153,496 bytes  (excludes profiling overheads)

COST CENTREMODULE   %time %alloc

MAIN   MAIN  58.03.7
assertPieceDB  Process.PieceMgr  13.4   29.6
logP   Process3.76.0
syncP  Process2.8   12.1
download   Main   2.10.0
updateBS   Digest 2.10.0
recvP  Process2.04.3
choosePProcess1.97.0
receiverP  Process.Peer   1.81.5
peerP  Process.Peer   1.20.6
grabBlocks'Process.PieceMgr   1.03.1
senderPProcess.Peer   1.01.4
sendP  Process0.93.1
checkPiece FS 0.76.1
msgPeerProcess.ChokeMgr   0.62.4
registerL  Process.Timer  0.21.9
getByteString  Data.Serialize.Get 0.21.0
newBuffer  Data.Serialize.Builder   0.0   10.1

which tells us we are still allocating far too much memory. I wonder
what the 58.0% on MAIN means (this is with -prof -auto-all -caf-all).
The code is heavily concurrent, using the cml package. My guess is
that we have somewhere between 500 and 1000 threads when running. I
ponder if that has something to do with it. The price of assertPieceDB
can easily be removed by running the assertions at a rarer pace.

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


Re: [Haskell-cafe] Re: Anyone up for Google SoC 2010?

2010-03-11 Thread Max Bolingbroke
On 11 March 2010 13:42, Andrew Coppin andrewcop...@btinternet.com wrote:
 Yeah, I thought the IHG recently spent a bunch of money on getting it
 working on Linux. I gather Windows is a lowER priority (although it IS on
 the to-do list).

AFAIK shared libraries now work on Windows - Ben Lippmeier (under the
auspices of the IHG) recently commited what were apparently the
missing pieces there. I haven't actually tried it out though.

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


Re: [Haskell-cafe] Re: Anyone up for Google SoC 2010?

2010-03-11 Thread phil
Would be great to see GHC on Maemo.  I recently bought an N900 and
googled around to see if this is possible to write Haskell for the
platform.

The short answer is 'not easily'

There are some old notes on getting previous versions compiling, but
nothing up to date

I gave up pretty quickly :-(


On Wed, 2010-03-10 at 17:43 -0500, Yakov Zaytsev wrote:
 I've got N900 recently and saw that according to this page
 
 http://hackage.haskell.org/trac/ghc/wiki/Platforms
 
 it's not possible to run GHC and GHCi easily on ARM. This sucks.
 
 I want to propose a project bring GHC back to life on arm-linux. It is
 supposed that the outcome will be a package for Maemo 5.
 
 Actually, I want to apply for this project as a student. I hope to make
 NCG for ARM working in some sense.
 
 Dear list, what do you think about it?
 
 -- Yakov
 
 
 ___
 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] Re: Anyone up for Google SoC 2010?

2010-03-11 Thread John Meacham
On Thu, Mar 11, 2010 at 10:02:42PM +, phil wrote:
 Would be great to see GHC on Maemo.  I recently bought an N900 and
 googled around to see if this is possible to write Haskell for the
 platform.

Just a note, jhc works just fine for cross-compiling to maemo. It is one
of the first cross-platform targets I tested with.

John

-- 
John Meacham - ⑆repetae.net⑆john⑈ - http://notanumber.net/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: ANNOUNCE: Bravo-0.1.0

2010-03-11 Thread Simon Michael

Thank you, how does it compare to HStringTemplate ?

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


Re: [Haskell-cafe] Space leak

2010-03-11 Thread Daniel Fischer
Am Donnerstag 11 März 2010 00:24:28 schrieb Daniel Fischer:
 Hmm, offhand, I don't see why that isn't strict enough.

Turns out, mapM_ was a red herring. The villain was (zip and map).
I must confess, I don't know why it sort-of worked without the mapM_, 
though. sort-of, because that also hung on to unnecessarily much memory, 
the space leak was just smaller than with the mapM_.

A very small change that eliminates the space leak, is

readFasta :: Int - [Char] - [Window]
readFasta windowSize sequence =
    -- get the header
    let (header,rest) = span (/= '\n') sequence
        chr = parseChromosome header
go i (w:ws) = Window w chr i : go (i+1) ws
go _ [] = []
in go 0 $ slideWindow windowSize $ filter (/= '\n') rest

You can improve performance by eliminating slideWindow and the intermediate 
Window list (merging fastaExtractor and readFasta), 

{-# LANGUAGE BangPatterns #-}

readFasta2 :: (String - Bool) - Int - String
readFasta2 test windowSize sequence =
let (header,rest) = span (/= '\n') sequence
chr = parseChromosome header
schr = show chr
go !i st@(_:tl)
| test w= w ++ '\t' : schr ++ '\t' : show i ++ '\n' : go 
(i+1) tl
| otherwise = go (i+1) tl
  where
w = take windowSize st
go _ [] = []
in go 0 (filter (/= '\n')) rest

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


Re: [Haskell-cafe] Space leak

2010-03-11 Thread Arnoldo Muller
Daniel,

Thank you so much for helping me out with this issue!

Thanks to all the other answers from haskel-cafe members too!

As a newbie, I am not able to understand why zip and map would make a
problem...

Is there any link I could read that could help me to understand why in this
case
zip and map created a leak? What are some function compositions that should
be
avoided when doing lazy I/O?

Regards,

Arnoldo


On Thu, Mar 11, 2010 at 11:46 PM, Daniel Fischer
daniel.is.fisc...@web.dewrote:

 Am Donnerstag 11 März 2010 00:24:28 schrieb Daniel Fischer:
  Hmm, offhand, I don't see why that isn't strict enough.

 Turns out, mapM_ was a red herring. The villain was (zip and map).
 I must confess, I don't know why it sort-of worked without the mapM_,
 though. sort-of, because that also hung on to unnecessarily much memory,
 the space leak was just smaller than with the mapM_.

 A very small change that eliminates the space leak, is

 readFasta :: Int - [Char] - [Window]
 readFasta windowSize sequence =
 -- get the header
 let (header,rest) = span (/= '\n') sequence
 chr = parseChromosome header
go i (w:ws) = Window w chr i : go (i+1) ws
go _ [] = []
in go 0 $ slideWindow windowSize $ filter (/= '\n') rest

 You can improve performance by eliminating slideWindow and the intermediate
 Window list (merging fastaExtractor and readFasta),

 {-# LANGUAGE BangPatterns #-}

 readFasta2 :: (String - Bool) - Int - String
 readFasta2 test windowSize sequence =
let (header,rest) = span (/= '\n') sequence
chr = parseChromosome header
schr = show chr
go !i st@(_:tl)
| test w= w ++ '\t' : schr ++ '\t' : show i ++ '\n' : go
 (i+1) tl
| otherwise = go (i+1) tl
  where
w = take windowSize st
go _ [] = []
in go 0 (filter (/= '\n')) rest


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


[Haskell-cafe] Re: [Haskell] ANNOUNCE: Bravo-0.1.0

2010-03-11 Thread Matthias Reisner

Hi Marc,

I'm sorry, the current Bravo version does not support caching of 
evaluated templates. Maybe this will be a feature of later releases.



Matthias


Am 11.03.2010 10:02 schrieb Marc Weber:

Hi Matthias,

  
Bravo is inspired by the PHP template engine Smarty and the Haskell 


Smarty is also about caching. Can you say whether your library support
kind of caching as well?

Marc Weber
  


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


Re: [Haskell-cafe] Re: ANNOUNCE: Bravo-0.1.0

2010-03-11 Thread Matthias Reisner

Am 11.03.2010 23:38 schrieb Simon Michael:

Thank you, how does it compare to HStringTemplate ?



Hi Simon,

I never worked with HStringTemplate, so as far as I can tell after 
having a glance at the HStringTemplate API and the wiki page, the main 
difference is that Bravo parses the templates at compile time, while 
HStringTemplate does at runtime. Besides that, HStringTemplate provides 
several methods for rendering different data types in different styles. 
This can also be accomplished in Bravo by writing the appropriate 
rendering function in your Haskell code and using it in the template.



Regards,

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


Re: [Haskell-cafe] ANNOUNCE: Bravo-0.1.0

2010-03-11 Thread Michael Snoyman
Matthis,

Thank you for releasing this library, it looks very intriguing. I've been
building web apps using HStringTemplate up until now, and one thing that
always irks me is that- while the rest of my program is checked at
compile-time- my template results need to be checked manually at runtime.
One of my todo-list items was to write a library that fixed this: it looks
like yours does just that.

I'll need to look into the library a bit more to get a better idea, but it
seems like Bravo could work for my needs. One thing that concerns me is your
comment that it allows embedding of Haskell expressions. In general, I try
to keep a strict separation between login and presentation: can you explain
exactly what type of expressions can be embedded?

Also, while looking through the example, it looks like the library is making
some automatic translations, like firstName - userFirstName and user -
users. I've found these kinds of mappings to be brittle in the past; can you
explain how this is done (or if I'm simply missing something obvious)?

Finally, I can't seem to get it to compile on 6.12. Any chance of getting a
version out that supports it?

Thanks,
Michael

On Wed, Mar 10, 2010 at 8:46 PM, Matthias Reisner 
matthias.reis...@googlemail.com wrote:

 Hello,

 I'm pleased to announce the first release of Bravo, a static text template
 generation library, on Hackage: http://hackage.haskell.org/package/Bravo.

 Bravo is a text template library that provides parsing and generation of
 templates at compile time. Templates can be read from strings or files and
 for each a new record data type is created, allowing convenient access to
 all template variables in a type-safe manner. Since all templates are
 processed at compile time, no extra file access or error handling at runtime
 is necessary.

 Bravo is inspired by the PHP template engine Smarty and the Haskell
 template library chunks. Compared to chunks, Bravo provides additional
 features like conditional template evaluation, embedding of Haskell
 expressions and customized data type generation. I'm going to add further
 information to the HaskellWiki page (
 http://www.haskell.org/haskellwiki/Bravo) later.

 Bravo is still highly experimental and not well-tested, so bug reports and
 additional feedback are very welcome. I'd also like to hear if you feel the
 package dependencies are to restrictive.


 Regards,

 Matthias Reisner
 ___
 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] 3rd party widgets with qtHaskell (Marble)

2010-03-11 Thread Philip Beadling
On Wed, 2010-03-10 at 11:22 +0100, Alp Mestanogullari wrote:
 This something you are afaik able to do. 
 
 
 I'm cc'ing David (qthaskell's author).
 

Thanks for the reply.  I've worked it out.

The below code demonstrates getting and setting a property from a marble
widget.

I'm a little surprised it worked.  If my C++ is right what I've done
here is dynamically cast the Marble widget as it's Qt parent.

This of course is fine, but given that longitude() is not a virtual
function on the parent, I'd to have to cast as the child to access this
function - my code shouldn't have scope of Marble specific functions.

This doesn't follow C++ (or I need to brush up on my OO programming!).

I can live with this, after all I'm not writing a C++ program, but if
anyone can explain this I'd be interested to understand why.

One other peculiarity I noticed was that the qVariant constructor will
only take Double or Integer types if they are nested in a tuple.  Again,
this is fine, but at odds with the documentation which implies
constructors can take:

() | p1 | (p1) | (p1,p2,...pn)


So I'm over the first hurdle; it is possible, now to think of something
interesting to do with it :-)



module Main where

import Qtc

main :: IO ()
main
  = do
app - qApplication  () 
rok - registerResource marble.rcc
loader - qUiLoader ()
uiFile - qFile :/marble.ui
open uiFile fReadOnly
ui - load loader uiFile
close uiFile ()

ui_map - findChild ui (QWidget*, marbleWidget)
ui_button - findChild ui (QPushButton*, pushButton)  

sc - qObjectProperty ui_map longitude
bt - qObjectProperty ui_button text

long - qVariantValue_Double sc

print long

x - qVariant (-1::Double)
blah - qObjectSetProperty ui_map longitude x
  

qshow ui ()
ok - qApplicationExec ()
return ()


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


Re: [Haskell-cafe] ANNOUNCE: Bravo-0.1.0

2010-03-11 Thread Matthias Reisner

Hi Michael

Am 12.03.2010 01:33 schrieb Michael Snoyman:

I'll need to look into the library a bit more to get a better idea, but it
seems like Bravo could work for my needs. One thing that concerns me is your
comment that it allows embedding of Haskell expressions. In general, I try
to keep a strict separation between login and presentation: can you explain
exactly what type of expressions can be embedded?


This is really one disadvantage of the current Bravo version I'm 
worrying about too. At the moment you can insert arbitrary Haskell 
expressions, so no one prevents the template writer from inserting 
expressions like `unsafePerformIO launchAtomicMissile  return '. 
Some kind of security mechanism will definitely be included in future 
releases, but I'm not sure in what way at the moment. I thought about 
passing a list of permitted function names to the template creation 
function and then failing with an error if any other functions are used.



Also, while looking through the example, it looks like the library is making
some automatic translations, like firstName - userFirstName and user -
users. I've found these kinds of mappings to be brittle in the past; can you
explain how this is done (or if I'm simply missing something obvious)?


Bravo creates a data type per template, where the default naming scheme 
for the data type/constructor name is name - TplName. For each 
template variable a record field is created; for a template temp and a 
variable var the name will be tempVar. Have a look at the 
`mkTemplatesWithOptions' and `mkTemplatesFromFileWithOptions' functions, 
that allow you to customize this naming scheme.



Finally, I can't seem to get it to compile on 6.12. Any chance of getting a
version out that supports it?


The problem seems to be haskell-src-meta, that doesn't like 
template-haskell-2.4, and on the other side I can't get build 
template-haskell  2.4 with GHC-6.12. So I will contact Matt Morrow, the 
maintainer of haskell-src-meta, and see if he can fix it.



Regards,

Matthias




Thanks,
Michael

On Wed, Mar 10, 2010 at 8:46 PM, Matthias Reisner 
matthias.reis...@googlemail.com wrote:


Hello,

I'm pleased to announce the first release of Bravo, a static text template
generation library, on Hackage: http://hackage.haskell.org/package/Bravo.

Bravo is a text template library that provides parsing and generation of
templates at compile time. Templates can be read from strings or files and
for each a new record data type is created, allowing convenient access to
all template variables in a type-safe manner. Since all templates are
processed at compile time, no extra file access or error handling at runtime
is necessary.

Bravo is inspired by the PHP template engine Smarty and the Haskell
template library chunks. Compared to chunks, Bravo provides additional
features like conditional template evaluation, embedding of Haskell
expressions and customized data type generation. I'm going to add further
information to the HaskellWiki page (
http://www.haskell.org/haskellwiki/Bravo) later.

Bravo is still highly experimental and not well-tested, so bug reports and
additional feedback are very welcome. I'd also like to hear if you feel the
package dependencies are to restrictive.


Regards,

Matthias Reisner
___
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] If wishes were horses... (was: Re: definition of sum)

2010-03-11 Thread wren ng thornton

David Leimbach wrote:

Note that foldl' has a ' to indicate that it's not the same as foldl
exactly.  I would propose that sum' exist as well as sum, and that sum be
lazy.


I wish Haskell allowed ! to occur (non-initially) in alphanum_' 
identifiers as well as in symbolic ones. Then we could be more 
consistent about having ! mean strictness like it does with ($!), bang 
patterns, strict fields,... (too bad about (!) and (!!)). The prime has 
so many other uses, it's a shame it gets used up for strict/lazy 
variants, as if there were no other variations.


--
Live well,
~wren
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] How to do the permutation and combination thing?

2010-03-11 Thread Magicloud Magiclouds
Hi,
  For example, I have this:
list1 = [a, b, c]
list2 = [d, e, f]
list3 = [g, h, i]
  Now I want:
[ [(a, d, g), (b, e, h), (c, f, i)]
, ... ] -- a list that contains all the combinations.
  How to do it pretty? Thanks.
-- 
竹密岂妨流水过
山高哪阻野云飞
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] How to do the permutation and combination thing?

2010-03-11 Thread Casey Hawthorne
This sounds like homework.

Think in abstract terms what you want to accomplish.

Start with the simplest case first, usually the base case.


On Fri, 12 Mar 2010 14:02:02 +0800, you wrote:

Hi,
  For example, I have this:
list1 = [a, b, c]
list2 = [d, e, f]
list3 = [g, h, i]
  Now I want:
[ [(a, d, g), (b, e, h), (c, f, i)]
, ... ] -- a list that contains all the combinations.
  How to do it pretty? Thanks.
--
Regards,
Casey
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] How to do the permutation and combination thing?

2010-03-11 Thread Magicloud Magiclouds
All I could get is to use permutations and concatMap. But it looks really ugly.

On Fri, Mar 12, 2010 at 2:09 PM, Casey Hawthorne cas...@istar.ca wrote:
 This sounds like homework.

 Think in abstract terms what you want to accomplish.

 Start with the simplest case first, usually the base case.


 On Fri, 12 Mar 2010 14:02:02 +0800, you wrote:

Hi,
  For example, I have this:
list1 = [a, b, c]
list2 = [d, e, f]
list3 = [g, h, i]
  Now I want:
[ [(a, d, g), (b, e, h), (c, f, i)]
, ... ] -- a list that contains all the combinations.
  How to do it pretty? Thanks.
 --
 Regards,
 Casey
 ___
 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