Re: [Haskell-cafe] Wrapping all fields of a data type in e.g. Maybe

2013-07-16 Thread Michael Orlitzky
On 07/16/2013 08:41 PM, John Lato wrote: > The suggestion of parameterizing on a functor would be good, however > there's another approach I've often seen (although it's not quite what > you've asked for). You can leave your config datatype alone, but > instead of making it a monoid have your conf

Re: [Haskell-cafe] Wrapping all fields of a data type in e.g. Maybe

2013-07-16 Thread David Thomas
Oh, very nice. It seems reasonable to extend this to Cfg -> IO Cfg to support things like dynamically loading config files, if needed. On Jul 16, 2013 5:42 PM, "John Lato" wrote: > The suggestion of parameterizing on a functor would be good, however > there's another approach I've often seen (al

Re: [Haskell-cafe] Wrapping all fields of a data type in e.g. Maybe

2013-07-16 Thread John Lato
The suggestion of parameterizing on a functor would be good, however there's another approach I've often seen (although it's not quite what you've asked for). You can leave your config datatype alone, but instead of making it a monoid have your configuration parsers return functions with the type

Re: [Haskell-cafe] Proposal: Non-recursive let

2013-07-16 Thread Richard A. O'Keefe
Brian Marick sent me a couple of his stickers. The one I have on my door reads "to be less wrong than yesterday". The other one I keep free to bring out and wave around: "An example would be handy about now." All of the arguing to and fro -- including mine! -- about non-recursive let has

Re: [Haskell-cafe] Proposal: Non-recursive let

2013-07-16 Thread Timon Gehr
On 07/11/2013 08:37 AM, AntC wrote: okmij.org> writes: ... In Haskell I'll have to uniquely number the s's: let (x,s1) = foo 1 [] in let (y,s2) = bar x s1 in let (z,s3) = baz x y s2 in ... and re-number them if I insert a new statement. I once wrote about 50-100

Re: [Haskell-cafe] Wrapping all fields of a data type in e.g. Maybe

2013-07-16 Thread Michael Orlitzky
On 07/16/2013 05:06 PM, Tom Ellis wrote: > On Tue, Jul 16, 2013 at 04:57:59PM -0400, Michael Orlitzky wrote: >> This all works great, except that when there's 20 or so options, I >> duplicate a ton of code in the definition of OptionalCfg. Is there some >> pre-existing solution that will let me tak

Re: [Haskell-cafe] Proposal: Non-recursive let

2013-07-16 Thread Andreas Abel
Ah, now I have the solution: {-# LANGUAGE CPP #-} (|>) = flip ($) #define LET(p, e) (e) |> \ (p) -> bla = LET(x, 5) LET(Just x, Just (x+1)) x #define MLET(p, e) (e) |> \ (p) -> do main = do MLET((x, y), (5, 3)) print (x + y) Beautiful, ain't it? Sigh. --Andreas On 11.07.2

Re: [Haskell-cafe] ordNub

2013-07-16 Thread Andreas Abel
On 14.07.2013 13:20, Niklas Hambüchen wrote: I've taken the Ord-based O(n * log n) implementation from yi using a Set: ordNub :: (Ord a) => [a] -> [a] ordNub l = go empty l where go _ [] = [] go s (x:xs) = if x `member` s then go s xs

Re: [Haskell-cafe] Wrapping all fields of a data type in e.g. Maybe

2013-07-16 Thread Oliver Charles
On 07/16/2013 09:57 PM, Michael Orlitzky wrote: > I have a common pattern in my command-line programs; I start out with a > configuration data type, which over-simplified looks like: > > data Cfg = Cfg { verbose :: Bool } > > Now, there's usually a default configuration, > > default :: Cfg >

Re: [Haskell-cafe] ANNOUNCE: module-management-0.9.3 - clean import lists, split and merge modules

2013-07-16 Thread David Fox
I am pleased to announce that, after a terrible struggle, version 0.13 of the module-management package is now available on hackage. The performance has been upped from dismal to adequate (about a 30-fold improvement) and many bugs have been fixed. The most important for import cleaning is that i

Re: [Haskell-cafe] Wrapping all fields of a data type in e.g. Maybe

2013-07-16 Thread Tom Ellis
On Tue, Jul 16, 2013 at 04:57:59PM -0400, Michael Orlitzky wrote: > This all works great, except that when there's 20 or so options, I > duplicate a ton of code in the definition of OptionalCfg. Is there some > pre-existing solution that will let me take a Cfg and create a new type > with Cfg's fie

[Haskell-cafe] Wrapping all fields of a data type in e.g. Maybe

2013-07-16 Thread Michael Orlitzky
I have a common pattern in my command-line programs; I start out with a configuration data type, which over-simplified looks like: data Cfg = Cfg { verbose :: Bool } Now, there's usually a default configuration, default :: Cfg default = Cfg False The user can override the defaults one of

[Haskell-cafe] FP Complete Accepting Submissions for Haskell Competition

2013-07-16 Thread Natalia Muska
We are excited to share we are accepting submissions for our *FP Haskell Competition *. Your code and tutorials can earn you $1,000 in cash prizes each month. We're looking for sample Haskell projects that solve specific real-wor

Re: [Haskell-cafe] [web-devel] Automatic error traces

2013-07-16 Thread Greg Weber
That's great. We should collaborate on this. I wrote the file-location package and Michael Snoyman wrote monad-logger: both of these give file location information. I also added command tracing to Shelly (which could also benefit from this kind of thing) and recently released rollbar for error noti

Re: [Haskell-cafe] TH splicing and recompilation checking

2013-07-16 Thread Tristan Ravitch
I think you want qAddDependentFile in Language.Haskell.TH.Syntax http://hackage.haskell.org/packages/archive/template-haskell/2.7.0.0/doc/html/Language-Haskell-TH-Syntax.html On Tue, Jul 16, 2013 at 05:41:19PM +, Johannes Waldmann wrote: > Hi. > > we are using template Haskell to splice

[Haskell-cafe] Call for Papers IFL 2013

2013-07-16 Thread publicityifl
Hello, Please, find below the third call for papers for IFL 2013. Please forward these to anyone you think may be interested. Apologies for any duplicates you may receive. best regards, Jurriaan Hage Publicity Chair of IFL CALL FOR PAPERS 25th SYMPOSIUM ON IMPLEMENTATION AND APPLICATION OF FUN

Re: [Haskell-cafe] TH splicing and recompilation checking

2013-07-16 Thread Erik Hesselink
There is a GHC ticket about implementing a DEPENDS pragma for doing this [0]. There are patches attached, but it looks like it isn't finished yet. Erik [0] http://ghc.haskell.org/trac/ghc/ticket/4900 On Tue, Jul 16, 2013 at 7:41 PM, Johannes Waldmann wrote: > Hi. > > we are using template Haske

Re: [Haskell-cafe] TH splicing and recompilation checking

2013-07-16 Thread Michael Sloan
Yup, such a thing exists! I think it's a little bit obscure because for some bizarre reason it isn't reexported by Language.Haskell.TH: http://hackage.haskell.org/packages/archive/template-haskell/2.8.0.0/doc/html/Language-Haskell-TH-Syntax.html#v:addDependentFile -Michael On Tue, Jul 16, 2013

[Haskell-cafe] TH splicing and recompilation checking

2013-07-16 Thread Johannes Waldmann
Hi. we are using template Haskell to splice in some code that is produced by reading and transforming the contents of another file. now, if this "other file" is touched (by editing), but not the main file, then ghc (and cabal) do not realize that the main file does need to be recompiled. is t

Re: [Haskell-cafe] Hoogle problems?

2013-07-16 Thread Neil Mitchell
No idea why it has gone down, my guess is that the Apache rule that says treat it as a CGI script got changed to serve it as a file. In the meantime you can use a copy of Hoogle at: https://www.fpcomplete.com/hoogle Thanks, Neil On Mon, Jul 15, 2013 at 5:19 PM, Niklas Hambüchen wrote: > OK, bu

Re: [Haskell-cafe] ordNub

2013-07-16 Thread Ketil Malde
Francesco Mazzoli writes: >> import qualified Data.HashSet as S >> >> nub :: Hashable a => [a] -> [a] >> nub = S.toList . S.fromList > Well, the above is not stable while Niklas’ is. But I guess that’s not > the point of your message :). We could also implement Data.BloomFilter.nub, which re

[Haskell-cafe] Automatic error traces

2013-07-16 Thread Alberto G. Corona
It is important to have execution traces in case of error. specially in server applications that run 24/7 such are web applications Thanks to the wonderful package monadloc by Pepe Iborra, now MFlow can generate a complete execution trace in case of error. The control-monad-exception uses monadLo

Re: [Haskell-cafe] What does it mean to derive "equations of restricted from" in Haskell?

2013-07-16 Thread Johannes Waldmann
Daryoush Mehrtash gmail.com> writes: > What does "restricted form" mean? non-restricted: e.g., f (f x y) z = f x (f y z)) restricted: the shape of function declarations in Haskell (where lhs is a pattern) > "definitions are terminating ... non-termination: an equation like "f x y = f y x"

[Haskell-cafe] What does it mean to derive "equations of restricted from" in Haskell?

2013-07-16 Thread Daryoush Mehrtash
In John Hughes's "The Design of Pretty printing library" paper, he says: "The implementations which we are trying to derive consist of equations of > a restricted form. We will derive implementations by proving their > constituent equations from the specification. By itself this is no > guarante