Re: [Haskell-cafe] fmap and LaTeX

2011-04-08 Thread Henning Thielemann
Mitar schrieb: Hi! Is there for $ (fmap) operator some nice looking symbol in mathematics, LaTeX? I am looking here: http://www.soi.city.ac.uk/~ross/papers/Applicative.html http://www.haskell.org/ghc/docs/6.12.1/html/libraries/base/Control-Applicative.html but only for other

Re: [Haskell-cafe] Is there a way to find out the type inferred for a local function inside another function? :)

2011-04-08 Thread Henning Thielemann
Magnus Therning schrieb: AFAIK there is no way to do that, thouhg scion[1] may offer it. Personally I develop more complex local functions at the top-level, and once I'm happy with it I perform some re-factoring and move it in. I would not write large local functions at all. I would leave

Re: [Haskell-cafe] Is there a way to find out the type inferred for a local function inside another function? :)

2011-04-07 Thread Henning Thielemann
http://www.haskell.org/haskellwiki/Determining_the_type_of_an_expression ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] llvm package on Windows

2011-04-04 Thread Henning Thielemann
Jacques Carette schrieb: I am trying to install llvm-0.9.0.1 on Windows (through cygwin), on top of a clean install of Haskell Platform 2010.2.0.0. I do cabal install llvm --configure-option --with-llvm-prefix=C:\\llvm (which is where I unpacked llvm-gcc4.2-2.8-x86-mingw43.tar.bz2). This

Re: [Haskell-cafe] Unboxing CFloat and GLfloat

2011-04-03 Thread Henning Thielemann
Jason Dagit schrieb: While the GLfloat instances don't need to be in base, the CFloat instance probably should be in base. Is this something I should make a library proposal for and submit patches? Is there an easier way to get these instances? Has someone already done this? Maybe the

OPTIONS_GHC -prof -auto-all

