Re: [Haskell-cafe] nice simple problem for someone struggling....

2007-12-21 Thread David Menendez
On Dec 21, 2007 11:50 AM, Nicholls, Mark [EMAIL PROTECTED] wrote: Now I have module Main where data SquareType numberType = Num numberType = SquareConstructor numberType This is a valid declaration, but I don't think it does what you want it to. The constraint on numberType applies

Re: [Haskell-cafe] nice simple problem for someone struggling....

2007-12-21 Thread David Menendez
On Dec 21, 2007 12:08 PM, Nicholls, Mark [EMAIL PROTECTED] wrote: I thought from Num numberType = SquareConstructor numberType We could deduce that (in English rather than get Haskell and FOL confusion) all values of SquareConstructor a….the type of a would have be be in class

Re: [Haskell-cafe] nice simple problem for someone struggling....

2007-12-21 Thread David Menendez
On Dec 21, 2007 12:47 PM, Nicholls, Mark [EMAIL PROTECTED] wrote: Let me resend the code…as it stands…. *module* Main *where* *data* SquareType numberType = Num numberType = SquareConstructor numberType *class* ShapeInterface shape *where* area :: Num numberType =

Re: [Haskell-cafe] nice simple problem for someone struggling....

2007-12-21 Thread David Menendez
On Dec 21, 2007 2:38 PM, Jules Bean [EMAIL PROTECTED] wrote: David Menendez wrote: That's a reasonable thing to assume. It just happens that Haskell doesn't work that way. There's an asymmetry between constructing and pattern-matching, and it's one that many people have complained about

Re: [Haskell-cafe] Basic question concerning data constructors

2007-12-30 Thread David Menendez
On Dec 30, 2007 9:24 AM, Joost Behrends [EMAIL PROTECTED] wrote: A similar point: The tutorials teach, that = has a similar meaning than = in mathematics. But there is a big difference: it is not reflexive. The the right side is the definition of the left. Thus x=y has still some kind of

[Haskell-cafe] Re: bytestring 0.9.0.4

2008-01-05 Thread David Menendez
On Jan 5, 2008 12:37 AM, Don Stewart [EMAIL PROTECTED] wrote: The most notable change is the instance IsString for strict and lazy bytestrings, enabling bytestrings to be written as direct string literals, without needing 'pack'. That is, the following is valid: import

Re: [Haskell-cafe] Re: Occurs check error, help!

2010-03-21 Thread David Menendez
On Sun, Mar 21, 2010 at 11:31 PM, adamtheturtle kill2thr...@hotmail.com wrote: So I have the code shuffle :: Int - [a] - [a] shuffle i [] = [] shuffle i cards = (cards!!i) : shuffle (fst pair) (delete (cards!!i) cards)    where pair = randomR (0, 51) (mkStdGen 42) and it doesn't work, am I

Re: [Haskell-cafe] ANN: data-category, restricted categories

2010-03-26 Thread David Menendez
On Fri, Mar 26, 2010 at 11:07 AM, Edward Kmett ekm...@gmail.com wrote: On Fri, Mar 26, 2010 at 11:04 AM, Edward Kmett ekm...@gmail.com wrote: -- as long as you're ignoring 'seq' terminateSeq :: a - Unit terminateSeq a = a `seq` unit Er ignore that language about seq. a `seq` unit is

Re: [Haskell-cafe] Why is it so different between 6.12.1 and 6.10.4_1 ?

2010-03-26 Thread David Menendez
On Fri, Mar 26, 2010 at 8:20 PM, zaxis z_a...@163.com wrote: In 6.12.1 under archlinux let f x y z = x + y + z :t f f :: (Num a) = a - a - a - a :t (=) . f (=) . f :: (Num a) = a - ((a - a) - a - b) - a - b ((=) . f) 1 (\f x - f x) 2 5 In 6.10.4_1 under freebsd let f x y z = x + y + z

Re: [Haskell-cafe] Why is it so different between 6.12.1 and 6.10.4_1 ?

2010-03-26 Thread David Menendez
On Fri, Mar 26, 2010 at 8:59 PM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: zaxis z_a...@163.com writes: In 6.10.4_1 under freebsd let f x y z = x + y + z *Money :t f f :: (Num a) = a - a - a - a :t (=) . f (=) . f  :: (Monad ((-) a), Num a) = a - ((a - a) - a - b) - a - b

Re: [Haskell-cafe] Why is it so different between 6.12.1 and 6.10.4_1 ?

2010-03-26 Thread David Menendez
On Fri, Mar 26, 2010 at 9:13 PM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: David Menendez d...@zednenem.com writes: On Fri, Mar 26, 2010 at 8:59 PM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: Some definitions and exports got changed, so in 6.12 the (- a) Monad

Re: [Haskell-cafe] GHC vs GCC

2010-03-27 Thread David Menendez
On Sat, Mar 27, 2010 at 12:56 AM, Thomas DuBuisson thomas.dubuis...@gmail.com wrote: Using bang patterns didn't help almost anything here. Using rem instead of mod made the time go from 45s to 40s. Now, using -fvia-C really helped (when I used rem but not using mod). It went down to 10s.

Re: [Haskell-cafe] GHC vs GCC

