Re: Overlapping and incoherent instances

2014-08-11 Thread Twan van Laarhoven
To me, perhaps naively, IncoherentInstances is way more scary than OverlappingInstances. What behavior do these new pragmas have? In particular, will it be an error if there is no single most specific instance? And can the user decide whether it is an error? Twan On 29/07/14 11:11, Simon

Re: [Haskell-cafe] Readable GHC 7.6.3 docs (Bootstrapped)

2013-09-11 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] Alternative name for return

2013-08-14 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] Is the following implemented by a sparse matrix representation? type Graph n w = Array (n, n) (Maybe w)

2013-07-10 Thread Twan van Laarhoven
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

Re: Field accessor type inference woes

2013-07-02 Thread Twan van Laarhoven
On 02/07/13 10:57, Simon Peyton-Jones wrote: Here is Plan A: use fundep (or type function) class Has r f t | r f - t where getFld :: r - t instance Has (R a) “foo” (a - a) where .. instance Has S “bar” (forall b. b - b) where ... Lacking (as we still do) impredicative

Re: [Haskell-cafe] RFC: rewrite-with-location proposal

2013-02-25 Thread Twan van Laarhoven
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 {-#

Re: [Haskell-cafe] RFC: rewrite-with-location proposal

2013-02-25 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] Maintaining lambdabot

2013-02-20 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] Subject: ANNOUNCE: grid-3.0.1 (tile maps for board games or maths)

2013-02-18 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] Ticking time bomb

2013-01-31 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] Sparse records/ADTs

2012-10-24 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] Platform Versioning Policy: upper bounds are not our friends

2012-08-16 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] Improvement suggestions

2012-08-15 Thread Twan van Laarhoven
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 $

Re: [Haskell-cafe] Fixity declaration extension

2012-08-14 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] Applicative functors with branch/choice ?

2012-07-26 Thread Twan van Laarhoven
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 -

Re: [Haskell-cafe] Applicative functors with branch/choice ?

2012-07-26 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] Applicative functors with branch/choice ?

2012-07-25 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] Is (==) commutative?

2012-07-24 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] Is (==) commutative?

2012-07-24 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] Is (==) commutative?

2012-07-24 Thread Twan van Laarhoven
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 $

Re: [Haskell-cafe] Is (==) commutative?

2012-07-24 Thread Twan van Laarhoven
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,

Re: Common syntax for casing/matching (Re[2]: Call to arms: lambda-case is stuck and needs your help)

2012-07-12 Thread Twan van Laarhoven
On 2012-07-12 23:48, Bulat Ziganshin wrote: another interesting feature may be ruby-style matching defined by execution of special function `match` instead of pattern matching: switch var of 1+1 - print var==2 [5..10] - print var in [5..10] (20) - print var20 where (var `match`

Re: Call to arms: lambda-case is stuck and needs your help

2012-07-09 Thread Twan van Laarhoven
On 09/07/12 14:44, Simon Marlow wrote: I now think '\' is too quiet to introduce a new layout context. The pressing need is really for a combination of '\' and 'case', that is single-argument so that we don't have to write parentheses. I think '\case' does the job perfectly. If you want a

Re: Call to arms: lambda-case is stuck and needs your help

2012-07-05 Thread Twan van Laarhoven
On 05/07/12 17:22, wagne...@seas.upenn.edu wrote: Well, for what it's worth, my vote goes for a multi-argument \case. I find the comment on the wiki page about mistyping \case Just x instead of \case (Just x) a lot a bit disingenuous, since you already need these parens with today's lambda.

Re: Call to arms: lambda-case is stuck and needs your help

2012-07-05 Thread Twan van Laarhoven
On 2012-07-05 23:04, Edward Kmett wrote: A similar generalization can be applied to the expression between case and of to permit a , separated list of expressions so this becomes applicable to the usual case construct. A naked unparenthesized , is illegal there currently as well. That would

Re: [Haskell-cafe] arbitrary rank polymorphism and ghc language pragmas

2012-07-05 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] Fundeps and overlapping instances

2012-05-24 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] Problem with forall type in type declaration

2012-05-11 Thread Twan van Laarhoven
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 ::

Re: [Haskell-cafe] Reconstructing a tree from a list of its paths (to leaves)

2012-04-10 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] ANNOUNCE: pipes-core 0.1.0

2012-04-10 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] Mixing Unboxed Mutable Vectors and Parsers

2012-04-10 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] is the evaluation order deterministic when using applicative with IO

2012-03-16 Thread Twan van Laarhoven
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 -

Re: [Haskell-cafe] ANNOUNCE: pipes-core 0.0.1

2012-03-12 Thread Twan van Laarhoven
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 (+),

Re: [Haskell-cafe] ANNOUNCE: pipes-core 0.0.1

2012-03-11 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] ANNOUNCE: pipes-core 0.0.1

2012-03-11 Thread Twan van Laarhoven
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.

Re: [Haskell-cafe] ANNOUNCE: pipes-core 0.0.1

2012-03-11 Thread Twan van Laarhoven
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)

Re: [Haskell-cafe] ANNOUNCE: pipes-core 0.0.1

2012-03-10 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] ANNOUNCE: pipes-core 0.0.1

2012-03-10 Thread Twan van Laarhoven
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

Re: How unsafe are unsafeThawArray# and unsafeFreezeArray#

2012-03-09 Thread Twan van Laarhoven
On 2012-03-09 02:13, Johan Tibell wrote: Hi, I just ran across some code that calls unsafeThawArray#, writeArray#, and unsafeFreezeArray#, in that order. How unsafe is that? Quick follow up question: Are unsafeThawArray# and unsafeFreezeArray# guaranteed to not make a copy? I.e. are these

Re: Abstracting over things that can be unpacked

2012-03-03 Thread Twan van Laarhoven
On 03/03/12 01:40, Johan Tibell wrote: Hi all, These ideas are still in very early stages. I present them here in hope of starting a discussion. (We discussed this quite a bit at last year's ICFP, I hope this slightly different take on the problem might lead to new ideas.) I think the next big

Re: Holes in GHC

2012-01-26 Thread Twan van Laarhoven
On 25/01/12 16:21, Thijs Alkemade wrote: Hello! ... Examples: *Main :t [__, ()] tcRnExpr2: [(interactive:1:2-3, ())] [__, ()] :: [()] *Main :t map __ __ tcRnExpr2: [(interactive:1:5-6, a0 - b), (interactive:1:8-9, [a0])] map __ __ :: [b] You can do something similar right now with

Re: [Haskell-cafe] Finding longest common prefixes in a list

2012-01-21 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] Right tree structure for complicated problem

2012-01-21 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] instance (Enum a) = IArray UArray a

2012-01-20 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] Finding longest common prefixes in a list

2012-01-20 Thread Twan van Laarhoven
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

Re: Revert a CAF?

2011-12-07 Thread Twan van Laarhoven
On 06/12/11 18:48, wren ng thornton wrote: So, I have an optimization/internals question. Does the GHC API have any hooks for being able to revert a CAF to the original expression, thus discarding the previously computed result? ... I could hack something together based on unsafePerformIO and

Re: [Haskell-cafe] Current Haskell report URL

2011-11-25 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] Documenting strictness properties for Data.Map.Strict

2011-11-18 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] Superset of Haddock and Markdown

2011-11-18 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] How to speedup generically parsing sum types?

2011-11-03 Thread Twan van Laarhoven
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 {-#

Re: [Haskell-cafe] Attoparsec: Limiting Parsers to N Bytes, or Combing Parsers?

2011-09-26 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] ghc 7.0.3 view patterns and exhaustiveness

2011-09-21 Thread Twan van Laarhoven
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) =

Re: [Haskell-cafe] Fwd: Re: Period of a sequence

2011-06-27 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] Links into list

2011-05-02 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] Testing Implementation vs Model - Records or Type Classes?

2011-04-08 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] The mother of all functors/monads/categories

2010-06-27 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] 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?

2010-06-21 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] The 8 Most Important GSoC Projects

2010-04-02 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] Haskell.org re-design

2010-04-01 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] Asynchronous exception wormholes kill modularity

2010-03-25 Thread Twan van Laarhoven
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

Re: Quasi quoting

2010-02-02 Thread Twan van Laarhoven
Max Bolingbroke wrote: 2010/2/2 Isaac Dupree m...@isaac.cedarswampstudios.org: I'm concerned in both your proposals, that single-letter names like t and d are common function parameters, thus possibly producing - shadowing warnings for all such functions in modules that happen to use TH -

Re: [Haskell-cafe] Map unionWith generalization

2010-01-27 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] Capped lists and |append|

2010-01-08 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] Re: Data.Ring -- Pre-announce

2009-12-31 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] The Transient monad

2009-12-08 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] Applicative Functor or Idiom?

2009-11-20 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] Status of TypeDirectedNameResolution proposal?

2009-11-19 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] Status of TypeDirectedNameResolution proposal?

2009-11-18 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] Fair diagonals

2009-11-04 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] Proposal: TypeDirectedNameResolution

2009-08-13 Thread Twan van Laarhoven
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

Re: Outlaw tabs

2009-01-25 Thread Twan van Laarhoven
Jon Fairbairn wrote: Warnings are the wrong answer to this problem. In fact, they're rarely the right answer to any problem. Tabs in sourcecode can have bad effects, and Haskell is a language that attempts to reject bad effects as far as possible. Nor can I see any argument in favour of

Deriving Functor