2011-03-26 Thread Henning Thielemann
I have a large package and want to profile all functions of a single module of that package. I tried to prepend the pragma {-# OPTIONS_GHC -prof -auto-all #-} to the mentioned module, but GHC rejects this, because the profiler options are not allowed in the OPTIONS pragma. According to

Re: [Haskell-cafe] How to use roots package?

2011-03-23 Thread Henning Thielemann
James Cook schrieb: Those are both options, as is to simply restart findRoot if it returns a 'Left' vaule. I personally would incline toward a custom driver function (findRoot). I should probably add one to the library that accepts a step limit and/or one that just iterates until

Re: [Haskell-cafe] Loops and ray casting with GPipe?

2011-03-22 Thread Henning Thielemann
On Tue, 22 Mar 2011, Jarkko Vilhunen wrote: Greetings, With OpenGL shaders it is possible to write code utilizing loops with unknown number of iterations, I'm wondering if the same can be done with GPipe? Fractals would be one use case and implicit surfaces another. Fragment Floats had to be

Re: [Haskell-cafe] ANN: Monad.Reader special Poetry and Fiction Edition

2011-03-21 Thread Henning Thielemann
Andrew Coppin schrieb: On 16/03/2011 03:05 PM, Brent Yorgey wrote: This kind of knot-tying approach is nice for static graphs. I think we should have a wiki page somewhere which explains what all the various Haskell-related terms mean. Terms like typing the knot and finally tagless. (Not

Re: [Haskell-cafe] Subsets and supersets

2011-03-21 Thread Henning Thielemann
Andrew Coppin schrieb: Haskell has ADTs. Most of the time, these work great. As I've written in several other places (but possibly not here), OO languages tend to factor the problem the other way. That is, if I want a binary tree, an OO language makes me split the type and all of its

Re: [Haskell-cafe] Uncertainty analysis library?

2011-03-21 Thread Henning Thielemann
On Mon, 21 Mar 2011, Tom Nielsen wrote: sampler = do x - gauss 0.0 1.0 y - gauss 0.0 1.0 return $ (2*x, x+y) main = do xys - take 10 `fmap` runSamplerIO sampler print $ runStat (both (before varF fst) (before varF snd)) $ xys =

Re: [Haskell-cafe] Uncertainty analysis library?

2011-03-20 Thread Henning Thielemann
On Sun, 20 Mar 2011, Edward Amsden wrote: Hi cafe, I'm looking for a library that provides an instance of Num, Fractional, Floating, etc, but carries uncertainty values through calculations. A scan of hackage didn't turn anything up. Does anyone know of a library like this? Do you mean

Re: [Haskell-cafe] Cabal test interface, what/where is it?

2011-03-18 Thread Henning Thielemann
On Fri, 18 Mar 2011, Magnus Therning wrote: On Fri, Mar 18, 2011 at 10:13:21PM +0100, Daniel Fischer wrote: On Friday 18 March 2011 21:51:27, Magnus Therning wrote: However, I can't seem to get the test's sources included in the tar-ball created by 'sdist'. Is there some trick to it?

Re: [Haskell-cafe] Defining subtraction for naturals

2011-03-17 Thread Henning Thielemann
On Thu, 17 Mar 2011, wren ng thornton wrote: (1) If the result would drop below zero then throw an overflow error; (2) Use saturating subtraction, i.e. if the result would drop below zero then return zero; (3) Use type hackery to disallow performing subtraction when the result would drop

Re: [Haskell-cafe] Lazy evaluation and tail-recursion

2011-03-16 Thread Henning Thielemann
On Wed, 16 Mar 2011, Daniel Fischer wrote: Tail recursion is good for strict stuff, otherwise the above pattern - I think it's called guarded recursion - is better, have the recursive call as a non-strict field of a constructor. In http://haskell.org/haskellwiki/Tail_recursion it is also

Re: [Haskell-cafe] Uncatchable error

2011-03-11 Thread Henning Thielemann
On Fri, 11 Mar 2011, Daniel Fischer wrote: On Friday 11 March 2011 17:04:16, Daniel Díaz wrote: Hi, cafe, I'm working in a program where I use many connections with Network.HTTP. Sometimes, connections are closed while my program is reading them, and an error appears: socket: XXX:

Re: [Haskell-cafe] Uncatchable error

2011-03-11 Thread Henning Thielemann
On Fri, 11 Mar 2011, Daniel Peebles wrote: Check out the spoon package on hackage. It's designed for these kinds of situations, and will wrap up common user-generated pure exceptions into a Maybe (and will return Nothing in the cases you describe) This is a hack, since 'undefined' cannot

Re: [Haskell-cafe] Custom monad using ST

2011-03-09 Thread Henning Thielemann
On Wed, 9 Mar 2011, Yves Parès wrote: Hello, I am trying to make a monad that uses ST internally. But even when reducing this to the simplest case I'm still cramped by the 's' phantom type : {-# LANGUAGE Rank2Types #-} newtype MyST a = MyST (forall s. ST s a) -- ^ I cannot use deriving

[Haskell-cafe] Explicitly Typed Exceptions in Haskell 98 (Was: Idiomatic error handling in Haskell)

2011-03-07 Thread Henning Thielemann
On Wed, 2 Mar 2011, Henning Thielemann wrote: On Wed, 2 Mar 2011, Rouan van Dalen wrote: I would like to know what is the preferred Haskell mechanism for handling exceptions in the IO monad? I am not concerned with mechanisms such as Maybe / Either, but would like to know about exception

Re: [Haskell-cafe] groupBy huh?

2011-03-07 Thread Henning Thielemann
Jacek Generowicz schrieb: Hi Cafe, It seems that I don't understand what groupBy does. I expect it to group together elements as long as adjacent ones satisfy the predicate, so I would expect ALL four of the following to give one group of 3 and a group of 1. Prelude :m + Data.List

Re: [Haskell-cafe] silently-0.0.1 (prevent IO actions from writing to stdout)

2011-03-07 Thread Henning Thielemann
On Mon, 7 Mar 2011, trysta...@comcast.net wrote: * I could see what OS it is and try those options and use a temp file only if it's an unexpected os. Unfortunately System.Info.os reports windows (and some other os's) as mingw32, I think it's because of how GHC was compiled. Who knows what

Re: [Haskell-cafe] Creating a darcs repo and trac

2011-03-06 Thread Henning Thielemann
On Sun, 6 Mar 2011, Dominic Steintiz wrote: I'd like to create a darcs repo for a package I've just created so people can do: darcs get http://code.haskell.org/largeword I can logon to code.haskell.org but I don't have permission to create a directory in /srv/code which is what I thought I

Re: [Haskell-cafe] ANN: theoremquest-0.0.0

2011-03-03 Thread Henning Thielemann
Daniel Peebles schrieb: Have you tried it? It's completely addictive (and takes up a big chunk of my free time). +1 after completing some missions in PVS. :-) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Idiomatic error handling in Haskell

2011-03-02 Thread Henning Thielemann
On Wed, 2 Mar 2011, Rouan van Dalen wrote: I would like to know what is the preferred Haskell mechanism for handling exceptions in the IO monad? I am not concerned with mechanisms such as Maybe / Either, but would like to know about exception mechanisms inside the IO monad. The 2 I know

[Haskell-cafe] Rebindable 'let' for observable sharing?

2011-02-28 Thread Henning Thielemann
Now that almost every syntax can be redirected to custom functions (RebindableSyntax, OverloadedStrings), would it make sense to map 'let' to 'fix' ? Would this open a way to implement observable sharing as needed in EDSLs by a custom 'fix'? ___

Re: [Haskell-cafe] Performance difference between ghc and ghci

2011-02-23 Thread Henning Thielemann
Roel van Dijk schrieb: In general code compiled with GHC will be a lot faster than code interpreted by GHCI. You can also call compiled code from within GHCI, in which case you would hardly see a performance difference. $ ghci -fobject-code compiles modules before loading into the interpreter

Re: [Haskell-cafe] Status update on {code, trac, projects, planet, community}.haskell.org

2011-02-17 Thread Henning Thielemann
Duncan Coutts schrieb: Several people have asked about the new host key. Yes, there is a new RSA host key for the community server, the fingerprint of which is: 21:b8:59:ff:39:69:58:7a:51:ef:c1:d8:c6:24:6e:f7 ssh will likely give you a scary warning and you'll need to delete the old

Re: [Haskell-cafe] Help needed for converting IOArray to ByteString

2011-02-17 Thread Henning Thielemann
On Tue, 8 Feb 2011, C K Kashyap wrote: I need to convert IOArray to bytestring as shown below -  import Data.Array.IO import Data.Binary.Put import qualified Data.ByteString.Lazy as BS import Data.Word main = do arr - newArray (0,9) 0 :: IO (IOArray Int Int) let bs=toByteString arr return ()

Re: [Haskell-cafe] Status update on {code, trac, projects, planet, community}.haskell.org

2011-02-16 Thread Henning Thielemann
Thank you a lot for bringing code.haskell.org back! I missed it a lot! However, I still get $ ssh code.haskell.org @@@ @ WARNING: POSSIBLE DNS SPOOFING DETECTED! @ @@@

Re: [Haskell-cafe] Cabal license combinations

2011-02-16 Thread Henning Thielemann
Chris Smith schrieb: It feels to me like a quite reasonable simplification that if someone wants to offer different bits of code, with the intent that the license terms of the eventual executable may be different depending on which bits you use, then they ought to do so in different packages.

Re: [Haskell-cafe] ghci command line execution

2011-02-14 Thread Henning Thielemann
Thomas Davie schrieb: A while ago I remember someone showing me some tool, I *think* ghci that allowed you to pass it a function of type String - String as an input, and have it simply run that function on stdin (presumably using interact) to achieve useful things like this... $ cat

Re: [Haskell-cafe] Why is there no splitSeperator function in Data.List

2011-02-13 Thread Henning Thielemann
On Sun, 13 Feb 2011, Iustin Pop wrote: On Sat, Feb 12, 2011 at 11:21:37AM -0500, Gwern Branwen wrote: See http://hackage.haskell.org/package/split The reason it's not in Data.List is because there are a bazillion different splits one might want (when I was pondering the issue before Brent

Re: [Haskell-cafe] Inheritance and Wrappers

2011-01-31 Thread Henning Thielemann
On Mon, 31 Jan 2011, MattMan wrote: I'm new to Haskell, and am trying to implement some simple typeclasses for doing algebra. For example I have type class (simplified for the sake of argument) class AbGroup a where add :: a - a - a I would like any type instantiating Num to also be an

Re: [Haskell-cafe] Inheritance and Wrappers

2011-01-31 Thread Henning Thielemann
On Mon, 31 Jan 2011, Brandon S Allbery KF8NH wrote: On 1/31/11 15:24 , Daniel Fischer wrote: want. You could then also enable OverlappingInstances, which would allow you to write other instances, but that extension is widely regarded as dangerous (have to confess, I forgot what the dangers

Re: [Haskell-cafe] Instantiation problem

2011-01-30 Thread Henning Thielemann
Patrick Browne schrieb: On 29/01/2011 20:56, Henning Thielemann wrote: Is there a reason why you use an individual type for every unit? The existing implementations of typed physical units only encode the physical dimension in types and leave the unit factors to the value level. I found

Re: [Haskell-cafe] Instantiation problem

2011-01-30 Thread Henning Thielemann
Patrick Browne schrieb: On 30/01/2011 19:43, Henning Thielemann wrote: I do not see a constant 1 that is equated with a type. This is due to my misunderstanding of Haskell. After your comments my understanding of the unit function is as follows: 1) In the instance below the argument

Re: [Haskell-cafe] [Haskell] A few days to go before the old server goes down

2011-01-29 Thread Henning Thielemann
Henk-Jan van Tuyl schrieb: L.S., Only four days until the old Haskell.org server disappears; I found the following missing: http://www.haskell.org/yale/ http://darcs.haskell.org/hfuse/ http://haskell.org/gtk2hs/ http://haskell.org/FranTk http://www.haskell.org/yampa/

Re: [Haskell-cafe] tricky recursive type instance method

2011-01-29 Thread Henning Thielemann
Frank Kuehnel schrieb: Hi folks, how do I make this work: I want a division algebra over a field k, and I want to define the conjugation of complex numbers, i.e. conj (C 1 2) but also the conjugation of tensors of complex numbers conj (C (C 1 2) (C 1 4)) ghci load that stuff butt

Re: [Haskell-cafe] Instantiation problem

2011-01-29 Thread Henning Thielemann
Patrick Browne schrieb: Below is some code that is produces information about the *types* used for measuring (e.g. metres). The following evaluation returns 1.00 which the convert factor for metres. convertFactorToBaseUnit (unit (LengthInMetres 7)) . The next evaluation returns the type,

Re: [Haskell-cafe] source line annotations

2011-01-28 Thread Henning Thielemann
Evan Laforge schrieb: One of the first things I did when starting a larger haskell project was to write a preprocessor that would replace certain tokens with (token_srcpos (filename, func_name, lineno)) and then write x and x_srcpos versions of the various 'throw' and logging functions. This

Re: [Haskell-cafe] Haskell for children? Any experience?

2011-01-28 Thread Henning Thielemann
Chris Smith schrieb: On Thu, 2011-01-27 at 11:44 -0600, aditya siram wrote: I was a little negative in my last message so maybe I can contribute something positive. If you're looking for a musical way to teach Haskell I did a Haskell music hackathon [1] about a year and a half ago. The idea

Re: [Haskell-cafe] HMatrix Vector/Matrix interpolation ala Matlab interp/interp2 ??

2011-01-25 Thread Henning Thielemann
On Tue, 25 Jan 2011, gutti wrote: I created some code from scratch - probably ugly beginners style - so I'm keen to get tips how to make it more pretty and faster Can you please add type signatures? This would help me understanding. import Data.List -- Input Data xi :: [Double] xi = [0

Re: [Haskell-cafe] HMatrix Vector/Matrix interpolation ala Matlab interp/interp2 ??

2011-01-23 Thread Henning Thielemann
On Sun, 23 Jan 2011, Claude Heiland-Allen wrote: essentially, it creates a matrix of 1d splines, but now I see that this isn't what you wanted... for interpolated 2d matrix lookup, something like this, perhaps: Interpolated matrix or vector lookup can of course be written as interpolation

Re: [Haskell-cafe] HMatrix Vector/Matrix interpolation ala Matlab interp/interp2 ??

2011-01-22 Thread Henning Thielemann
On Sat, 22 Jan 2011, gutti wrote: I'm looking for Vector and especially Matric interpolation ala: z = interp2 (xMatrix, yMatrix, zMatrix, x, y) - x and y can be single values or also vectors or matrices - indeally with the options nearest, linear, quadratic, qubic.. Any hope that

Re: [Haskell-cafe] Effective function representation.

2011-01-22 Thread Henning Thielemann
On Sat, 22 Jan 2011, Grigory Sarnitskiy wrote: I need to deal with functions of type (Double - Double). I need Fourier transform, integration, + - * / operations, value of a function in a point, probably composition. Incidentally I am currently working on a function representation based on

Re: [Haskell-cafe] Effective function representation.

2011-01-22 Thread Henning Thielemann
On Sat, 22 Jan 2011, Henning Thielemann wrote: http://code.haskell.org/numericprelude/src/MathObj/Gaussian/Polynomial.hs a hyphen was missing: http://code.haskell.org/numeric-prelude/src/MathObj/Gaussian/Polynomial.hs ___ Haskell-Cafe mailing

Re: [Haskell-cafe] HMatrix Vector/Matrix interpolation ala Matlab interp/interp2 ??

2011-01-22 Thread Henning Thielemann
On Sat, 22 Jan 2011, gutti wrote: I just don't fully get how it works: - are t a b c d points or curve parameters ? - how does lifting to matrix create a 1d spline to a 2d spline ? -- I don't see how it works I think it interpolates cubically between four equidistant nodes, then it lifts

Re: [Haskell-cafe] class-instance

2011-01-20 Thread Henning Thielemann
On 20/01/2011 18:56, Ryan Ingram wrote: On Wed, Jan 19, 2011 at 11:56 PM, Patrick Browne patrick.bro...@dit.ie wrote: I am trying to see what how this requirement can be represented using just the normal instance-implements-class relation for a comparison with a specification language

Re: [Haskell-cafe] A question about monad laws

2011-01-20 Thread Henning Thielemann
C K Kashyap schrieb: Hi, I am trying to get a better understanding of the monad laws - right now, it seems too obvious and pointless. I had similar feelings about identity function when I first saw it but understood its use when I saw it in action. Could someone please help me get a better

Re: [Haskell-cafe] Mailing lists on projects.haskell.org

2011-01-18 Thread Henning Thielemann
On Tue, 18 Jan 2011, John Lato wrote: In case anyone was replying off-list, could you please cc me as well?  I believe this is the cause of problems with the iteratee list (which Maciej just mentioned) as well.  Although the problem does seem intermittent. My messages to haskell-llvm are

Re: ltrace on FFI calls

2011-01-17 Thread Henning Thielemann
On Fri, 14 Jan 2011, Henning Thielemann wrote: I want to trace calls from a Haskell program to LLVM. I tried ltrace and latrace. latrace didn't trace anything useful and ltrace shows at least the call to one function (LLVMBuildRetVoid), but not the other ones. I'm quite confident that I

Re: [Haskell-cafe] class-instance

2011-01-17 Thread Henning Thielemann
On Mon, 17 Jan 2011, Patrick Browne wrote: -- My intension is that the PERSON class should *specify* -- that a person has a constant id called p1 -- and that a person has a name that can be found from the id. class PERSON a b where p1 :: a name :: a - b -- My intension is that the instance

Re: [Haskell-cafe] Haskell, C and Matrix Multiplication

2011-01-17 Thread Henning Thielemann
Blake Rain wrote: Oh yeah, it does. You're right. I haven't used it in so long that I forgot about them! No need to be sorry. Well, +2 for C, eh? :) And I'd just make a mess if I used the preprocessor. C optimizer should also unroll loops. ___