2010-03-27 Thread David Menendez
On Sat, Mar 27, 2010 at 1:45 PM, Tillmann Rendel ren...@mathematik.uni-marburg.de wrote: Jan-Willem Maessen wrote: It's worth pointing out that there's a bit of bang-pattern mysticism going on in this conversation (which has not been uncommon of late!).  A non-buggy strictness analyzer should

Re: [Haskell-cafe] Integers v ints

2010-04-02 Thread David Menendez
On Thu, Apr 1, 2010 at 5:27 AM, Jens Blanck jens.bla...@gmail.com wrote: I was wondering if someone could give me some references to when and why the choice was made to default integral numerical literals to Integer rather than to Int in Haskell. Also, if you are aware of similar discussions in

[Haskell-cafe] Re: Move MonadIO to base

2010-04-18 Thread David Menendez
On Sun, Apr 18, 2010 at 5:02 PM, wren ng thornton w...@community.haskell.org wrote: Heinrich Apfelmus wrote: Anders Kaseorg wrote: This concept can also be generalized to monad transformers: class MonadTrans t = MonadTransMorph t where    morph :: Monad m = (forall b. (t m a - m b) - m b)

Re: [Haskell-cafe] The instability of Haskell libraries

2010-04-23 Thread David Menendez
On Fri, Apr 23, 2010 at 10:11 PM, John Goerzen jgoer...@complete.org wrote: Don Stewart wrote: Oh, the Platform has very strict standards about APIs, When a package may be added:    http://trac.haskell.org/haskell-platform/wiki/AddingPackages That looks like a very solid document.  Does it

Re: [Haskell-cafe] Proper Handling of Exceptional IEEE Floating Point Numbers

2010-04-24 Thread David Menendez
On Sat, Apr 24, 2010 at 5:56 AM, Barak A. Pearlmutter ba...@cs.nuim.ie wrote: Even deriving(Ord) only produces compare and relies on standard definitions for other methods. I don't think that's actually a problem.  Surely the IEEE Floating Point types would give their own definitions of not

Re: [Haskell-cafe] Rank-2 polymorphism and overloading

2010-04-29 Thread David Menendez
On Mon, Apr 26, 2010 at 2:55 PM, Thomas van Noort tho...@cs.ru.nl wrote: On 26-4-2010 20:12, Daniel Fischer wrote: Am Montag 26 April 2010 19:52:23 schrieb Thomas van Noort: ... Yes, y's type is more general than the type required by f, hence y is an acceptable argument for f - even z ::

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-07 Thread David Menendez
On Fri, May 7, 2010 at 10:26 PM, John Meacham j...@repetae.net wrote: On Fri, May 07, 2010 at 08:27:04PM -0400, Dan Doel wrote: Personally, I don't really understand why unfailable patterns were canned (they don't seem that complicated to me), so I'd vote to bring them back, and get rid of

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-07 Thread David Menendez
On Sat, May 8, 2010 at 12:15 AM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: David Menendez d...@zednenem.com writes: I wonder how often people rely on the use of fail in pattern matching. Could we get by without fail or unfailable patterns? ensureCons :: MonadPlus m = [a] - m

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-08 Thread David Menendez
On Sat, May 8, 2010 at 1:16 AM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: David Menendez d...@zednenem.com writes: On Sat, May 8, 2010 at 12:15 AM, Ivan Lazar Miljenovic Well, any time you have a do-block like this you're using failable patterns: maybeAdd       :: Maybe Int

Re: [Haskell-cafe] Type of (= f) where f :: a - m b

2010-05-10 Thread David Menendez
On Mon, May 10, 2010 at 5:51 AM, Milind Patil milind_pa...@hotmail.com wrote: For a function f ::  a - m b f = undefined I am having trouble understanding how the type of (= f) is (= f) :: m a - m b where, by definition, type of (=) is (=) :: (Monad m) = m a - (a - m b) - m b I

Re: [Haskell-cafe] Proposal to solve Haskell's MPTC dilemma

2010-05-21 Thread David Menendez
On Fri, May 21, 2010 at 3:56 AM, Max Bolingbroke batterseapo...@hotmail.com wrote: On 21 May 2010 01:58, Carlos Camarao carlos.cama...@gmail.com wrote: But this type-correct program would become not typeable if instances such as the ones referred to before (by Daniel Fischer) I was thinking

Re: [Haskell-cafe] FW: Why does this Ord-class instance crash?

2010-05-21 Thread David Menendez
2010/5/21 R J rj248...@hotmail.com: Why does the following, trivial  code snippet below hang GHCi when I type Scalene Failure, and what's the fix? An instance of Ord must declare compare or (=). You only defined (), so () is using the default definition. Here are the defaults: compare x y

[Haskell-cafe] Re: Proposal to solve Haskell's MPTC dilemma

2010-05-27 Thread David Menendez
On Thu, May 27, 2010 at 10:39 AM, Carlos Camarao carlos.cama...@gmail.com wrote: Isaac Dupree: Your proposal appears to allow /incoherent/ instance selection. This means that an expression can be well-typed in one module, and well-typed in another module, but have different semantics in the

Re: [Haskell-cafe] Re: Different choice operations in a continuation monad

