Why does every section have a title=1.2.3 foo on the outer div? In Firefox
this shows up as a useless tooltip when moving the mouse over the text.
On 11/09/13 13:31, Obscaenvs wrote:
At [1] you can find links to the GHC documentation that I use myself,
since the official version is a bit too
On 13/08/13 17:38, Andreas Abel wrote:
Indeed, I wished the 0-ary case would be more alike to the unary and binary
case, cf.
return f0
f1 $ a1
f2 $ a1 * a2
You could always write the above as
pure f0
pure f1 * a1
pure f2 * a1 * a2
Twan
The standard array types, such as Array (n,n) (Maybe w) will be implemented as
a dense array. If you want to use a sparse matrix, you will explicitly have to
ask for it. For instance by using something like IntMap (IntMap w) or Map
(n,n) w or Array n (IntMap w). Each of these representations is
On 25/02/13 07:06, Michael Snoyman wrote:
Quite a while back, Simon Hengel and I put together a proposal[1] for a new
feature in GHC. The basic idea is pretty simple: provide a new pragma that could
be used like so:
error :: String - a
errorLoc :: IO Location - String - a
{-#
On 25/02/13 13:41, Michael Snoyman wrote:
At that point, we've now made two changes to REWRITE rules:
1. They can takes a new ALWAYS parameters.
2. There's a new, special identifier currentLocation available.
What would be the advantage is of that approach versus introducing a single new
On 20/02/13 08:13, Jan Stolarek wrote:
Dnia wtorek, 19 lutego 2013, Gwern Branwen napisał:
On Tue, Feb 19, 2013 at 5:36 PM, Jan Stolarek jan.stola...@p.lodz.pl wrote:
- remove unlambda, brainfuck and show from the repo. They are on hackage,
no need to keep them here - these packages aren't
On 18/02/13 13:41, Amy de Buitléir wrote:
I'm happy to announce a new major release of the grid package:
http://hackage.haskell.org/package/grid
https://github.com/mhwombat/grid/wiki (wiki)
After taking a peek at the documentation: have you considered removing the size
function
On 31/01/13 09:16, Ketil Malde wrote:
*MY* proposal is that:
0. Hackage sends an email to the previous uploader whenever a new
version of a package is uploaded by somebody else.
At least that way, I would be notified if it happened to my packages,
and I would be able to check up on the
On 24/10/12 12:08, Jon Fairbairn wrote:
Is there a convenient way of handling a data structure with lots
of fields of different types that may or may not be filled in?
Not sure about convenience, but here is a type safe solution with O(log n)
lookups and updates. The idea is to define a
On 16/08/12 14:07, Chris Smith wrote:
As a package author, when I
release a new version, I know perfectly well what incompatible changes
I have made to it... and those might include, for example:
1. New modules, exports or instances... low risk
2. Changes to less frequently used, advanced, or
On 15/08/12 17:01, José Lopes wrote:
someFn docs =
return concat `ap` (sequence $ intersperse (return \n) (map loop docs))
First of all, return x `ap` y = x `fmap` y or x $ y. fmap (or its infix
synonym ($)) is the answer here, you could write:
someFn docs = concat . intersperse \n $
On 14/08/12 13:46, Ketil Malde wrote:
AntC anthony_clay...@clear.net.nz writes:
I agree. I don't declare operators very often, and when I do I always struggle
to remember which way round the precedence numbers go.
[...]
(Anything else we can bikeshed about while we're at it?)
infixl
On 26/07/12 12:40, Евгений Пермяков wrote:
class Applicative f = Actuative f where
-- | select computation conditionally . Side effects of only one two
alternative take place
select :: f (Either a b) -- ^ selector
- f (a - c) -- ^ first alternative
-
On 26/07/12 13:58, Евгений Пермяков wrote:
As you can see, if I use select definition with Control.Applicative.*, I'll
execute both l and r and the only choice will be, what result to drop. Both l
and r, however, will be executed, and their side effects will take place. With
select from my code
On 2012-07-25 22:22, Евгений Пермяков wrote:
Let assume, that some computation takes argument and produces value Either a b.
This computation may be represented in for different forms
computePure :: a - Either b c
computeMonad :: a - m (Either b c)
computeApplicative :: app a - app
On 2012-07-24 10:10, Christian Sternagel wrote:
Dear all,
with respect to formal verification of Haskell code I was wondering whether (==)
of the Eq class is intended to be commutative (for many classes such
requirements are informally stated in their description, since Eq does not have
such a
On 24/07/12 13:32, Frank Recker wrote:
I agree, that (==) should be symmetric. However, it is easy to write
Eq-instance, which violates this law:
It is impossible to specify laws such as symmetry in Haskell, which is why they
are usually stated in the documentation. However, this style of
On 24/07/12 14:39, Jonas Almström Duregård wrote:
Hi,
I suppose you need to define what commutativity means in the presence
of undefined values. For instance if error 0 is different from error
1 then you do not have commutativity. Also nontermination needs to
be considered, for instance (fix $
On 24/07/12 14:44, timothyho...@seznam.cz wrote:
There's always this, for ALL types a :( So even where you would think that the
documentation can claim that a given Eq instance follows the law of
commutativity, it really cannot.
Once you invoke unsafePerformIO, you can break the type system,
On 05/07/12 17:18, rickmurphy wrote:
Hi All:
I've been working through some details in these papers [1], [2] and
noticed a language pragma configuration that I hope you can confirm.
When using explicit foralls in a data constructor, it appears that GHC
7.4.2 requires Rank2Types in the Language
On 24/05/12 14:14, AntC wrote:
Simon Peyton-Jonessimonpjat microsoft.com writes:
[from 7 Jul 2010. I've woken up this thread at Oleg's instigation
http://www.haskell.org/pipermail/haskell-prime/2011-July/003491.html ]
I'm not going to talk about Fundeps. This is about introducing
On 04/05/12 09:08, Magicloud Magiclouds wrote:
Hi,
Assuming this:
run :: Monad IO a - IO a
data Test = Test { f }
Here I'd like to set f to run, like Test run. Then what is the type of f?
The confusing (me) part is that, the argument pass to f is not fixed
on return type, like f1 ::
On 10/04/12 09:55, Arnaud Bailly wrote:
Hello,
I am manipulating labeled multiway trees, some kind of lightweight
XML notation. One thing I would like to be able to do is manipulating
a tree as a list of (Path, Value). Generating such a list is easy but
I am a little bit surprised to find it
On 09/04/12 23:49, Paolo Capriotti wrote:
I'm pleased to announce the release of version 0.1.0 of pipes-core, a
library for efficient, safe and compositional IO, similar in scope to
iteratee and conduits.
http://hackage.haskell.org/package/pipes-core
I have some issues with the function
On 2012-04-07 23:35, Myles C. Maxfield wrote:
CC: Maintainers of STMonadTrans, Vector, and JuicyPixels
Hello,
I am writing a Haskell Attoparsec parser which will modify 2-d arrays
of small values (Word8, Int8, etc.).
My first idea was to simply parse all the deltas, and later apply them
to the
On 16/03/12 10:45, Rouan van Dalen wrote:
Hi everyone.
I was wondering if I can make assumptions about the evaluation order of
the following code:
isTrue :: Int - IO Bool
isTrue val = pure (||) * boolTest1 val * boolTest2 val
{- boolTest1 is an inexpensive, quick check -}
boolTest1 :: Int -
On 11/03/12 23:41, Chris Smith wrote:
On Sun, Mar 11, 2012 at 2:33 PM, Twan van Laarhoventwa...@gmail.com wrote:
I think you should instead move unwaits in and out of the composition on the
left side:
unawait x (p1+ p2) === (unawait x p1)+ p2
This makes idP a left-identity for (+),
On 2012-03-11 14:09, Paolo Capriotti wrote:
The Category law would be broken, though:
unawait x id == yield x !== unawait x
How did you get this equation? It's not even well-typed:
unawait :: a - Pipe a b m ()
yield :: b - Pipe a b m ()
I would expect that
(id unawait x) await
On 2012-03-11 14:46, Paolo Capriotti wrote:
On Sun, Mar 11, 2012 at 1:25 PM, Twan van Laarhoventwa...@gmail.com wrote:
I would expect that
(id unawait x) await !== unawait x await === return x
There are several type errors in this equation, so I'm not exactly
sure what you mean.
On 2012-03-11 17:30, Mario Blažević wrote:
It's difficult to say without having the implementation of both unawait and all
the combinators in one package. I'll assume the following equations hold:
unawait x await = return x
unawait x yield y = yield y unawait x
(p1 unawait x) p2 = (p1 p2)
On 2012-03-10 11:16, Paolo Capriotti wrote:
Another issue is how to deal with unconsumed input. For that, there is
a ChunkPipe type (in pipes-extra) with a specialized monad instance
that threads unconsumed input along. You can see an example of
ChunkPipe in action in this prototype http server
On 2012-03-11 00:09, Mario Blažević wrote:
On 12-03-10 05:19 PM, Twan van Laarhoven wrote:
-- | Pass some unconsumed input back upstream.
-- The next @await@ will return this input without blocking.
unawait :: Monad m = a - Pipe a b m ()
The function may be called unawait, but there's nothing
On 2012-01-20 23:44, Gwern Branwen wrote:
On Fri, Jan 20, 2012 at 1:57 PM, Twan van Laarhoventwa...@gmail.com wrote:
Here is some example code (untested):
Well, you're right that it doesn't work. I tried to fix the crucial
function, 'atLeastThisManyDescendants', but it's missing something
On 2012-01-22 00:39, Pierre Penninckx wrote:
So here is what I want to achieve:
I'd like a program that calculates the time needed for water to flow out of a
circuit made out of tube.
The rules are :
- There are multiple sources of water and only one exit.
- The water can only take one path from
On 20/01/12 16:31, Mikhail Arefiev wrote:
Is there a reason why there is no instance of (Enum a) = IArray
UArray a (other than that it will require OverlappingInstances and/or
IncoherentInstances if e. g. UArray of Bools is used in the same
code)?
...
Does having such thing make any
On 20/01/12 18:45, Gwern Branwen wrote:
Recently I wanted to sort through a large folder of varied files and
figure out what is a 'natural' folder to split out, where natural
means something like4 files with the same prefix.
My idea for an algorithm would be: build a trie for the input
On 23/11/11 23:02, Tom Murphy wrote:
Is there a reason that the Haskell 2010 report is in a subdirectory of
haskell.org/onlinereport http://haskell.org/onlinereport (which
currently points to the Haskell98 standard)?
http://www.haskell.org/onlinereport/ -- Haskell98
On 18/11/11 06:44, Johan Tibell wrote:
On Thu, Nov 17, 2011 at 9:21 PM, Johan Tibelljohan.tib...@gmail.com wrote:
I'm not entirely happy with this formulation. I'm looking for
something that's clear (i.e. precise and concise, without leaving out
important information), assuming that the reader
On 18/11/11 09:18, Ivan Lazar Miljenovic wrote:
On 18 November 2011 19:06, Roman Cheplyakar...@ro-che.info wrote:
Maybe have a switch that enables markdown and disables markup-related
features of haddock (everything except linking to identifiers/modules, I
believe), so that we don't affect
On 03/11/11 11:16, Bas van Dijk wrote:
...
instance (Constructor c, GFromJSON a, ConsFromJSON a) = GFromSum (C1 c a) where
gParseSum (key, value)
| key == pack (conName (undefined :: t c a p)) =
gParseJSON value
| otherwise = notFound $ unpack key
{-#
On 24/09/11 05:21, Evan Laforge wrote:
hex2 = (+)$ ((*16)$ higit)* higit
higit = subtract (fromEnum '0')$ satisfy isHexDigit
color = Color$ hex2* hex2* hex2
How is subtract (fromEnum '0') supposed to convert a hex digit to an
Int or Word8? I think you need digitToInt (or an equivalent
On 2011-09-21 22:06, Brent Yorgey wrote:
On Tue, Sep 20, 2011 at 10:31:58PM -0400, Richard Cobbe wrote:
numVarRefs :: Term - Integer
numVarRefs (view - Var _) = 1
numVarRefs (view - App rator rand) = numVarRefs rator + numVarRefs rand
numVarRefs (view - Lam _ body) =
On 2011-06-27 13:51, Steffen Schuldenzucker wrote:
Could you specify what exactly the function is supposed to do? I am
pretty sure that a function like
seqPeriod :: (Eq a) = [a] - Maybe Integer -- Nothing iff non-periodic
cannot be written.
What about sequences that can be specified in terms
On 02/05/11 13:10, John Sneer wrote:
Simply: I would like to have direct access into several places
in a very long list.
Maybe you could use a zipper. Or just maintain the list split into
chunks. So l' = [stuffBefore,hi,stuffAfter].
Or if you want to be able to use each element of hi as a
On 08/04/11 11:54, Heinrich Apfelmus wrote:
Hello,
I'm writing a small Haskell library for functional reactive programming.
The core of the library consists of two data types and several
primitives. However, I have programmed this core *twice*: once as a
*model* that displays the intended
Max Bolingbroke wrote:
I don't actually know what the right name for this data type is, I
just invented it and it seems to work:
-- () :: forall a b. t a b - (forall c. t b c - t a c)
newtype Wotsit t a b = Wotsit { runWotsit :: forall c. t b c - t a c }
There is of course no reason to
Casey Hawthorne wrote:
Is there good place to post Haskell alorithms/data structures that
follow Steven Skiena's book on algorithm design and also Haskell code
snippets that follow some of Knuth's books?
These code snippets don't seem to fit with Hackage.
You could make some pages for them on
Ivan Lazar Miljenovic wrote:
I've been thinking of doing something similar for a year or so now, but
there's one big problem that I can think of: how to deal with functions
that don't have an explicit type signature in the source. My
understanding is that to derive these signatures at checking
Christopher Done wrote:
That's true, it's a nice idea but in practice it's hard to know where
to focus. I've gone with a left nav. I've built up the HTML which is
cross-browser (ie6/7/8/opera/firefox/safari/chrome compat), still need
to add some bits but I can tomorrow import it into a wikimedia
Bas van Dijk wrote:
...
However now comes the problem I would like to talk about. What if I
want to use modifyMVar_ as part of a bigger atomic transaction. As in:
block $ do ...
modifyMVar_ m f
...
From a quick glanse at this code it looks like asynchronous exceptions
Hans Aberg wrote:
For example, in Map String Integer (sparse representation of monomials)
compute the minimum value of all associative pairs with the same key
(the gcd); if only one key is present, the absent should be treated as
having value 0. So
unionWith min xs ys
will not work, because
John Millikin wrote:
Earlier today I uploaded the capped-list package; I didn't think there
would be any interest, since it's a relatively trivial data structure,
but already there's been three emails and an IRC convo about it.
Since uploading, there's been a big problem pointed out to me
John Van Enk wrote:
Hi Heinrich,
I think I like Ring more than Necklace or Tom's suggestion of Circular.
I chose Ring simply because that's what I was searching for when I
wanted the data structure. The package will be named data-ring, so that
should hopefully be enough to clue in the user
Alberto G. Corona wrote:
Hi haskell cafe:
concerning Stable Names
The IO in makeStableName suggest more side effects than makeStableName
really do. But still the call isn't pure.
For calls such are makeStableName that gives a different result the
FIRST time they are called but return the
David Sankel wrote:
After reading several recent papers I came to the understanding that
there isn't consensus on the name of Applicative Functors. Several
prefer to call them idioms:
'Idiom' was the name McBride originally chose, but he and Paterson
now favour the less evocative term
Nicolas Pouillard wrote:
The TDNR proposal really tries to do two separate things:
1. Record syntax for function application.
The proposal is to tread x.f or a variation thereof the same as (f x)
It is more like (ModuleToGuess.f x) than (f x).
My point is that desugaring x.f to (f
Levi Greenspan wrote:
What's the status of the TDNR proposal [1]? Personally I think it is a
very good idea and I'd like to see it in Haskell'/GHC rather sooner
than later. Working around the limitations of the current record
system is one of my biggest pain points in Haskell and TDNR would be a
Sjoerd Visscher wrote:
I believe this does what you want:
code
The attached code should be more efficient, since it doesn't use integer
indices.
Note that this is just a 'level' monad: the list is stratified into levels, when
combining two levels, the level of the result is the sum of the
John Meacham wrote:
On Mon, Jul 27, 2009 at 04:41:37PM -0400, John Dorsey wrote:
I'm assuming that name resolution is currently independent of type
inference, and will happen before type inference. With the proposal this is
no longer true, and in general some partial type inference will have
Mauricio wrote:
Do you think 'read' (actually,
'readsPrec'?) could be made to also
read the international convention
(ie., read 1,5 would also work
besides read 1.5)? I'm happy to
finaly use a language where I can
use words of my language to name
variables, so I wonder if we could
also make that
Ronald Guida wrote:
I have read that Monad is stronger than Idiom because Monad lets me
use the results of a computation to choose between the side effects of
alternative future computations, while Idiom does not have this
feature. Arrow does not have this feature either.
ArrowChoice has the
sam lee wrote:
Hi.
I want to compose two monads to build another monad where
computations of the two monads can be used inside.
I have:
- MonadTypeInfer : interface (class) for TypeInfer monad
- TypeInfer : a monad that has Map String Type (association of names and types)
- TypeInferT :
Isaac Dupree wrote:
Unfortunately, I get puzzling type errors if I annotate either one of
them with their type (e.g.
(Applicative f) = f (a - b) - f a - f (Int, b)
) in an expression. The very answer doesn't seem to typecheck.
:t \f x - fmap ((,) (0::Int)) (f * x) :: (Applicative f) = f (a1
Robin Green wrote:
I am proving various statements relating to applicative functors, using
the Coq proof assistant (I am considering only Coq terms, which always
terminate so you don't have to worry about _|_). However, I'm not sure
how to go about proving a certain conjecture, which,
alpheccar wrote:
Can someone confirm me that:
type TA = A :+: B
type TB = C :+: D
type T = TA :+: TB
This is
type T = (A :+: B) :+: (C :+: D)
is not equivalent to
type T = A :+: B :+: C :+: D
is
type T = A :+: (B :+: (C :+: D))
So these types are indeed not the same.
Twan
Ronald Guida wrote:
I'm playing around with smart constructors, and I have encountered a
weird puzzle.
My goal is to do vector arithmetic. I'm using smart constructors so
that I can store a vector as a list and use the type system to
staticly enforce the length of a vector.
So my first step
Jules Bean wrote:
Thomas Hartman wrote:
I found
http://haskell.cs.yale.edu/haskell-report/List.html
had many useful one off type list functions such as subsequences
and permutations which are nowhere to be found in hoogle, Data.List,
or the haskell hierarchical libs
Weird.
It's
Simon Peyton-Jones wrote:
Concerning (b) here's a suggestion. As now, require that every instance
requires an instance declaration. So, in the main example of
http://haskell.org/haskellwiki/Class_system_extension_proposal, for a new data
type T you'd write
instance Monad T where
Neil Mitchell wrote:
Hi
Under Hugs and Yhc, showing a Ratio 1%2 gives 1 % 2. Under GHC
showing 1%2 gives 1%2. Does the standard say anything about this? Is
someone wrong?
Yes, ghc is wrong here, the Haskell 98 report [1] specifies:
instance (Integral a) = Show (Ratio a) where
Andrew Coppin wrote:
I'm writing some code where I take an expression tree and transform it
into another equivilent one.
Now it's moderately easy to write the code that does the transformation.
But what I *really* want is to print out the transformation *sequence*.
This appears to be much
Lots of people wrote:
I want a UTF-8 bikeshed!
No, I want a UTF-16 bikeshed!
What the heck does it matter what encoding the library uses internally?
I expect the interface to be something like (from my own CompactString
library):
fromByteString :: Encoding - ByteString - UnicodeString
Johan Tibell wrote:
Dear haskell-cafe,
I would like to propose a new, ByteString like, Unicode string library
which can be used where both efficiency (currently offered by
ByteString) and i18n support (currently offered by vanilla Strings)
are needed. I wrote a skeleton draft today but I'm a
PR Stanley wrote:
Hi
or = foldl (||) False
and = foldl () True
I can understand the rationale for the accumulator value - True []
where [] = True and True || [] where [] = False
Other than the practical convenience is there a reason for having the
empty list in and and or equating to True and
Bulat Ziganshin wrote:
Hello Simon,
Wednesday, September 5, 2007, 11:19:28 AM, you wrote:
when you come across a case where GHC produces an
unhelpful message, send it in, along with the program
that produced it,
i have put such tickets about year ago :) basically, it
Stefan O'Rear wrote:
On Wed, Aug 22, 2007 at 06:36:15PM +0100, Neil Mitchell wrote:
Hi
If Num obeys ring axioms, fromInteger is a perfectly fine
ring-homomorphism. (It's also the first or second homomorphism taught.)
Does Int obey these axioms? I'm thinking that assuming properties
about
Isaac Dupree wrote:
Simon Peyton-Jones wrote:
...
No, constant folding is part of the compiler, I'm afraid, in the
module PrelRules.
Simon
_Constant_ folding is, but in GHC.Base there are rules like (unboxed)
multiplying by zero or one, or adding or subtracting zero, from an
unknown
Brandon S. Allbery KF8NH wrote:
On Aug 21, 2007, at 22:13 , Twan van Laarhoven wrote:
Other rules that could be interesting are:
forall a b. fromInteger a + fromInteger b = fromInteger (a + b)
I don't think this will work, a and b have to be the same type.
They are of the same type
Andrew Wagner wrote:
I've started a blog series on writing a chess engine in Haskell. I
just posted the second blog entry today:
http://sequence.complete.org/node/361
I suspect there's more work to be done on that function, though. It
seems like there should be a nice way to remove that flip in
DavidA wrote:
Hi,
I am trying to implement quadratic fields Q(sqrt d). These are numbers of the
form a + b sqrt d, where a and b are rationals, and d is an integer.
...
class IntegerType a where
value :: Integer
The problem is, this doesn't work. GHC complains:
The class method
Antoine Latter wrote:
On 8/3/07, Chris Smith [EMAIL PROTECTED] wrote:
Yes, unless of course you did:
instance (Monad m, Num n) = Num (m n)
or some such nonsense. :)
I decided to take this as a dare - at first I thought it would be easy
to declare (Monad m, Num n) = m n to be an
Ken Takusagawa wrote:
I'd like to have a state monad with the feature that I can somehow
annotate using the type system that some functions are only going to
read the state and not modify it. Such read-only functions are only
permitted to call other read-only functions, whereas state-modifying
Neil Mitchell wrote:
Hi,
de Bruijn indicies look quite nice, and seem to eliminate a lot of
complexity when dealing with free variables:
http://en.wikipedia.org/wiki/De_Bruijn_index
So I was wondering, are they suitable for use in a compiler? If so,
what are their disadvantages/advantages? Is
Robin Green wrote:
The Haskell wiki[1] says Recent content is available under a simple
permissive license. But this is unilluminating - recent? how recent,
exactly? - and will become increasingly understated as time goes by.
Wouldn't it be slightly more helpful to say Content added after ...
Joel Reymont wrote:
I have a lot of boilerplate code like this and wonder how I can scrape it.
instance Morpher Type C.Type where
morph TyInt = return C.TyInt
morph TyFloat = return C.TyFloat
morph TyStr = return C.TyStr
morph TyBool = return C.TyBool
morph TyColor = return
Joel Reymont wrote:
This is in Language.Haskell.TH.Syntax which is imported at the top of
Data/Derive/TH.hs so I don't understand the cause of the error
instance Functor Q where
fmap f (Q x) = Q (fmap f x)
...
Any suggestions?
Since Q is a Monad, you can make the instance
instance
Bas van Dijk wrote:
I would also like to get the formatting constraints working. However
the solution in the code below gives a Duplicate instance
declarations error. If I -fallow-overlapping-instances than the type
checker goes into an infinite loop.
I would like to know why this is
and Read, because they
cannot be derived in that way. It will, however, catch problems with
most other classes.
Twan van Laarhoven
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Stefan Heinzmann wrote:
Hi all,
is there a library for Haskell that implements scaled integers, i.e.
integers with a fixed scale factor so that the scale factor does not
need to be stored, but is part of the type?
Data.Fixed [1] does exactly that, only it is based on Integer. Using
fixed
Couldn't '\' delimit a subexpression, as parentheses do? Would there be
any ambiguity in accepting code like State \s - (s, s) instead of
requiring State $ \s - (s, s), or taking
Looking at the Haskell 98 language definition it seems that a whole
class of these expressions are disallowed
Michael Shulman wrote:
The frequent occurence of ListT $ return in my code when I use the ListT
monad transformer has made me wonder why there isn't a standard typeclass
`MonadList', like those for the other monad transformers, encapsulating
the essence of being a list-like monad -- in this
Magnus Jonsson wrote:
Dear Haskell Cafe,
When programming the other day I ran into this problem. What I want to
do is a function that would work like this:
splitStreams::Ord a=[(a,b)]-[(a,[b])]
splitStreams [(3,x),(1,y),(3,z),(2,w)]
[(3,[x,z]),(1,[y]),(2,[w])]
A O(n log(n)) algorithm
Jared Updike wrote:
Wouldn't you want the expression
[[1,0],[0,2]] + 10
to yield
[[11,10],[10,12]]
You could handle this as a special case in (+) and (*), but this is kind
of a hack. Something like:
(+) [[x]] y = map (map (x+)) y
(+) x [[y]] = map (map (+y)) x
(+) xy =
Mike Gunter wrote:
I'd like to use QuickCheck on IO code. For instance, I'd like to
check a property of type String - IO Bool.
Using unsafePerformIO seems straightforward (though I haven't written
the code, so I may be wrong about that) and it might be possible to
make a solution involving
SevenThunders wrote:
test.hs:14:11:
No instance for (PrintfType (t t1))
arising from use of `printf' at test.hs:14:11-16
Probable fix: add an instance declaration for (PrintfType (t t1))
In the result of a 'do' expression: printf %14.7g u
In the definition of `test':
Gerhard Navratil wrote:
I need a library that provides partial derivatives for functions. The
solution I came up with is based on a datatype using reversed polish
notation to store the function:
lots of code
The solution works but is not very elegant. The complete module is
appended to
95 matches
Mail list logo