Re: [Haskell-cafe] Haskell, C and Matrix Multiplication

2011-01-17 Thread Henning Thielemann
Blake Rain wrote: Determinant is a bit fiddly, but quite trivial. However it is woefully slow at O(n!). I need to make use of LU decomposition (in which the determinant is the sum of the diagonal values in U). product of diagonal values Adjoint is even more of a fiddle, but

Re: [Haskell-cafe] Haskell, C and Matrix Multiplication

2011-01-17 Thread Henning Thielemann
Ketil Malde wrote: Blake Rain blake.r...@gmail.com writes: Here is the one in C: void multiplyM4 (float m1[4][4], float m2[4][4], float m3[4][4]) { m1[0][0] = m2[0][0] * m3[0][0] + m2[0][1] * m3[1][0] + m2[0][2] * m3[2][0] + m2[0][3] * m3[3][0]; m1[0][1] = m2[0][0] * m3[0][1] + m2[0][1] *

ltrace on FFI calls

2011-01-14 Thread Henning Thielemann
I want to trace calls from a Haskell program to LLVM. I tried ltrace and latrace. latrace didn't trace anything useful and ltrace shows at least the call to one function (LLVMBuildRetVoid), but not the other ones. I'm quite confident that I linked to LLVM dynamically, since the executable is

Re: [Haskell-cafe] Haskell for Gingerbread

2011-01-13 Thread Henning Thielemann
John Meacham wrote: On Thu, Jan 13, 2011 at 3:07 AM, Stefan Kersten s...@k-hornz.de wrote: On 28.12.10 21:25, John Meacham wrote: jhc generated C works on the android/ARM just fine. Android specific libraries arn't available, so you would have to bind to what you want with the FFI. is there a

Re: [Haskell-cafe] Type System vs Test Driven Development

2011-01-12 Thread Henning Thielemann
On Wed, 12 Jan 2011, Serge Le Huitouze wrote: Also, I wonder how you guys do when you're trying to tests code using a lot of numbers (be them floating point or even integer). Machine size integers and floating point numbers are indeed nasty. I test a lot in NumericPrelude with QuickCheck,

Re: [Haskell-cafe] GHC.Ptr, Foreign.Storable, Data.Storable.Endian, looking for good examples of usage

2011-01-11 Thread Henning Thielemann
On Mon, 10 Jan 2011, Aaron Gray wrote: Yes. I have came back to looking at the binary package, the only thing is I think I have to build my own primatives with it as it is big-endian, where ActionScript Byte Code format is little-endian. It does provide some little-endian functions but they

Re: [Haskell-cafe] [Haskell] School of Expression pages missing from haskell.org

2011-01-11 Thread Henning Thielemann
On Tue, 11 Jan 2011, Julian Gilbey wrote: Does anyone know what has happened to the Haskell School of Expression (SOE) webpages? The link from books for learning Haskell now gives a 404 Not Found error. Maybe caused by the recent server move. ___

Re: [Haskell-cafe] GHC.Ptr, Foreign.Storable, Data.Storable.Endian, looking for good examples of usage

2011-01-10 Thread Henning Thielemann
John Lato schrieb: You could use my word24 package[1] (GHC only) to provide non-aligned 24-bit word and int types with Storable instances. You should be able to write a binary instance (or whatever blaze-builder needs) fairly simply from this. Little-endian only ATM, but BE could be added

Re: [Haskell-cafe] GHC.Ptr, Foreign.Storable, Data.Storable.Endian, looking for good examples of usage

2011-01-09 Thread Henning Thielemann
On Sun, 9 Jan 2011, Aaron Gray wrote: I am trying to work out how to use GHC.Ptr, Foreign.Storable, Data.Storable.Endian, and am looking for good examples of usage. What do you intend to do with them? The package storablevector uses a lot of Ptr, peek, and poke. Maybe this is of some

Re: [Haskell-cafe] Generalizing catMaybes

2011-01-08 Thread Henning Thielemann
On Sat, 8 Jan 2011, Roman Cheplyaka wrote: I think catMaybes deserves its own typeclass, which would represent truncatable structures: class Truncatable struct where catMaybes :: struct (Maybe a) - Maybe a But catMaybes has the type catMaybes :: struct (Maybe a) - struct a for

Re: [Haskell-cafe] Generalizing catMaybes

2011-01-08 Thread Henning Thielemann
On Fri, 7 Jan 2011, Brandon S Allbery KF8NH wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 1/7/11 21:56 , Tony Morris wrote: I am wondering if it possible to generalise catMaybes: (Something f, SomethingElse t) = t (f a) - t a I have being doing some gymnastics with Traversable

Re: [Haskell-cafe] Is this the right way to do polymorphism?

2011-01-08 Thread Henning Thielemann
On Fri, 7 Jan 2011, Daryoush Mehrtash wrote: -- | Performs a signed request with the available token. serviceRequest :: (HttpClient c,MonadIO m) = c - OAuthRequest - OAuthMonadT m Response serviceRequest c req = do { result - lift $ runClient c (unpackRq req) I do not see, why different

Re: [Haskell-cafe] Generalizing catMaybes

2011-01-08 Thread Henning Thielemann
On Sat, 8 Jan 2011, Conor McBride wrote: On 8 Jan 2011, at 11:14, Henning Thielemann wrote: For me, the solutions of Dave Menendez make most sense: Generalize Maybe to Foldable and List to MonadPlus. What has it to do with monads? There's no bind in sight. I see a '=' in front of each

Re: [Haskell-cafe] Generalizing catMaybes

2011-01-08 Thread Henning Thielemann
On Sat, 8 Jan 2011, Conor McBride wrote: Of course, there is an alternative generalisation. [] and Maybe are both Foldable, hence so is their composition. There's got to be a thing of type collapse :: (Foldable f, Alternative a) = f x - a x which would do the job. Nice! It would be

Re: [Haskell-cafe] Polymorphic function over pairs of maybes.

2011-01-06 Thread Henning Thielemann
Edward Amsden schrieb: Aditya: Not quite, because I'm actually looking to extract values from a functor (Maybe) with a default. Stephen: Thanks, I'll take a look at those. I do have a need for it. I'm writing a very similar library to Yampa. (I would be patching Yampa, but the code is a

Re: [Haskell-cafe] implementing RealFloat decodeFloat

2011-01-06 Thread Henning Thielemann
Claude Heiland-Allen schrieb: I've been working on [0] Haskell bindings for [1] libqd for [2] double-double and quad-double arithmetic, At the ICIAM conference in Zurich 2007 I heard about the sum algorithm with two double precision floating point numbers in three talks. :-) Nice to know that

Re: [Haskell-cafe] Problem on overlapping instances

2011-01-06 Thread Henning Thielemann
Magicloud Magiclouds schrieb: Hi, I am using Data.Binary which defined instance Binary a = Binary [a]. Now I need to define instance Binary [String] to make something special for string list. How to make it work? I looked into the chapter of overlappinginstances, nothing works.

Re: [Haskell-cafe] Template Haskell a Permanent solution?

2011-01-04 Thread Henning Thielemann
Christian Maeder schrieb: Am 27.12.2010 08:44, schrieb Henning Thielemann: On Mon, 27 Dec 2010, Jonathan Geddes wrote: #2 Provide instances automatically. http://www.haskell.org/ghc/docs/7.0-latest/html/users_guide/generic-classes.html I see the text below and have no idea where

Re: [Haskell-cafe] tplot and splot - analyst's swiss army knifes for visualizing log files

2011-01-04 Thread Henning Thielemann
Eugene Kirpichov schrieb: I would happily use a better online presentation sharing tool if I knew of one - I am a novice in this respect. Which do you suggest? For me a plain PDF file, say on code.haskell.org or projects.haskell.org is the best way.

Re: [Haskell-cafe] Lazy cons, Stream-Fusion style?

2011-01-02 Thread Henning Thielemann
On Sun, 2 Jan 2011, Stephen Tetley wrote: I'm trying to make a Stream library, hopefully efficient enough for audio synthesis in the style of Jerzy Karczmarczuk's Clarion. I am trying to code real-time audio synthesis in Haskell for some years now. I can tell at least, that it is not so

Re: [Haskell-cafe] Lazy cons, Stream-Fusion style?

2011-01-02 Thread Henning Thielemann
On Sun, 2 Jan 2011, Stephen Tetley wrote: Un-optimized, with a head-strict stream (basically Wouter Swierstra's Stream with a bang on the element), rendering currently takes minutes to generate seconds. But as well as the Stream representation, I've plenty of room to optimize the WAV file

Re: [Haskell-cafe] getting last char of String

2011-01-01 Thread Henning Thielemann
On Sat, 1 Jan 2011, Jesse Schalken wrote: On Sat, Jan 1, 2011 at 8:54 AM, Felipe Almeida Lessa felipe.le...@gmail.com wrote: No definition for last works with infinite lists =).  Unless you make the result nullable, of course. maybeLast :: [a] - Maybe a maybeLast [] = Nothing

Re: [Haskell-cafe] Incorrectly inferring type [t]

2010-12-30 Thread Henning Thielemann
On Wed, 29 Dec 2010, william murphy wrote: Hi All, I've spent a lot of time trying to write a version of concat, which concatenates lists of any depth: So: concat'' [[[1,2],[3,4]],[[5]]]   would return: [1,2,3,4,5] You can nicely solve this problem in Haskell 98 using a Tree

Re: [Haskell-cafe] ; in do

2010-12-30 Thread Henning Thielemann
On Thu, 30 Dec 2010, Antoine Latter wrote: I started for cleaner diffs and easier editing - I can add/remove a line at the end without editing any other line. Eventually I grew to like the look of it. That's not true. As long as the comma is used as separator one line can affect an adjacent

Re: [Haskell-cafe] Formatting function types

2010-12-30 Thread Henning Thielemann
On Thu, 30 Dec 2010, Lauri Alanko wrote: Even nowadays, Haddock deliberately generates the following layout for long function types: openTempFile :: FilePath - String - IO (FilePath, Handle) The layout draws special attention to the first argument type, whereas the other argument

Re: [Haskell-cafe] Formatting function types

2010-12-30 Thread Henning Thielemann
On Thu, 30 Dec 2010, Lauri Alanko wrote: Except that it falsely suggests that the last argument types are of a similar nature as the return type. Here's what went in my head when I first read Haskell code: openTempFile :: FilePath -- All right, this first part is probably the argument.

Re: [Haskell-cafe] multi type addition

2010-12-29 Thread Henning Thielemann
On Tue, 28 Dec 2010, aditya siram wrote: The problem here is that unfortunately the Haskell type system cannot do coercion. I'd omit the unfortunately. For me it is a good thing that Haskell does not silently apply lossy number conversions, as e.g. MatLab does. 'realToFrac' allows

Re: [Haskell-cafe] [Haskell] haskell.org migration complete

2010-12-29 Thread Henning Thielemann
On Sun, 5 Dec 2010, Henning Thielemann wrote: Thomas Schilling schrieb: I created http://www.haskell.org/haskellwiki/MigratingWikiContent to list known issues and workarounds. Please feel free to extend that page where needed. ... I did not like to add these items while having to log

Re: [Haskell-cafe] Incrementially updating an array

2010-12-29 Thread Henning Thielemann
On Wed, 29 Dec 2010, Robert Clausecker wrote: Am Mittwoch, den 29.12.2010, 13:29 +0100 schrieb Henning Thielemann: I don't know, I hope it's doing its best. :-) You might compare speed of Array.accum with a manually written foldl with (//). At a glance onto it's sourcecode it actually does

Re: [Haskell-cafe] Reader monad

2010-12-29 Thread Henning Thielemann
On Wed, 29 Dec 2010, michael rice wrote: In the case of ReaderT and StateT newtype ReaderT r m a = ReaderT {     -- | The underlying computation, as a function of the environment.     runReaderT :: r - m a     } newtype StateT s m a = StateT { runStateT :: s - m (a, s) } what is the

Re: [Haskell-cafe] Incrementially updating an array

2010-12-28 Thread Henning Thielemann
On Tue, 28 Dec 2010, Robert Clausecker wrote: Hi folks! I have the following problem. As code is most time easier to understand, let give an example what I try to do in C: unsigned int i,j; unsigned int r[100]; for (i = 0; i 100; i++) { j = makeResult(); //j is known to be smaller than

Re: [Haskell-cafe] Template Haskell a Permanent solution?

2010-12-27 Thread Henning Thielemann
On Mon, 27 Dec 2010, Jonas Almström Duregård wrote: Hi Henning, I also think that Template Haskell is used too much. Several things that are done in existing libraries could be done in plain Haskell in a better way. Can you give any examples of this? I'm not saying it's not true, I'm just

Re: [Haskell-cafe] Intro to monad transformers

2010-12-26 Thread Henning Thielemann
On Sun, 26 Dec 2010, Antoine Latter wrote: I haven't had a chance to dig into your example, but you might want to try the maybeT library: http://hackage.haskell.org/package/MaybeT That way you could try to narrow down where the error is coming from. MaybeT is also part of transformers

Re: [Haskell-cafe] Intro to monad transformers

2010-12-26 Thread Henning Thielemann
On Sun, 26 Dec 2010, David Menendez wrote: instance Show (MaybeT m a) This is never valid. You've defined show, shows, and showsPrec in terms of each other, creating unbounded recursion. Delete it. Unfortunately, the -Wall option of GHC won't help here, since all the methods are

Re: [Haskell-cafe] command line options using ghc -e

2010-12-26 Thread Henning Thielemann
On Sun, 26 Dec 2010, bri...@aracnet.com wrote: for example : ghc -e main foo.hs these should be treated as args for argv I'm wondering if there is a magic option to indicate that everything after this option is an arg option. Use 'runghc' or 'runhaskell' instead? This is the way Cabal

Re: [Haskell-cafe] Template Haskell a Permanent solution?

2010-12-26 Thread Henning Thielemann
On Mon, 27 Dec 2010, Jonathan Geddes wrote: #1 Parse a string at compile-time so that a custom syntax for representing data can be used. At the extreme, this data might even be an EDSL. I think it would be enough, if the compiler could be told to unfold an expression like parse text in a

Re: [Haskell-cafe] Matlab Style Logic Operations ala V1.*(V20) on Vectors and Matrices with HMatrix ??

2010-12-25 Thread Henning Thielemann
On Sat, 25 Dec 2010, gutti wrote: this line works : matrixfunction x y = liftMatrix2 (zipVectorWith(\a1 a2 - if a2=0 then a1 else 0)) x y but when I use this line : matrixfunction f x y = liftMatrix2 (zipVectorWith f) x y how can / do I have to define f in a seperate line a way, that it

Re: [Haskell-cafe] ANNOUNCE: storable-endian

2010-12-24 Thread Henning Thielemann
On Fri, 24 Dec 2010, Eugene Kirpichov wrote: I've released storable-endian 0.2.0, which does not use TH and bases on your suggestion (though it has a bit of boilerplate because of abandoning TH, but I don't think that's critical). Great, this should make it also usable on JHC (I have not

Re: [Haskell-cafe] ANNOUNCE: storable-endian

2010-12-24 Thread Henning Thielemann
On Fri, 24 Dec 2010, Gábor Lehel wrote: One further idea -- assuming HasBigEndian and HasLittleEndian are unexported because you don't want people writing new instances Why should people not write further instances? I could write a LittleEndianStorable instance for fixed point numbers, long

Re: [Haskell-cafe] ANNOUNCE: storable-endian

2010-12-24 Thread Henning Thielemann
On Fri, 24 Dec 2010, Eugene Kirpichov wrote: I don't think I'd like to allocate memory in these functions - I expect them to have very predictable and very high performance. I'm afraid on ix86 it is not possible to move a Double that is stored in (two 32 bit) general purpose registers over

Re: [Haskell-cafe] ANNOUNCE: storable-endian

2010-12-24 Thread Henning Thielemann
On Fri, 24 Dec 2010, Henk-Jan van Tuyl wrote: You could use ADNS.Endian.endian from package hsdns in your Setup.hs to define endianness at compile time. Cool, it's already there! However I would not recommend to let a low-level library depend on a higher-level one. I think it would be

Re: [Haskell-cafe] instance for (Show ([(String, Int)] - Int))

2010-12-24 Thread Henning Thielemann
On Fri, 24 Dec 2010, Aaron Gray wrote: How do I code an 'instance' declaration for '(Show ([(String, Int)] - Int))'. You ask for displaying a function that maps from [(String, Int)] to Int. What shall the generated text look like? ___

Re: [Haskell-cafe] instance for (Show ([(String, Int)] - Int))

2010-12-24 Thread Henning Thielemann
On Fri, 24 Dec 2010, Aaron Gray wrote: The compiler is requesting an instance declaration for Show :-   expr-eval.hs:334:23:       No instance for (Show ([(String, Int)] - Int))         arising from a use of `print' at expr-eval.hs:334:23-27       Possible fix:         add an instance

Re: [Haskell-cafe] GHC-7.01 and intrinsic operations

2010-12-24 Thread Henning Thielemann
On 13.12.2010 16:38, Pavel Perikov wrote: Is it possible to make GHC-7.0.1 to generate intrinsic instructions instead of calls to C library to compute trigonometric functions? main = do a- readLn print $ sin a I tried -O -msse2 -fllvm and their combinations. Generating

Re: [Haskell-cafe] Cabal message problem.

2010-12-24 Thread Henning Thielemann
On 16.12.2010 15:40, Duncan Coutts wrote: On 16 December 2010 13:38, Daniel Fischer daniel.is.fisc...@googlemail.com wrote: Maybe a flag ignore upper bounds and try with the latest for cabal would be a solution. Would that be hard to implement or easy? That suggestion has come up quite a

[Haskell-cafe] Yet Another Haskell Tutorial missing (maybe lost on server move?)

2010-12-23 Thread Henning Thielemann
The page http://www.haskell.org/haskellwiki/Yet_Another_Haskell_Tutorial says that there is a darcs repository at http://darcs.haskell.org/yaht/ but it is not. Also in the canonical replacement location http://code.haskell.org/yaht/ I cannot find it. The Wikiboook

Re: [Haskell-cafe] List of numbers to list of ranges

2010-12-23 Thread Henning Thielemann
On Thu, 23 Dec 2010, C K Kashyap wrote: Here's my attempt to convert a list of integers to a list of range tuples - Given [1,2,3,6,8,9,10], I need [(1,3),(6,6),8,10)] That's an interesting problem! My first attempt: List.unfoldr (\xs - case xs of [] - Nothing; y:ys - case span (uncurry

<    1   2   3   4   5   6   7   8   9   10   >