2010-06-18 Thread David Menendez
On Fri, Jun 18, 2010 at 12:44 PM, Heinrich Apfelmus apfel...@quantentunnel.de wrote: Sebastian Fischer wrote: Edward Kmett wrote: Sebastian Fischer wrote: Heinrich Apfelmus wrote: newtype CMaybe a = CMaybe (forall r. (a - Maybe r) - Maybe r) Yes, with this type `orElse` has the same type as

Re: [Haskell-cafe] MonadCatchIO-transformers and ContT

2010-06-21 Thread David Menendez
On Mon, Jun 21, 2010 at 7:04 AM, Neil Brown nc...@kent.ac.uk wrote: Here's my speculation, based on glancing at the libraries involved: I believe the reason for this may be the MonadCatchIO instance for ContT: === instance MonadCatchIO m = MonadCatchIO (ContT r m) where   m `catch` f =

Re: [Haskell-cafe] Fwd: signficant improvements to the containers package

2010-06-24 Thread David Menendez
On Thu, Jun 24, 2010 at 3:08 AM, Ivan Miljenovic ivan.miljeno...@gmail.com wrote: As an aside, Alex Mason and I are discussing the possibility of taking advantage of AusHack *shameless plug* to write some kind of classes for the different types of containers with a hierarchy.  I know about

Re: [Haskell-cafe] Fwd: signficant improvements to the containers package

2010-06-25 Thread David Menendez
On Fri, Jun 25, 2010 at 12:58 AM, Ivan Miljenovic ivan.miljeno...@gmail.com wrote: On 25 June 2010 14:41, David Menendez d...@zednenem.com wrote: On Thu, Jun 24, 2010 at 3:08 AM, Ivan Miljenovic ivan.miljeno...@gmail.com wrote: As an aside, Alex Mason and I are discussing the possibility

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

2010-06-27 Thread David Menendez
On Sun, Jun 27, 2010 at 1:26 PM, Sebastian Fischer s...@informatik.uni-kiel.de wrote: Hi Max, very interesting observations! By the way, you can use this stuff to solve the restricted monad problem (e.g. make Set an instance of Monad). This is not that useful until we find out what the

Re: [Haskell-cafe] Associated types

2010-07-01 Thread David Menendez
On Thu, Jul 1, 2010 at 2:09 PM, Andrew Coppin andrewcop...@btinternet.com wrote: Consider the following:  class Path p where ...  class Path p = CompletePath p where ...  class Path p = IncompletePath p where   type CompletedPath p :: * Obviously, the idea is that CompletedPath Foo

Re: [Haskell-cafe] Associated types

2010-07-01 Thread David Menendez
On Thu, Jul 1, 2010 at 2:35 PM, Christopher Lane Hinson l...@downstairspeople.org wrote: On Thu, 1 Jul 2010, Christopher Lane Hinson wrote: Something like this should work: class (Path p, CompletePath (CompletedPath p)) = IncompletePath p where   type CompletedPath p :: * AIUI, this

Re: [Haskell-cafe] checking types with type families

2010-07-03 Thread David Menendez
On Sat, Jul 3, 2010 at 3:32 AM, Kevin Quick qu...@sparq.org wrote: On Wed, 23 Jun 2010 00:14:03 -0700, Simon Peyton-Jones simo...@microsoft.com wrote: I'm interested in situations where you think fundeps work and type families don't.  Reason: no one knows how to make fundeps work cleanly with

Re: [Haskell-cafe] Template Haskell sees into abstract data types

2010-07-03 Thread David Menendez
On Sat, Jul 3, 2010 at 7:20 PM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: Serguey Zefirov sergu...@gmail.com writes: I cannot directly create my own class instances for them because of that. But I found that I can write Template Haskell code that could do that - those data types

Re: [Haskell-cafe] Actually loading a Cabal package in GHCi

