Re: [Haskell-cafe] CmdArgs non-flag arguments with newtypes

2013-07-29 Thread Michael Orlitzky
On 07/23/2013 11:48 PM, wren ng thornton wrote: On 7/23/13 9:01 PM, Michael Orlitzky wrote: Obviously not what I want! Has anyone else run into this? Figured out a workaround? I haven't run into this specific problem, but I do have a sort of workaround. Whenever dealing with CmdArgs (or any

[Haskell-cafe] CmdArgs non-flag arguments with newtypes

2013-07-23 Thread Michael Orlitzky
I ran into an issue wrapping a [String] in a newtype with CmdArgs. You're supposed to be able to declare that a field contains a list of non-flag arguments... this works fine: data Cfg = Cfg { whatever flags, usernames :: [String] } arg_spec = Cfg { whatever flags, usernames = def = args }

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

2013-07-21 Thread Michael Orlitzky
On 07/20/2013 04:49 PM, adam vogt wrote: Hi Michael, It's fairly straightforward to generate the new data with template haskell [1], and on the same page, section 10.7 'generic' zipWith is likely to be similar to your merging code. [1]

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

2013-07-19 Thread Michael Orlitzky
On 07/16/2013 04:57 PM, 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 fields wrapped

[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

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 take

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

Re: [Haskell-cafe] tangential request...

2013-06-23 Thread Michael Orlitzky
On 06/22/2013 11:09 PM, Evan Laforge wrote: You're overthinking it. I just sent a whole screen. You're probably right; done. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] tangential request...

2013-06-22 Thread Michael Orlitzky
On 06/22/2013 01:28 PM, Mark Lentczner wrote: 3) Do not resize the terminal window and 5) Take a screen shot of the whole terminal window are mutually exclusive? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Haskell Platform 2013.2.0.0 64bit.pkg

2013-06-14 Thread Michael Orlitzky
On 06/13/2013 02:13 AM, Richard A. O'Keefe wrote: My original problem was that I wanted to load a particular set of packages using 'cabal install'. It didn't work (cabal install issues) and while the maintainer reacted promptly and helpfully, cabal kept on trying to install the wrong version.

Re: [Haskell-cafe] Open-source projects for beginning Haskell students?

2013-03-11 Thread Michael Orlitzky
On 03/11/2013 11:48 AM, Brent Yorgey wrote: So I'd like to do it again this time around, and am looking for particular projects I can suggest to them. Do you have an open-source project with a few well-specified tasks that a relative beginner (see below) could reasonably make a contribution

[Haskell-cafe] Fixing undeduceable instance == overlapping instance

2013-02-23 Thread Michael Orlitzky
I'm trying to write a determinant function that works on matrices parameterized by their dimensions (Peano naturals). If I declare the following, -- Define a class so that we get a different determinant function -- on the base/recursive cases. class (Eq a, Ring.C a) = Determined m a where

Re: [Haskell-cafe] Fixing undeduceable instance == overlapping instance

