Re: [Haskell] string type class

2009-03-06 Thread David Menendez
On Fri, Mar 6, 2009 at 12:05 PM, Wolfgang Jeltsch wrote: > Am Freitag, 6. März 2009 17:31 schrieben Sie: >> What name would you suggest? > > If we wouldn’t have to care about compatibility, I would name the class String > and drop the type alias String. > > It’s hard to come up with a good name si

Re: [Haskell] An Alternative Data.List.Zipper

2009-01-17 Thread David Menendez
On Sat, Jan 17, 2009 at 9:13 PM, wrote: > On Sat, 17 Jan 2009, David Menendez wrote: > >> instance Applicative f => Applicative (Backwards f) where >> pure = B . pure >> f <*> x = B (unB f <**> unB x) > > probably should be f <*> x

Re: [Haskell] An Alternative Data.List.Zipper

2009-01-17 Thread David Menendez
On Sat, Jan 17, 2009 at 7:49 PM, Jeff Wheeler wrote: > On Sat, 2009-01-17 at 17:41 -0500, David Menendez wrote: >> That's correct, but I think you'd be better off defining OpApplicative >> (or Backward, as I call it) locally and avoiding the two reverses. > > I&#x

Re: [Haskell] An Alternative Data.List.Zipper

2009-01-17 Thread David Menendez
On Sat, Jan 17, 2009 at 4:32 PM, Jeff Wheeler wrote: > On Sat, 2009-01-17 at 21:55 +0100, Jean-Philippe Bernardy wrote: > >> I think it should admit empty, and the traversable instance should >> traverse the first list in reverse. > > I fixed the latter issue so that the behavior is correct (I thi

Re: [Haskell] Passing typeclasses as parameters?

2008-03-14 Thread David Menendez
On Fri, Mar 14, 2008 at 8:06 AM, Ville Tirronen <[EMAIL PROTECTED]> wrote: > Hi all. > > I managed to paint myself in a corner where I did this: > > > data ShowDynamic = forall a . (Show a) => SD Dynamic a > > toShowDyn a = SD (toDyn a) a > > fromShowDyn (SD d a) = fromDynamic d > > > instance

Re: [Haskell] detecting existing instances

2008-01-09 Thread David Menendez
On Jan 9, 2008 3:10 PM, Ralf Laemmel <[EMAIL PROTECTED]> wrote: > > Type-level type cast is the type-level programmer's swiss army knife. > See the illustration below. > Does this get any easier with type families? Your (TypeCast a b) seems similar in intent to (a ~ b), but I'm not familiar enou

Re: [Haskell] Haskell Applications - reg

2007-10-04 Thread David Menendez
On 10/4/07, Ganesh Narayan <[EMAIL PROTECTED]> wrote: > True, but I was of the opinion that -O0, -fno-state-hack and > -fno-full-laziness would preserve the calling structure with minimal > perturbance. Wouldn't it? Besides, I am hardly aware of any utility that > generates source level call graph

Re: [Haskell] ST vs State

2007-05-30 Thread David Menendez
David Menendez writes: > It's also possible to write ST in terms of State. > > Assume we have a Store ADT with this interface: > > data Store r > data STRef r a > withStore :: (forall r. Store r -> a) -> a > newRef:: a -> Store r

Re: [Haskell] ST vs State

2007-05-30 Thread David Menendez
ties. The first is that you can't implement Store without cheating at some level (e.g., unsafeCoerce). The second is that the real ST implementation uses in-place update, which is only safe because the Store is implicit and used single-threadedly. -- David Menendez <[EMAIL PROTECTED]> |

Re: [Haskell] ANNOUNCE: Data.CompactString 0.1 - my attempt at a Unicode ByteString

2007-02-05 Thread David Menendez
and no more, that is, a little over a million > characters instead of over 2,000 million -- David Menendez <[EMAIL PROTECTED]> | "In this house, we obey the laws <http://www.eyrie.org/~zednenem> |of thermodynamics!" ___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell

Re: [Haskell] Long live Edison

2006-02-20 Thread David Menendez
me. Is there an argument for using > the other order? The order of rcons is also natural for using in-line, e.g. "xs `rcons` x". -- David Menendez <[EMAIL PROTECTED]> | "In this house, we obey the laws <http://www.eyrie.org/~zednenem> |of thermodynam

Re: [Haskell] generic catch in a MonadIO

2006-02-07 Thread David Menendez
stance MonadError Exception IO' where throwError = IO' . throwIO m `catchError` h = IO' $ catch (unIO' m) (unIO' . h) -- David Menendez <[EMAIL PROTECTED]> | "In this house, we obey the laws <http://www.eyrie.org/~zednenem> |

Re: [Haskell] Re: haskell.org Public Domain

2006-01-10 Thread David Menendez
nze's nondeterminism monad. If I use that in a project, do I need to credit Ralf? The person who typed it into the wiki? Anyone who modified it? The wiki itself? How much code do you need to borrow from the wiki before you need to provide an acknowledgement? -- David Menendez <[EMAIL PROT

Re: [Haskell] A collection of related proposals regarding monads

2006-01-04 Thread David Menendez
join m = m >>= id m >>= f = join (map f m) class Monad m => MonadZero m where nothing :: m a class MonadZero m => MonadPlus m where (++) :: m a -> m a -> m a class MonadPlus m =

Re: [Haskell] GADT type inference problem

2005-11-30 Thread David Menendez
gt; ShowS What's strange is that GHC accepted the code at all. There would probably be less confusion if GADT arguments always required a signature, like arguments involving higher-rank polymorphism. -- David Menendez <[EMAIL PROTECTED]> | "In this house, we obey the laws <ht

Re: [Haskell] really undecidable instances?

2005-10-30 Thread David Menendez
a Pretty-promoting constructor class. class Pretty'1 f where pretty'1 :: Pretty a => f a -> Doc prettyList'1 :: Pretty a => [f a] -> Doc instance (Pretty a, Pretty'1 tree) => Pretty (Node23 tree a) where ... Your typical Pret

