Re: [Haskell-cafe] Type-class conditional behavior

2011-05-08 Thread Stephen Tetley
On 8 May 2011 06:14, Nicholas Tung nt...@ntung.com wrote: Dear all,     I'd like to write a function maybeShow :: a - Maybe String, which runs show if its argument is of class Show. I'm pretty sure this is not readily possible - there might be some hack through Typeable but that would oblige

Re: [Haskell-cafe] Type-class conditional behavior

2011-05-08 Thread Ryan Ingram
The behavior you are asking for maybeShow violates parametricity, so it can't exist without some sort of typeclass constraint. That said, in your particular situation, it's an interesting question. The Show instance for Either is instance (Show a, Show b) = Show (Either a b) where ... so we as

Re: [Haskell-cafe] trying to cabal install lambdabot, failure on 'random' package

2011-05-08 Thread Sean Perry
On May 7, 2011, at 12:41 AM, Stephen Tetley wrote: show is the failing package A look on Hackage suggests that show had problems with its cabal file at versions 0.4 0.4.1 and was fixed at 0.4.1.1. Can you try installing show individually at 0.4.1.1 the try installing the rest of

Re: [Haskell-cafe] Type-class conditional behavior

2011-05-08 Thread Gábor Lehel
On Sun, May 8, 2011 at 7:14 AM, Nicholas Tung nt...@ntung.com wrote: Dear all,     I'd like to write a function maybeShow :: a - Maybe String, which runs show if its argument is of class Show.     The context and motivation for this are as follows. I have a GADT type which encapsulates

Re: [Haskell-cafe] no time profiling on my MacBookPro8,1

2011-05-08 Thread Malcolm Wallace
On 6 May 2011, at 23:07, Nicolas Frisby wrote: all of the %time cells in the generated Main.prof file are 0.0, as is the total time count (0.00 secs and 0 ticks). The %alloc cells seem normal. See http://hackage.haskell.org/trac/ghc/ticket/5137 Regards, Malcolm

Re: [Haskell-cafe] trying to cabal install lambdabot, failure on 'random' package

2011-05-08 Thread Stephen Tetley
It looks like cabal-install is wanting to do wacky things to the GHC boot libraries, which means something is seriously astray. What happens when you run `ghc-pkg check` ? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] trying to cabal install lambdabot, failure on 'random' package

2011-05-08 Thread Daniel Fischer
On Sunday 08 May 2011 09:24:50, Sean Perry wrote: package random-1.0.0.3 requires time-1.2.0.3 package random-1.0.0.3 requires time-1.2.0.4 Preprocessing library show-0.4.1.1... Building show-0.4.1.1... command line: cannot satisfy -package-id random-1.0.0.3-749b78c54a8a1b32dbb45d98a91b:

Re: [Haskell-cafe] Type-class conditional behavior

2011-05-08 Thread dm-list-haskell-cafe
At Sat, 7 May 2011 22:14:27 -0700, Nicholas Tung wrote: Dear all,     I'd like to write a function maybeShow :: a - Maybe String, which runs show if its argument is of class Show. You can't do this, because in general there is no way to know whether an arbitrary object a is of class Show.

[Haskell-cafe] For Project Euler #24 you don't need to generate all the lexicographic permutations Spoiler

2011-05-08 Thread caseyh
For Project Euler #24 you don't need to generate all the lexicographic permutations by Knuth's method or any other. You're only looking for the millionth lexicographic permutation of 0123456789 Problem 24 A permutation is an ordered arrangement of objects. For example, 3124 is one

Re: [Haskell-cafe] For Project Euler #24 you don't need to generate all the lexicographic permutations Spoiler

2011-05-08 Thread Jeff Wheeler
On Sun, May 8, 2011 at 10:41 AM, cas...@istar.ca wrote: For Project Euler #24 you don't need to generate all the lexicographic permutations by Knuth's method or any other. This is a clever, smart solution. You should post it to the Haskell Wiki page [0]. [0]

[Haskell-cafe] Apache license, any drawbacks for Haskell packages?

2011-05-08 Thread Magnus Therning
Are there any drawbacks to using the Apache license for Haskell packages? /M -- Magnus Therning OpenPGP: 0xAB4DFBA4 email: mag...@therning.org jabber: mag...@therning.org twitter: magthe http://therning.org/magnus I invented the term Object-Oriented, and I

Re: [Haskell-cafe] trying to cabal install lambdabot, failure on 'random' package

2011-05-08 Thread Albert Y. C. Lai
On 11-05-08 03:24 AM, Sean Perry wrote: package random-1.0.0.3 requires time-1.2.0.3 package random-1.0.0.3 requires time-1.2.0.4 In addition to unregistering --user random-1.0.0.3, also unregister --user time-1.2.0.4, the real culprit. The real culprit is why you are infected with a

Re: [Haskell-cafe] For Project Euler #24 you don't need to generate all the lexicographic permutations Spoiler

2011-05-08 Thread KC
I see from the solutions on Project Euler others did think of this way but at least on my last IQ test I did get an 'A'; 95. I am a jenius. :D -- -- Regards, KC ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

[Haskell-cafe] ANN: Newt - command-line template instantiation tool library

2011-05-08 Thread Rogan Creswick
I'm happy to announce Newt: a trivial tool for creating boilerplate. I frequently need to create projects with slight customizations -- I have a particular layout for cabal projects, and make files for LaTeX papers, etc... However, there are often fields that need to be updated in many places.

Re: [Haskell-cafe] ANNOUNCE: iterIO-0.1 - iteratee-based IO with pipe operators

2011-05-08 Thread Richard O'Keefe
On 7/05/2011, at 2:44 PM, Mario Blažević wrote: As I said, the most usual name for the Enumerator concept would be Generator. That term is already used in several languages to signify this kind of restricted coroutine. I'm not aware of any good alternative naming for Iteratee. This being

[Haskell-cafe] repa Shape help

2011-05-08 Thread briand
Howdy, as usual, the haskell type system complete defeats me in the simplest of applications: import Data.Array.Repa as A import Data.Array.Repa.Index import Data.Array.Repa.Shape as AS main = do let x = A.fromList (AS.shapeOfList [2, 2]) ([1.0, 2.0, 3.0, 4.0]::[Double]) putStrLn $ show x

Re: [Haskell-cafe] ANN: Newt - command-line template instantiation tool library

2011-05-08 Thread briand
On Sun, 8 May 2011 16:23:59 -0700 Rogan Creswick cresw...@gmail.com wrote: Newt scans the input (either a file, directory or stdin) for tags marked with tagName [1], then replaces those entries with values specified on the command line, producing either a new file, modifying the input