2008-12-06 Thread Twan van Laarhoven
Hello Ghc people, I have been working on adding support for derive Functor to ghc. I have a patch that mostly works, but there are some problems: 1. Ghc reports the correct instance when I use -ddump-deriv:, but that instance is not subsequenctly used. Instead I get a warning like:

Re: [Haskell-cafe] Float instance of 'read'

2008-09-16 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] Monad vs ArrowChoice

2008-05-14 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] M1 + M2 = M3 where both computations in M1 and M2 can be used?

2008-05-12 Thread Twan van Laarhoven
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 :

Re: Haskell' - class aliases

2008-04-25 Thread Twan van Laarhoven
Simon Peyton-Jones wrote: Is this the most up-to-date description of the proposal? http://repetae.net/recent/out/classalias.html Has anyone looked at my (confusingly named and horribly written) variant? http://haskell.org/haskellwiki/Superclass_defaults My idea is to split

Re: Suggestion regarding (.) and map

2008-04-24 Thread Twan van Laarhoven
Cale Gibbard wrote: Hello, In keeping with my small but seemingly extremely controversial suggestions for changes to the Prelude, here's a suggestion which I think is elegant and worth considering for the Haskell' Prelude: Rename fmap to map (like it was in Haskell 1.4), and define (.) as a

[Haskell] ANNOUNCE: multiset 0.1

2008-02-06 Thread Twan van Laarhoven
Hello, I have just uploaded version 0.1 of the multiset library to hackage. This package provides Data.MultiSet and Data.IntMultiSet modules. A multiset or bag is like a set, but it can contain multiple copies of the same element. The library is already pretty much finished, maybe I should

'backslash' build problems on windows

2008-01-15 Thread Twan van Laarhoven
I am having some problems with the latest builds of GHC on windows. For some reason ghc has decided to use backslashes in filenames. This leads to problems when building the stage libraries and the stage 2 compiler. I run the scripts from a mingw bash shell. The following problems occur: -

Re: FilePath causes problems (was: 'backslash' build problems on windows)

2008-01-15 Thread Twan van Laarhoven
Twan van Laarhoven wrote: I am having some problems with the latest builds of GHC on windows. For some reason ghc has decided to use backslashes in filenames. This leads to problems when building the stage libraries and the stage 2 compiler. I run the scripts from a mingw bash shell. After

GHC source code improvement ideas

2008-01-03 Thread Twan van Laarhoven
Hello GHC people, I was trying my hand at some GHC hacking, and I couldn't help but notice that much of the code looks (IMHO) horrible. There are some things that look as if they haven't been touched since the Haskell 1.3 days. The most striking is the use of `thenXX` instead of do notation.

Re: [Haskell-cafe] A commutative diagram conjecture about applicative functors

2007-12-31 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] A commutative diagram conjecture about applicative functors

2007-12-30 Thread Twan van Laarhoven
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,

Re: [Haskell-cafe] Is a type synonym declaration really a synonym ?

2007-12-22 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] Smart Constructor Puzzle

2007-12-20 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] list utilities -- shouldn't these be in the hierarchical libs somewhere?

2007-12-18 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] class default method proposal

2007-12-12 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] class default method proposal

2007-12-12 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] Showing Data.Ratio - different on GHC vs Hugs/Yhc

2007-11-16 Thread Twan van Laarhoven
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

Generalized newtype deriving 6.6 vs. 6.8

2007-11-03 Thread Twan van Laarhoven
Hello, I noticed there is a difference in generalized newtype deriving between 6.6 and 6.8. In GHC 6.4.1 the following: {-# LANGUAGE GeneralizedNewtypeDeriving #-} import Control.Monad.Error newtype MyMonad m a = MyMonad (m a) deriving (Monad, MonadError String) correctly gives a

Re: [Haskell-cafe] Transformation sequence

2007-10-20 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] Re: PROPOSAL: New efficient Unicode string library.

2007-10-02 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] PROPOSAL: New efficient Unicode string library.

2007-09-24 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] Accumulator value for and and or

2007-09-21 Thread Twan van Laarhoven
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

Consistency of reserved operators and bang patterns

2007-09-07 Thread Twan van Laarhoven
The bang pattern proposal [1] still allows (!) to be used as an operator. I think there should be no difference in this regard between ! and ~, since they are used in exactly the same location. In my opinion the best thing would be to allow (~) and (@) as operators. With the same restriction

Re: [Haskell-cafe] Extending the idea of a general Num to other types?

2007-09-05 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] GHC optimisations

2007-08-22 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] GHC optimisations

2007-08-21 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] GHC optimisations

2007-08-21 Thread Twan van Laarhoven
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

Re: [Haskell-cafe] Chessboard-building in Haskell

2007-08-18 Thread Twan van Laarhoven
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

  1   2   >