Re: [Haskell] PROPOSAL: class aliases

2005-10-13 Thread David Menendez
gt; the empty class may be treated as a synonym, if that's simpler. Does > this make any sense? I don't know that method-less classes have *no* value. You could use them to make additional claims about a type. For example, class Monoid m where { ... } class Commu

Re: [Haskell] getArgs, maxBound, float division: pure functions?

2005-10-11 Thread David Menendez
d use seperate types to distinguish floats with different rounding modes, but I imagine this would be difficult or annoying to implement. -- David Menendez <[EMAIL PROTECTED]> <http://www.eyrie.org/~zednenem/> ___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell

Re: [Haskell] Paper: The essence of dataflow programming

2005-09-25 Thread David Menendez
kes it seem like sum is using past calculations, but in fact there can be no communication from one invocation of sum to the next. Thus, sum is O(n), but "coextend sum" is O(n^2). There are other arrows with better performance. Consider the automaton arrow[3]: newtype Auto a b = Auto (a -> (b,

[Haskell] Fixed-length vectors in Haskell, Part 2: Using no extensions

2005-05-07 Thread David Menendez
= Cons v Nil > > col :: Vec v => v a -> v (Vec_1 a) > col = fmap (\v -> Cons v Nil) > > -- > newtype Transpose a w v = Transpose > { runTranspose :: v (w a) -> w (v a) } > > transpose :: (Vec v, Vec w) => v (w a) -> w (v a) > transpose = runTran

[Haskell] Fixed-length vectors in Haskell, Part 1: Using GADTs

2005-05-07 Thread David Menendez
mult :: (Nat n, Num a) => Matrix k m a -> Matrix m n a -> Matrix k n a > mult x y = fmap (\r -> fmap (inner r) y') x > where y' = transpose y *Vector_GADT> row v `mult` col v [[30]] *Vector_GADT> col v `mult` row v [[1,2,3,4],[2,4,6,8],[3,

Re: [Haskell] Y in haskell?

2005-04-17 Thread David Menendez
lso seen this: y f = g where g = f g -- David Menendez <[EMAIL PROTECTED]> | "In this house, we obey the laws <http://www.eyrie.org/~zednenem> |of thermodynamics!" ___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell

Re: [Haskell] Control.Monad.Writer as Python generator

2005-04-13 Thread David Menendez
d be a continuation monad. import Control.Monad.Cont yield :: a -> Cont [a] () yield x = Cont (\c -> x : c ()) asGenerator :: Cont [a] v -> [a] asGenerator (Cont f) = f (const []) -- David Menendez <[EMAIL PROTECTED]> | "In this house, we obey

Re: [Haskell] Arrows GUI Library Based on GTK+

2005-03-19 Thread David Menendez
with wxFruit[1]? It adapts Fruit to run on wxHaskell. [1] <http://zoo.cs.yale.edu/classes/cs490/03-04b/bartholomew.robinson/> -- David Menendez <[EMAIL PROTECTED]> <http://www.eyrie.org/~zednenem/> ___ Haskell mailing list Haskell@

Re: [Haskell] Type of y f = f . f

2005-02-28 Thread David Menendez
systems which can type this, but they have their own quirks. For example, System E [1] would give us: y :: (a -> b & b -> c) -> a -> c where "a & b" is the intersection of types "a" and "b". The advantage of System E over, say, System F, is that type inferencing is decidable. The downside is that the inferred types can be pretty long. [1] <http://www.macs.hw.ac.uk/~sebc/> -- David Menendez <[EMAIL PROTECTED]> <http://www.eyrie.org/~zednenem/> ___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell

Re: [Haskell] Help on Arrows

2005-01-15 Thread David Menendez
m b) => a b b myAdd1A = arr (\x -> x + 1) ($) myAdd1A :: Num b => b -> b runKleisli myAdd1A :: (Monad m, Num b) => b -> m b More interesting arrows, like the signal processors in Yampa [4], may not have a meaningful concept of application. [4]

[Haskell] BBEdit syntax highlighting for Haskell

2004-08-30 Thread David Menendez
tart BBEdit. -- David Menendez <[EMAIL PROTECTED]> | "In this house, we obey the laws <http://www.eyrie.org/~zednenem> |of thermodynamics!" ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell

Re: [Haskell] Do the libraries define S' ?

2004-07-08 Thread David Menendez
join m = m >>= id m >>= k = join (fmap k m) [1] Composing Monads Using Coproducts <http://www.informatik.uni-bremen.de/~cxl/papers/icfp02.pdf> [2] Composing Monads <http://www.cse.ogi.edu/~mpj/pubs/composing.html> -- David Menendez <[EMAIL PROTECTED]> <http://www.eyrie.org/~zednenem/> ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell

RE: [Haskell] Annoying naming clashes

2004-06-17 Thread David Menendez
een any movement towards implementing it? Did some technical obsticle arise, or have people simply been busy elsewhere? > [2] Warren Burton, Erik Meijer, Patrick Sansom, Simon Thompson, and > Philip Wadler. Views: An extension to Haskell pattern matching, 1996. > http://www.haskell.org

Re: [Haskell] IO, exceptions and error handling

2004-06-14 Thread David Menendez
<- mapError AppXmlError (xmlFunc s) >return ("result: " ++ s') > > > mapError :: (MonadError e m) > => (e' -> e) -> ErrorT e' m a -> m a > mapError f m = runErrorT m >>= either (throwError . f) return > > -- n.b.

[Haskell] Arrows and XML filters

2004-04-16 Thread David Menendez
't know if this has any practical value. (Perhaps for future XML libraries?) If nothing else, it's given me some experience with and (I hope) a better understanding of arrows. -- David Menendez <[EMAIL PROTECTED]> <http://www.eyrie.org/~zednenem/> ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell