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
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
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
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
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
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
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
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
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]> |
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
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
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> |
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
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 =
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
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
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
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
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,
= 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
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,
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
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
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@
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
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]
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
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
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
<- 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.
'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
31 matches
Mail list logo