2010-07-11 Thread David Menendez
On Sun, Jul 11, 2010 at 3:25 PM, d...@patriot.net wrote: Prelude Haskore :l Haskore no location info: module `Haskore' is a package module Failed, modules loaded: none. You need to use :m here. -- Dave Menendez d...@zednenem.com http://www.eyrie.org/~zednenem/

Re: [Haskell-cafe] Design for 2010.2.x series Haskell Platform site

2010-07-18 Thread David Menendez
On Sat, Jul 17, 2010 at 2:10 PM, Don Stewart d...@galois.com wrote: andrewcoppin: Don Stewart wrote: allbery: like to repeat one request: Please, please, please make it easier to - Download older versions of HP. - Find out which HP release contains what. - Figure out what the difference

Re: [Haskell-cafe] Yet another monad transformer or silly usage of Either?

2010-07-25 Thread David Menendez
2010/7/25 Eugeny N Dzhurinsky b...@redwerk.com: Hello, everybody! I am trying to develop some sort of library, which supposed to sign into a WEB service, then perform some requests with it. Initially I designed methods in the following way data DServError = InvalidCredentials |

Re: [Haskell-cafe] Re: ANN: System.FilePath 0.9

2006-07-21 Thread David Menendez
Neil Mitchell writes: We should avoid referring to $PATH as the path, since we already have FilePath. Agreed, but I couldn't come up with a better name, if anyone has any suggestions. searchPath? -- David Menendez [EMAIL PROTECTED] http://www.eyrie.org/~zednenem

Re: [Haskell-cafe] The difficulty of designing a sequence class

2006-07-31 Thread David Menendez
something like, class (Functor s, MonadPlus s, forall a. Sequence (s a) a) = SeqFunctor s where ... -- David Menendez [EMAIL PROTECTED] | In this house, we obey the laws http://www.eyrie.org/~zednenem |of thermodynamics

Re: [Haskell-cafe] The difficulty of designing a sequence class

2006-07-31 Thread David Menendez
want to start writing if x Eq/== y Num/+ 1 then ... ? -- David Menendez [EMAIL PROTECTED] | In this house, we obey the laws http://www.eyrie.org/~zednenem |of thermodynamics! ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http

Re: [Haskell-cafe] rand* why not of type State g a

2006-08-19 Thread David Menendez
because Control.Monad.State belongs to the MTL which is outside Prelude. On the other hand, if you are using MTL, you'd probably want a more general signature, like: (RandomGen g, MonadState g m) = m a -- David Menendez [EMAIL PROTECTED] | In this house, we obey the laws http://www.eyrie.org

Re: [Haskell-cafe] Re: Numeric type classes

2006-09-13 Thread David Menendez
diff (Pt x y) (Pt x' y') = Vec (x - x') (y - y') midpoint p1 p2 = add (mult 0.5 (diff p1 p2)) p2 The type of midpoint is something like (DivisionRing a, Module a b, SymmetricGroupAction b c) = c - c - c -- David Menendez [EMAIL PROTECTED] | In this house, we obey the laws http://www.eyrie.org

Re: [Haskell-cafe] Re: Numeric type classes

2006-09-14 Thread David Menendez
Ross Paterson writes: On Thu, Sep 14, 2006 at 01:11:56AM -0400, David Menendez wrote: Coincidentally, I spent some time last week thinking about a replacement for the Num class. I think I managed to come up with something that's more flexible than Num, but still mostly comprehensible

Re: [Haskell-cafe] trouble installing greencard -- -fno-prune-tydecls flag ( was Re: trivial function application question )

2007-01-06 Thread David Menendez
not to print the missing component messages by default. There could be a verbose option to turn them back on. -- David Menendez [EMAIL PROTECTED] | In this house, we obey the laws http://www.eyrie.org/~zednenem |of thermodynamics! ___ Haskell-Cafe

Re: [Haskell-cafe] overlapping instance error -- need help using instance Monoid (Sum a) where a is a map of money values

2008-01-19 Thread David Menendez
On Jan 20, 2008 12:56 AM, Thomas Hartman [EMAIL PROTECTED] wrote: The code below compiles as given, however if I uncomment the tSM function I get the overlapping instance error mentioned in the subject line. Can someone give me advice on how to do what I want to do? basically I want to

Re: [Haskell-cafe] Abstracting ByteStrings

2008-01-23 Thread David Menendez
On Jan 22, 2008 6:19 PM, Chad Scherrer [EMAIL PROTECTED] wrote: A lazy ByteString is an alternative to a String=[Char] Careful. ByteString is an alternative to [Word8]. Converting [Char] to ByteString and back requires an encoding. (Unfortunately, the only encoding that comes with the

[Haskell-cafe] Re: Arrow without `'