2013-02-23 Thread Michael Orlitzky
On 02/24/2013 02:14 AM, Karl Voelker wrote: On Sat, Feb 23, 2013 at 10:28 PM, Michael Orlitzky mich...@orlitzky.com mailto:mich...@orlitzky.com wrote: -- Recursive case, (n+2) x (n+2) matrices. instance (Eq a, Ring.C a, Arity n) = Determined (Mat (S (S n)) (S (S n

Re: [Haskell-cafe] containers license issue

2012-12-17 Thread Michael Orlitzky
On 12/17/2012 01:47 PM, Clark Gaebel wrote: Does anyone ... want to talk to real lawyers ... No. This is absurd. If anyone cares, email the original author and explain the situation. Ask if he's cool with the reimplemented version. Chances are he'll say yeah, and we've just solved the problem

Re: [Haskell-cafe] containers license issue

2012-12-12 Thread Michael Orlitzky
On 12/12/2012 08:15 PM, Johan Tibell wrote: On Wed, Dec 12, 2012 at 12:18 PM, Dmitry Kulagin dmitry.kula...@gmail.com wrote: Clark, Johan, thank you! That looks like perfect solution to the problem. Clean-room reimplementation merged and released as 0.5.2.0. Not even a little bit

Re: [Haskell-cafe] How to determine correct dependency versions for a library?

2012-11-17 Thread Michael Orlitzky
Replying somewhere random in the thread. Linux distributions have to solve this same problem. We first need to decide what Hackage's function is supposed to be: (1) A dumb repository to host Haskell code (2) A collection of Haskell packages that work together In reality it's (1), but the

Re: [Haskell-cafe] curl package broken in Windows

2012-11-12 Thread Michael Orlitzky
On 11/12/12 17:43, Iavor Diatchki wrote: Hi, Ok, there were only minor differences between the repo and the version on hackage so I imported the changes into the repo, which should now be the same as version 1.3.7 on hackage. Please feel free to submit merge requestsall the folks I know

Re: [Haskell-cafe] ANN: fixed-vector

2012-11-12 Thread Michael Orlitzky
On 11/12/12 01:57, Carter Schonwald wrote: Michael, I think that calls for a type-class! (though I imagine theres a slicker way of writing it) I'm already using typeclasses, but there's still a bit of boilerplate. I could probably think of something more clever myself, but like I said, these

Re: [Haskell-cafe] ANN: fixed-vector

2012-11-12 Thread Michael Orlitzky
On 11/12/12 07:05, Aleksey Khudyakov wrote: I have a lot of one-off code where I've defined these myself. Is it possible to e.g. define vectors in R^2 and R^3, and write the p-norm functions only once? Yes. it's possible. {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE FlexibleInstances #-}

Re: [Haskell-cafe] ANN: fixed-vector

2012-11-11 Thread Michael Orlitzky
On 11/10/2012 06:59 AM, Aleksey Khudyakov wrote: Hello cafe! I want to announce library for the small vectors of fixed length fixed-vector[1]. Fixed means that vector's length is determined by its type. Generic API can work with both ATD-based vector like complex or Vec written below and

Re: [Haskell-cafe] Optimal line length for haskell

2012-10-29 Thread Michael Orlitzky
On 10/29/2012 07:50 AM, Rustom Mody wrote: There was a recent discussion on the python list regarding maximum line length. It occured to me that beautiful haskell programs tend to be plump (ie have long lines) compared to other languages whose programs are 'skinnier'. My thoughts on this are

Re: [Haskell-cafe] Optimal line length for haskell

2012-10-29 Thread Michael Orlitzky
On 10/29/2012 10:28 AM, Alexander Solla wrote: In any language, a line longer than 80 characters usually (but not always) suggests that you might want to stop and rethink your design. In many cases a refactoring or two will greatly simplify the code and reduce your line

Re: [Haskell-cafe] Ordering of BigFloats in numbers-3000.0.0.0

2012-10-11 Thread Michael Orlitzky
On 10/10/2012 01:20 AM, Carter Schonwald wrote: you should probably file a ticket on the DanBurton repo if he's the one doing the uploading :-) Yep, and he was nice enough to merge the fix and release a new version: http://hackage.haskell.org/package/numbers-3000.1.0.0

Re: [Haskell-cafe] Ordering of BigFloats in numbers-3000.0.0.0

2012-10-09 Thread Michael Orlitzky
On 10/09/2012 12:29 PM, Chaddaï Fouché wrote: On Sun, Oct 7, 2012 at 8:00 PM, Michael Orlitzky mich...@orlitzky.com wrote: I'm trying to use, http://hackage.haskell.org/package/numbers-3000.0.0.0 to get better precision for free out of some numerical code. I ran into an issue pretty

[Haskell-cafe] Ordering of BigFloats in numbers-3000.0.0.0

2012-10-07 Thread Michael Orlitzky
I'm trying to use, http://hackage.haskell.org/package/numbers-3000.0.0.0 to get better precision for free out of some numerical code. I ran into an issue pretty quickly, though. In Data.Number.BigFloat, we have, data BigFloat e = BF (Fixed e) Integer deriving (Eq, Ord) and the derived

Re: [Haskell-cafe] Ordering of BigFloats in numbers-3000.0.0.0

2012-10-07 Thread Michael Orlitzky
On 10/07/2012 02:31 PM, Claude Heiland-Allen wrote: On 07/10/12 19:00, Michael Orlitzky wrote: I'm trying to use, http://hackage.haskell.org/package/numbers-3000.0.0.0 You might also try my: http://hackage.haskell.org/package/variable-precision It's Ord should work, I've used

Re: [Haskell-cafe] Pure and monadic functions using the Repa arrays

2012-08-21 Thread Michael Orlitzky
On 08/21/12 09:19, felipe zapata wrote: Hi Haskellers, I have been playing with the Repa functions and trying the Repa-examples. In order to gain experience with the Repa functions I have written some small linear algebra utilities and import this module to a bigger project. In the

Re: [Haskell-cafe] Network.Curl cookie jar madness

2012-08-19 Thread Michael Orlitzky
On 08/19/2012 12:58 PM, Iustin Pop wrote: On more investigation, this seems to be due to the somewhat careless use of Foreign.Concurrent; from the docs: “The finalizer will be executed after the last reference to the foreign object is dropped. There is no guarantee of promptness, and

[Haskell-cafe] Network.Curl cookie jar madness

2012-08-18 Thread Michael Orlitzky
I'm one bug away from a working program and need some help. I wrote a little utility that logs into LWN.net, retrieves an article, and creates an epub out of it. Full code here: git clone http://michael.orlitzky.com/git/lwn-epub.git This is the code that gets the login cookie: cj -

Re: [Haskell-cafe] Network.Curl cookie jar madness

2012-08-18 Thread Michael Orlitzky
On 08/18/2012 09:00 PM, Iustin Pop wrote: On Sat, Aug 18, 2012 at 08:52:00PM -0400, Michael Orlitzky wrote: Curl is making the request, but if I remove the (hPutStrLn stderr response_body), it doesn't work! What's even more insane is, this works: hPutStrLn stderr response_body

Re: [Haskell-cafe] Network.Curl cookie jar madness

2012-08-18 Thread Michael Orlitzky
On 08/18/2012 08:52 PM, Michael Orlitzky wrote: I'm one bug away from a working program and need some help. I wrote a little utility that logs into LWN.net, retrieves an article, and creates an epub out of it. I've created two pages where anyone can test this. The first just takes any username

Re: [Haskell-cafe] [Haskell] Spam on the Haskell wiki

2012-07-30 Thread Michael Orlitzky
On 07/30/2012 05:35 PM, Henk-Jan van Tuyl wrote: On Mon, 16 Jul 2012 00:03:49 +0200, Henk-Jan van Tuyl hjgt...@chello.nl wrote: I am willing to do administrator tasks. 4. ReCAPTCHA enabled for 'edits adding new, unrecognized external links' - which is all of the spam. This is already

Re: [Haskell-cafe] Any good tool to write Haskell documents including tests?

2012-07-10 Thread Michael Orlitzky
On 07/10/12 10:20, Takayuki Muranushi wrote: Hello, I have been a forgetful person, and lots of things I have only pretended to understand. I want to change this. So, to educate myself, I'd like to write documented tests for many libraries I meet, and also publish them onto the web so that

[Haskell-cafe] Network.Curl curiosity

2012-06-28 Thread Michael Orlitzky
I've been fighting with this silly bug: I have two functions using curl (Network.Curl) for logging in via POST and downloading pages via GET. They do the usual boring stuff; cookies go in a text file whose path is passed in to both functions. They work great individually. But, I'm calling them

[Haskell-cafe] HXT: Replace an element with its text

2012-06-26 Thread Michael Orlitzky
I would like to replace, bodya href=#foo/a/body with, bodyfoo/body using HXT. So far, the closest I've come is to parse the HTML and apply the following stuff: is_link :: (ArrowXml a) = a XmlTree XmlTree is_link = hasName a replace_links_with_their_text :: (ArrowXml a) = a

Re: [Haskell-cafe] HXT: Replace an element with its text

2012-06-26 Thread Michael Orlitzky
On 06/26/12 05:15, Ivan Perez wrote: Hi, You code fails because a link is not a node of kind Text, I think. What you want is to get the text from a child node of an anchor node. I think the following should work: Yes, thank you. That makes sense now. process_link :: (ArrowXml a) = a

Re: [Haskell-cafe] HXT: Replace an element with its text

2012-06-26 Thread Michael Orlitzky
On 06/26/12 10:39, Uwe Schmidt wrote: processTopDown $ (deep getText mkText) `when` is_link should do it. The deep getText will find all Text nodes, independent of the nesting of elements in the a.../a element. If you then write the result into a document every thing is fine. One small

Re: [Haskell-cafe] Darcs home page updated

2012-04-30 Thread Michael Orlitzky
On 04/30/12 15:27, Simon Michael wrote: With 2.8 released, I felt Darcs deserves better presentation. After surveying other VCS sites I worked on an update to our home page layout and content over the last few days, with review and input from #darcs, and it went live last night. It's far from

[Haskell-cafe] Non-exhaustive pattern match warning (incorrect?)

2011-12-26 Thread Michael Orlitzky
I'm cleaning up some old projects, and hit this: src/Octet.hs:47:27: Warning: Pattern match(es) are non-exhaustive In a record-update construct: Patterns not matched: Octet.None But in the source, I've checked for that case: class Maskable a where apply_mask :: a - Maskbits -

Re: [Haskell-cafe] Non-exhaustive pattern match warning (incorrect?)

2011-12-26 Thread Michael Orlitzky
On 12/26/11 13:42, Antoine Latter wrote: Am I overlooking something, or did I already match Octet.None? What is your definition of the 'Octet' type? -- An Octet consists of eight bits. For our purposes, the most -- significant bit will come first. That is, b1 is in the 2^7 -- place while

Re: [Haskell-cafe] Non-exhaustive pattern match warning (incorrect?)

2011-12-26 Thread Michael Orlitzky
On 12/26/2011 03:17 PM, Antoine Latter wrote: The error is warning you that the record update 'oct { b8 = bit }' can fail at run-time if 'oct' is None. Since it looks like you've checked for that you shouldn't have a problem, but the compiler doesn't know that. Thanks, that's what I thought

Re: [Haskell-cafe] HaXml 1.13 - 1.22 upgrade

2011-12-12 Thread Michael Orlitzky
On 12/12/11 02:42, Malcolm Wallace wrote: The extra parameter i is for information attached to each node of the tree. As you have correctly guessed, the parser fills in this field with positional information relating to the original source document, which is useful for instance if you are

Re: [Haskell-cafe] HaXml 1.13 - 1.22 upgrade

2011-12-11 Thread Michael Orlitzky
On 12/11/2011 01:36 AM, Antoine Latter wrote: It looks like the function 'xmlParse' returns a value of type 'Document Posn', according to the API docs. I'm guessing the 'Posn' value is used to annotate the position in the source document a particular piece of XML came from, so you can report

[Haskell-cafe] HaXml 1.13 - 1.22 upgrade

2011-12-10 Thread Michael Orlitzky
I'm trying to migrate one my programs from the old HaXml API to the new. Please, someone save me. I'm currently stuck with this, which works in 1.13. All of the filters work on Content, so I make some from the root element with the root_elem = CElem root line. -- |Takes an XML String as

Re: [Haskell-cafe] A Mascot

2011-11-22 Thread Michael Orlitzky
On 11/22/11 16:52, heathmatlock wrote: Wasn't planning on it, but I saw some emails on the topic, so I worked on what I presented earlier: I liked him more back when he was called Curry. That he is a lamb is a cute play on words. But for me, The Lamb Da was facepalm-inducing because it seems

Re: [Haskell-cafe] Symbol collisions with -fhpc

2011-11-09 Thread Michael Orlitzky
On 11/08/11 22:33, Jason Dagit wrote: On Tue, Nov 8, 2011 at 9:40 AM, Michael Orlitzky mich...@orlitzky.com wrote: Does anyone know what causes these? This used to work, like, a month ago. It builds fine without the -fhpc. What has changed in that time? New Ghc? New updates from your OS

[Haskell-cafe] Symbol collisions with -fhpc

2011-11-08 Thread Michael Orlitzky
Does anyone know what causes these? This used to work, like, a month ago. It builds fine without the -fhpc. $ ghc -fhpc -O2 -odir /tmp -hidir /tmp --make -o bin/spline3 src/*.hs [ 1 of 17] Compiling ScaleFactor ( src/ScaleFactor.hs, /tmp/ScaleFactor.o ) ... [13 of 17] Compiling

Re: [Haskell-cafe] Waiting on input with `hWaitForInput' or `threadWaitRead'

2011-10-17 Thread Michael Orlitzky
On 10/17/11 04:58, Ertugrul Soeylemez wrote: I have uploaded a simple concurrent echo server implementation to hpaste [1]. It uses one thread for the stdout logger, one thread for the server, one thread for each client and finally a main thread waiting for you to hit enter to quit the

Re: [Haskell-cafe] Categorized Weaknesses from the State of Haskell 2011 Survey

2011-09-13 Thread Michael Orlitzky
On 09/12/11 17:48, Stephen Tetley wrote: Replying to someone's compliant in the first section: Malcolm Wallace and Colin Runciman's ICFP99 paper functioned well as a tutorial for HaXml when I used it - maybe it is a bit out of date now? HaXml is hardly a dire case. The paper is out-of-date,

Re: [Haskell-cafe] Categorized Weaknesses from the State of Haskell 2011 Survey

2011-09-13 Thread Michael Orlitzky
On 09/13/2011 05:15 PM, Malcolm Wallace wrote: I am the first to admit that HaXml's documentation is not as good as it could be, and I am sorry that you have had a bad experience. Sorry for the tirade =) That was a while ago, but I definitely felt some sympathy for the guy in the quote.

[Haskell-cafe] Memoization of functions

2011-09-06 Thread Michael Orlitzky
I'm working on a program where I need to compute a gajillion (171442176) polynomials and evaluate them more than once. This is the definition of the polynomial, and it is expensive to compute: polynomial :: Tetrahedron - (RealFunction Point) polynomial t = sum [ (c t i j k l) `cmult` (beta

[Haskell-cafe] (Repa) hFlush: illegal operation

2011-08-24 Thread Michael Orlitzky
I'm using Repa to process a ton of MRI data. The basic process is, * Read in the data * Create a big 'ol data structure (grid) from it * Compute the output in parallel using 'traverse' * Write the output to file However, during the last step, I'm getting, $ ./bin/spline3 +RTS -N4

Re: [Haskell-cafe] More QuickCheck Questions

2011-07-25 Thread Michael Orlitzky
On 07/25/11 06:01, Mark Spezzano wrote: Hi all, I still don't understand exactly how the QuickCheck sized function is meant to work, and what it's useful for. Please explain! Also, I think that class CoArbitrary can help to generate random *functions *(as opposed to values; but tell me if

Re: [Haskell-cafe] External system connections

2011-07-11 Thread Michael Orlitzky
On 07/10/11 15:37, Felipe Almeida Lessa wrote: You don't need to do it, it is already done =). See the pool package by Michael Snoyman on Hackage [1]. More specifically, see createPoolCheckAlive [2]. Cheers, [1] http://hackage.haskell.org/package/pool [2]

Re: [Haskell-cafe] External system connections

2011-07-11 Thread Michael Orlitzky
On 07/11/11 11:41, Felipe Almeida Lessa wrote: Yes, there's a documentation problem. But you can guess by the types =). IO a: opens a new resource a. a - IO (): disposes the given resource. Int: maximum number of open resources. Pool a - m b: the action you want to execute; after it

Re: [Haskell-cafe] External system connections

2011-07-11 Thread Michael Orlitzky
On 07/11/11 13:49, Michael Snoyman wrote: Author of the package speaking. I agree, that's a problem :). I've just uploaded a new version[1] that is properly documented, though it will take a bit for Hackage to generates the Haddocks. As Brandon said, the reason this wasn't documented in the