2008-01-23 Thread David Menendez
On Jan 23, 2008 12:20 PM, Valery V. Vorotyntsev [EMAIL PROTECTED] wrote: I've built GHC from darcs, and... Could anybody tell me, what's the purpose of Arrow[1] not having `' method? It's derived from the Category superclass. -- Dave Menendez [EMAIL PROTECTED]

Re: [Haskell-cafe] Inverting a Monad

2008-02-06 Thread David Menendez
On Feb 6, 2008 6:32 AM, Bas van Dijk [EMAIL PROTECTED] wrote: Is there a way to 'invert' an arbitrary Monad? By 'inverting' I mean to turn success into failure and failure into success. Here are some specific inversions of the Maybe and List Monad: invM :: Maybe a - Maybe () invM Nothing

Re: [Haskell-cafe] Designing DSL with explicit sharing [was: I love purity, but it's killing me]

2008-02-13 Thread David Menendez
On Feb 13, 2008 5:36 AM, Luke Palmer [EMAIL PROTECTED] wrote: On Feb 13, 2008 9:33 AM, [EMAIL PROTECTED] wrote: The approach is based on the final tagless representation. Here is our DSL: class Exp repr where constant :: Int - repr Int variable :: String - repr Int add

Re: [Haskell-cafe] Where does ~ come from?

2008-02-19 Thread David Menendez
On Feb 19, 2008 4:15 PM, Wolfgang Jeltsch [EMAIL PROTECTED] wrote: Am Dienstag, 19. Februar 2008 18:26 schrieben Sie: […] However, I was told this: ~ a b is a ~ b, but if I write c a b and wish the effect of a `c` b. This would not work. ~ as an infix operator has a special place in

Re: [Haskell-cafe] Re: The Proliferation of List-Like Types

2008-02-20 Thread David Menendez
On Wed, Feb 20, 2008 at 10:46 PM, [EMAIL PROTECTED] wrote: Quoting Neil Mitchell [EMAIL PROTECTED]: Yes, its the projection onto another type: [] = Nothing (x:xs) = Just (x, xs) Also known as msplit: http://www.haskell.org/haskellwiki/New_monads/MonadSplit Almost. The

Re: [Haskell-cafe] haddock as a markdown preprocessor

2008-02-21 Thread David Menendez
On Thu, Feb 21, 2008 at 12:54 PM, Yitzchak Gale [EMAIL PROTECTED] wrote: Duncan Coutts wrote: To be honest I like the fact that haddock's markup is really simple and perhaps somewhat restrictive. A great improvement though would be... a generic backend that spits out the info that

Re: [Haskell-cafe] Re: Small displeasure with associated type synonyms

2008-03-06 Thread David Menendez
On Thu, Mar 6, 2008 at 3:57 PM, ChrisK [EMAIL PROTECTED] wrote: Okay, I get the difference. The T a annotation in val :: T a)and val :: T a does not help choose the C a dictionary. But the val :: a- T a and val (undefined :: a) allows a to successfully choose the C a dictionary.

Re: [Haskell-cafe] Issues(Bugs?) with GHC Type Families

2008-03-06 Thread David Menendez
On Thu, Mar 6, 2008 at 9:52 PM, Ryan Ingram [EMAIL PROTECTED] wrote: This is actually a general issue with the way typeclasses are defined in Haskell; the accepted solution is what the Show typeclass does: class C a where c :: a cList :: [a] cList = [c,c] instance C

Re: [Haskell-cafe] Issues(Bugs?) with GHC Type Families

2008-03-07 Thread David Menendez
On Fri, Mar 7, 2008 at 2:10 AM, Ryan Ingram [EMAIL PROTECTED] wrote: I don't think the cost is that great; the compiler can easily flag polymorphic functions that require type information for some or all arguments and in many cases the type evidence can be passed just-in-time when calling

Re: [Haskell-cafe] Re: (flawed?) benchmark : sort

2008-03-12 Thread David Menendez
On Wed, Mar 12, 2008 at 7:48 PM, [EMAIL PROTECTED] wrote: Adrian Hey wrote: This might be a reasonable thing to say about *sortBy*, but not sort as the ordering of equal elements should not be observable (for any correct instance of Ord). It should be impossible to implement a

Re: [Haskell-cafe] Re: (flawed?) benchmark : sort

2008-03-13 Thread David Menendez
On Wed, Mar 12, 2008 at 4:29 PM, Aaron Denney [EMAIL PROTECTED] wrote: When defining max, yes, you must take care to make sure it useable for cases when Eq is an equivalence relation, rather than equality. If you're writing library code, then it won't generally know whether Eq means true

Re: [Haskell-cafe] Type system

2008-03-14 Thread David Menendez
On Fri, Mar 14, 2008 at 2:50 PM, Andrew Coppin [EMAIL PROTECTED] wrote: Haskell has an expressive and powerful type system - which I love. It also has a seemingly endless list of weird and obscure type system extensions. And there are various things you can do in Haskell which *require*

Re: [Haskell-cafe] Equality constraints in type families

2008-03-25 Thread David Menendez
On Mon, Mar 24, 2008 at 12:14 AM, Manuel M T Chakravarty [EMAIL PROTECTED] wrote: One difference between type families and (value-level) functions is that not all parameters of a type family are treated the same. A type family has a fixed number of type indicies. We call the number of

Re: [Haskell-cafe] Re: Shouldn't this loop indefinitely = take (last [0..]) [0..]

2008-04-05 Thread David Menendez
On Fri, Apr 4, 2008 at 5:45 PM, Don Stewart [EMAIL PROTECTED] wrote: ndmitchell: Note: In case anyone gets the wrong impression, I am not suggesting lazy naturals be the standard numeric type in Haskell, just that by not going that way we have paid a cost in terms of elegance. I'd

Re: [Haskell-cafe] Laziness and Either

2008-04-23 Thread David Menendez
On Mon, Apr 21, 2008 at 2:18 PM, John Goerzen [EMAIL PROTECTED] wrote: Back when I was working on the logic for the bin-packing solver that I added to MissingH (for use with datapacker), I had a design decision to make: do I raise runtime errors with the input using error, or do I use an

Re: [Haskell-cafe] ANNOUNCE: Galois web libraries for Haskell released

2008-04-23 Thread David Menendez
On Tue, Apr 22, 2008 at 11:57 AM, Aaron Tomb [EMAIL PROTECTED] wrote: On Apr 22, 2008, at 6:20 AM, John Goerzen wrote: * xml A simple, lightweight XML parser/generator. http://hackage.haskell.org/cgi-bin/hackage-scripts/package/xml Can you describe how this

Re: [Haskell-cafe] My try for a CoroutineT monad tranformer

2008-04-25 Thread David Menendez
On Fri, Apr 25, 2008 at 3:45 PM, Dan Weston [EMAIL PROTECTED] wrote: Is there a Haskell Wiki page (or blog) on Monad Suspension? This looks like a nice paradigm that apfelmus points out can be used to considerably shorten your code, but only if the rest of us learn how! There are a few papers

Re: [Haskell-cafe] Re: Understanding tail recursion and trees

2008-05-03 Thread David Menendez
On Thu, May 1, 2008 at 4:10 PM, Daniil Elovkov [EMAIL PROTECTED] wrote: Felipe Lessa wrote: On Thu, May 1, 2008 at 9:44 AM, Felipe Lessa [EMAIL PROTECTED] wrote: On Thu, May 1, 2008 at 9:32 AM, Edsko de Vries [EMAIL PROTECTED] wrote: So then the question becomes: what *is* the

Re: [Haskell-cafe] Re: Understanding tail recursion and trees

2008-05-03 Thread David Menendez
On Sat, May 3, 2008 at 12:30 PM, Edsko de Vries [EMAIL PROTECTED] wrote: I think Huet's Zipper is intended to solve this sort of problem. data Path = Top | BranchL Path Tree | BranchR Tree Path type Zipper = (Path, Tree) openZipper :: Tree - Zipper openZipper t =

Re: [Haskell-cafe] Commutative monads vs Applicative functors

2008-05-14 Thread David Menendez
On Tue, May 13, 2008 at 9:06 PM, Ronald Guida [EMAIL PROTECTED] wrote: I have a few questions about commutative monads and applicative functors. From what I have read about applicative functors, they are weaker than monads because with a monad, I can use the results of a computation to

Re: [Haskell-cafe] Short circuiting and the Maybe monad

2008-05-17 Thread David Menendez
On Sat, May 17, 2008 at 1:24 AM, Kim-Ee Yeoh [EMAIL PROTECTED] wrote: Dan Piponi-2 wrote: In fact, you can use the Reader monad as a fixed size container monad. Interesting that you say that. Reader seems to me more as an anti-container monad. You just have to think of the environment as

Re: [Haskell-cafe] Newbie: State monad example questions

2008-05-22 Thread David Menendez
2008/5/22 Olivier Boudry [EMAIL PROTECTED]: On Wed, May 21, 2008 at 6:19 PM, Dmitri O.Kondratiev [EMAIL PROTECTED] wrote: -- Then we can use this State object (returned by getAny) in a function generating random values such as: makeRnd :: StdGen - (Int, StdGen) makeRnd = runState (do

Re: [Haskell-cafe] history of tuples vs pairs

2008-06-25 Thread David Menendez
2008/6/25 Conal Elliott [EMAIL PROTECTED]: I have a foggy memory that early ML had only binary pairing, nesting for n-tuples. Can anyone confirm this memory. If so, does anyone remember the rationale for going to n-tuples? Performance, perhaps? Similarly, did the Haskell designers consider

Re: [Haskell-cafe] Qualified import syntax badly designed (?)

2008-07-09 Thread David Menendez
On Wed, Jul 9, 2008 at 1:03 AM, wren ng thornton [EMAIL PROTECTED] wrote: What I would like to see is the ability to do (1) module renaming, (2) qualified import, (3) unqualified import, and (4) hiding all in a single declaration with a regular syntax. For example: import Data.Map as Map

Re: [Haskell-cafe] Qualified import syntax badly designed (?)

2008-07-09 Thread David Menendez
On Wed, Jul 9, 2008 at 2:51 PM, Jason Dusek [EMAIL PROTECTED] wrote: David Menendez [EMAIL PROTECTED] wrote: I've often thought it would be for Haskell to steal Agda's module syntax. It does pretty much everything you want (plus some other stuff we maybe don't need) and the various things

Re: [Haskell-cafe] Finally tagless - stuck with implementation of lam

2009-10-05 Thread David Menendez
2009/10/5 Robert Atkey bob.at...@ed.ac.uk: Hi Günther, The underlying problem with the implementation of 'lam' is that you have to pick an evaluation order for the side effects you want in the semantics of your embedded language. The two obvious options are call-by-name and call-by-value. I

Re: [Haskell-cafe] Generalizing IO

2009-10-05 Thread David Menendez
On Mon, Oct 5, 2009 at 7:56 PM, Floptical Logic flopticalo...@gmail.com wrote: The code below is a little interactive program that uses some state. It uses StateT with IO to keep state.  My question is: what is the best way to generalize this program to work with any IO-like monad/medium?  For

Re: [Haskell-cafe] Generalizing IO

2009-10-05 Thread David Menendez
On Mon, Oct 5, 2009 at 11:54 PM, Floptical Logic flopticalo...@gmail.com wrote: Instead of specifying the monad implementation, specify the interface. That is, you are using state operations (from MonadState) and IO operations (from MonadIO). Try removing all the type signatures that mention

Re: [Haskell-cafe] Snow Leopard, gtk2hs

2009-10-06 Thread David Menendez
On Tue, Oct 6, 2009 at 2:49 PM, Gregory Collins g...@gregorycollins.net wrote: Arne Dehli Halvorsen arne@gmail.com writes: This may be a little off-topic, but if someone could help me, I'd be grateful. I am trying to get to a working gtk2hs environment in MacOSX Snow Leopard Have you

Re: [Haskell-cafe] Re: Num instances for 2-dimensional types

2009-10-07 Thread David Menendez
On Wed, Oct 7, 2009 at 12:08 PM, Ben Franksen ben.frank...@online.de wrote: More generally, any ring with multiplicative unit (let's call it 'one') will do. Isn't that every ring? As I understand it, the multiplication in a ring is required to form a monoid. -- Dave Menendez

Re: [Haskell-cafe] Test.QuickCheck: generate

2009-10-07 Thread David Menendez
On Wed, Oct 7, 2009 at 8:29 PM, Michael Mossey m...@alumni.caltech.edu wrote: In Test.QuickCheck, the type of 'generate' is generate :: Int - StdGen - Gen a - a I can't find docs that explain what the Int does. Some docs are here:

Re: [Haskell-cafe] CBN, CBV, Lazy in the same final tagless framework

2009-10-09 Thread David Menendez
On Fri, Oct 9, 2009 at 11:12 AM, Felipe Lessa felipe.le...@gmail.com wrote: On Thu, Oct 08, 2009 at 12:54:14AM -0700, o...@okmij.org wrote: Actually it is possible to implement all three evaluation orders within the same final tagless framework, using the same interpretation of types and

Re: [Haskell-cafe] CBN, CBV, Lazy in the same final tagless framework

2009-10-09 Thread David Menendez
On Fri, Oct 9, 2009 at 1:39 PM, Felipe Lessa felipe.le...@gmail.com wrote: On Fri, Oct 09, 2009 at 01:27:57PM -0400, David Menendez wrote: On Fri, Oct 9, 2009 at 11:12 AM, Felipe Lessa felipe.le...@gmail.com wrote: That's really nice, Oleg, thanks!  I just wanted to comment that I'd prefer

Re: [Haskell-cafe] Different semantics in identical do statement?

2009-10-09 Thread David Menendez
On Fri, Oct 9, 2009 at 6:47 PM, staafmeister g.c.stave...@uu.nl wrote: Daniel Peebles wrote: I vaguely remember on IRC someone pointing out that the Parsec monad broke one of the laws. I think return _|_ x === _|_ which could be causing your problem. I may be wrong though. Confirmed,

Re: [Haskell-cafe] Monadic correctness

2009-10-17 Thread David Menendez
On Sat, Oct 17, 2009 at 3:21 PM, Andrew Coppin andrewcop...@btinternet.com wrote: Suppose we have  newtype Foo x  instance Monad Foo  runFoo :: Foo x - IO x What sort of things can I do to check that I actually implemented this correctly? I mean, ignoring what makes Foo special for a

Re: [Haskell-cafe] why cannot i get the value of a IORef variable ?

2009-10-22 Thread David Menendez
On Thu, Oct 22, 2009 at 2:23 AM, Gregory Crosswhite gcr...@phys.washington.edu wrote: For clarity, one trick that uses unsafePerformIO which you may have seen posted on this list earlier today is the following way of creating a globally visible IORef: import Data.IORef import

Re: [Haskell-cafe] Applicative but not Monad

2009-10-30 Thread David Menendez
On Fri, Oct 30, 2009 at 12:59 PM, Luke Palmer lrpal...@gmail.com wrote: On Fri, Oct 30, 2009 at 10:39 AM, Tom Davie tom.da...@gmail.com wrote: Of note, there is a sensible monad instance for zip lists which I *think* agrees with the Applicative one, I don't know why they're not monads:

Re: [Haskell-cafe] Applicative but not Monad

2009-10-30 Thread David Menendez
On Fri, Oct 30, 2009 at 1:33 PM, Yusaku Hashimoto nonow...@gmail.com wrote: Thanks for fast replies! Examples you gave explain why all Applicatives are not Monads to me. And I tried to rewrite Bob's Monad instance for ZipList with (=). import Control.Applicative instance Monad ZipList

Re: [Haskell-cafe] Re: Applicative but not Monad

2009-10-31 Thread David Menendez
On Sat, Oct 31, 2009 at 6:22 AM, Heinrich Apfelmus apfel...@quantentunnel.de wrote: Dan Weston wrote: Can you elaborate on why Const is not a monad? return x = Const x fmap f (Const x) = Const (f x) join (Const (Const x)) = Const x This is not  Const , this is the  Identity  monad. The

Re: [Haskell-cafe] Re: Newcomers question

2009-11-01 Thread David Menendez
On Sun, Nov 1, 2009 at 11:09 AM, b1g3ar5 nick.st...@gmail.com wrote: OK, I understand that now but I've got a supplimentary question. If I put: instance Eq b = Eq (a - b) where    (==) = liftA2 (Prelude.==) You don't need the Prelude. here. to do the Eq part I get another error:    

Re: [Haskell-cafe] Re: Experiments with defunctionalization, church-encoding and CPS

2009-11-01 Thread David Menendez
On Sun, Nov 1, 2009 at 7:12 AM, Heinrich Apfelmus apfel...@quantentunnel.de wrote: Even then, the results are mixed. The Church-encoding shines in GHCi as it should, but loses its advantage when the code is being compiled. I guess we have to look at the core if we want to know what exactly is

Re: [Haskell-cafe] Applicative but not Monad

2009-11-01 Thread David Menendez
On Sun, Nov 1, 2009 at 11:20 AM, Conor McBride co...@strictlypositive.org wrote: On 31 Oct 2009, at 10:39, Conor McBride wrote: On 30 Oct 2009, at 16:14, Yusaku Hashimoto wrote: Hello cafe, Do you know any data-type which is Applicative but not Monad? [can resist anything but temptation]

Re: [Haskell-cafe] Re: Experiments with defunctionalization, church-encoding and CPS

2009-11-01 Thread David Menendez
On Sun, Nov 1, 2009 at 12:31 PM, Heinrich Apfelmus apfel...@quantentunnel.de wrote: David Menendez wrote: On Sun, Nov 1, 2009 at 7:12 AM, Heinrich Apfelmus apfel...@quantentunnel.de wrote: Even then, the results are mixed. The Church-encoding shines in GHCi as it should, but loses its

Re: [Haskell-cafe] Are all arrows functors?

2009-11-05 Thread David Menendez
On Thu, Nov 5, 2009 at 4:34 PM, Andrew Coppin andrewcop...@btinternet.com wrote: Nicolas Pouillard wrote: Excerpts from Neil Brown's message of Tue Nov 03 13:45:42 +0100 2009: Hi, I was thinking about some of my code today, and I realised that where I have an arrow in my code, A b c, the

Re: [Haskell-cafe] Long running Haskell program

2009-11-11 Thread David Menendez
On Wed, Nov 11, 2009 at 1:09 PM, Matthew Pocock matthew.poc...@ncl.ac.uk wrote: Is there a state monad that is strict on the state but lazy on the computation? Of course, strictness in the state will force a portion of the computation to be run, but there may be significant portions of it which

Re: [Haskell-cafe] A small (?) problem with type families

2009-11-13 Thread David Menendez
On Fri, Nov 13, 2009 at 3:26 PM, Andy Gimblett hask...@gimbo.org.uk wrote: First a type family where the type Y is functionally dependent on the type X, and we have a function from Y to (). class X a where   type Y a   enact :: Y a - () This is ambiguous. Type families are not injective

Re: [Haskell-cafe] A small (?) problem with type families

2009-11-13 Thread David Menendez
On Fri, Nov 13, 2009 at 4:00 PM, Daniel Fischer daniel.is.fisc...@web.de wrote: Am Freitag 13 November 2009 21:36:59 schrieb David Menendez: I recall seeing a discussion of this in the GHC documentation, but I can't seem to locate it. Perhaps http://www.haskell.org/haskellwiki/GHC

Re: Re[Haskell-cafe] cursive to foldr

2009-11-17 Thread David Menendez
On Tue, Nov 17, 2009 at 6:31 PM, Ezra Lalonde ezra.lalo...@gmail.com wrote: Using the same basic structure you did, and foldr, I think below is the simplest method: import Data.Maybe searchList :: (a - Bool) - [a] - Maybe [a] searchList p xs = foldr (\x acc - if p x

Re: Re[Haskell-cafe] cursive to foldr

2009-11-17 Thread David Menendez
On Tue, Nov 17, 2009 at 10:01 PM, Luke Palmer lrpal...@gmail.com wrote: filter even [0..]    --    [0,2,4,6,8,...] searchList even [0...]   --   Just [0,2,4,6,8,...] searchList gives Nothing in exactly those cases that filter gives []. They give _|_ in exactly the same situations.  searchList

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

2009-11-18 Thread David Menendez
On Wed, Nov 18, 2009 at 4:12 PM, Edward Kmett ekm...@gmail.com wrote: Qualified imports are some times problematic when you need to work with classes from the module. You can't define a member of two instances from different two modules that define classes with conflicting member names. This

Re: [Haskell-cafe] Possible FGL bug

2009-11-25 Thread David Menendez
On Wed, Nov 25, 2009 at 6:28 AM, Neil Brown nc...@kent.ac.uk wrote: It looks like a bug to me.  Can you show an exact list of nodes and edges that is causing mkGraph to fail?  Or is that what you have displayed, and I can't parse it properly? From what I can tell, insEdge inserts an edge

Re: [Haskell-cafe] Possible FGL bug

2009-11-25 Thread David Menendez
On Wed, Nov 25, 2009 at 11:02 AM, Neil Brown nc...@kent.ac.uk wrote: David Menendez wrote: From what I can tell, insEdge inserts an edge between two nodes which are already in the graph. The code is calling insEdge on arbitrarily-labeled nodes, which may not exist in the graph. That's what

Re: [Haskell-cafe] instance Binary UTCTime (Was: Oprhan instances)

2009-11-26 Thread David Menendez
On Thu, Nov 26, 2009 at 3:47 PM, Antoine Latter aslat...@gmail.com wrote: Lets say I want to provide an alternate or additional library of monad transformer data types. To make these types maximally useful, they should implement the typeclasses in the mtl package and in the monads-tf package.

Re: [Haskell-cafe] instance Binary UTCTime (Was: Oprhan instances)

2009-11-29 Thread David Menendez
On Sun, Nov 29, 2009 at 8:37 AM, Duncan Coutts duncan.cou...@googlemail.com wrote: On Thu, 2009-11-26 at 16:40 -0500, David Menendez wrote: The problem with this solution is that it doesn't scale. If we have M packages providing types and N packages providing classes, then we need M*N

<    1   2   3   4   5   >