Audrey
> I think he managed to explain very effectively what made Haskell
^^ she
Peace,
Dylan Thurston
signature.asc
Description: Digital signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
htt
with the Kiselyov-Shan
approach to dependent types? Does it look too bizarre?
http://okmij.org/ftp/Haskell/types.html#Prepose
http://okmij.org/ftp/Haskell/number-parameterized-types.html
Peace,
Dylan Thurston
signature.asc
Description: Digital
ntioned this in his response. To implement modular arithmetic with
these signatures, as far as I know, you need to either separate Zero
constructors or do something like the Kiselyov-Shan paper. (See,
e.g., Frederick Eaton's linear algebra library recently posted to the
Haskell list.)
Peace,
On Mon, Mar 27, 2006 at 05:02:20AM -0800, John Meacham wrote:
> well, in interfaces you are going to end up with some specific class or
> another concretely mentioned in your type signatures, which means you
> can't interact with code that only knows about the alternate class. like
>
> genericLeng
On Wed, Jan 04, 2006 at 03:02:29AM +0100, Sebastian Sylvan wrote:
> I took a stab at the rev-comp one due to boredom. It's not a space
> leak, believe it or not, it's *by design*...
>
> My god, I think someone is consciously trying to sabotage Haskell's
> reputation!
>
> Instead of reading input
On Sun, Jan 01, 2006 at 11:12:31PM +, Joel Reymont wrote:
> Simon,
>
> Please see this post for an extended reply:
>
> http://wagerlabs.com/articles/2006/01/01/haskell-vs-erlang-reloaded
Looking at this code, I wonder if there are better ways to express
what you really want using static typi
On Wed, Dec 21, 2005 at 11:43:42AM +, Daniel Carrera wrote:
> Hi all,
>
> I'm a Haskell newbie and I don't really understand how Haskell deals
> with functions that really must have side-effects. Like a rand()
> function or getLine().
>
> I know this has something to do with monads, but I d
On Tue, May 17, 2005 at 01:13:17PM +0200, Jens Blanck wrote:
> > > How would I introduce number classes that are extended with plus and
> > > minus infinity? I'd like to have polymorphism over these new classes,
> > > something like a signature
> > >
> > > f :: (Real a, Extended a b) => b -> b
> >
On Fri, Feb 04, 2005 at 03:08:51PM +0100, Henning Thielemann wrote:
> On Thu, 3 Feb 2005, Dylan Thurston wrote:
>
> >On Fri, Jan 28, 2005 at 08:16:59PM +0100, Henning Thielemann wrote:
> >
> >>>>O(n)
> >>>> which sho
of a set. Do you mean that?
>
> On Thu, Feb 03, 2005 at 08:16:49PM -0500, Dylan Thurston wrote:
> > I think this is the only reasonable generalization from the
> > established usage of, e.g., 2^(O(n)). In practice, this means that
> > 1/O(n^2) is the set of functions
(Resurrecting a somewhat old thread...)
On Fri, Jan 28, 2005 at 08:16:59PM +0100, Henning Thielemann wrote:
> On Fri, 28 Jan 2005, Chung-chieh Shan wrote:
> > But I would hesitate with some of your examples, because they may simply
> > illustrate that mathematical notation is a language with side
On Sat, Nov 20, 2004 at 03:48:23PM +, Jorge Adriano Aires wrote:
> > On Sat, Nov 20, 2004 at 12:47:58PM +0300, Serge D. Mechveliani wrote:
> > > foldlWhile :: (a -> b -> a) -> (a -> Bool) -> a -> [b] -> a
> > > foldlWhilefp abs =
> > > case
> > >
On Sat, Nov 20, 2004 at 12:47:58PM +0300, Serge D. Mechveliani wrote:
> Is such a function familia to the Haskell users?
>
> foldlWhile :: (a -> b -> a) -> (a -> Bool) -> a -> [b] -> a
> foldlWhilefp abs =
> case
> (bs, p a)
> of
> ([],
On Fri, Nov 05, 2004 at 02:53:01PM +, MR K P SCHUPKE wrote:
> >My guess is because irrationals can't be represented on a discrete computer
>
> Well, call it arbitrary precision floating point then. Having built in
> Integer support, it does seem odd only having Float/Double/Rational...
There
On Thu, Nov 04, 2004 at 08:32:52PM +0100, Sven Panne wrote:
> It's an old thread, but nothing has really happened yet, so I'd like to
> restate and expand the question: What should the behaviour of toRational,
> fromRational, and decodeFloat for NaN and +/-Infinity be? Even if the report
> is uncle
On Mon, Oct 11, 2004 at 09:53:16PM -0400, Scott Turner wrote:
> Evenutally I realized that calculating with lazy lists is not as
> smooth as you might expect. For example, the square root of 2 has a
> simple representation as a lazy continued fraction, but if you
> multiply the square root of 2 by
On Mon, Sep 20, 2004 at 01:11:34PM +0300, Einar Karttunen wrote:
> Size
>
> Handling large amounts of text as haskell strings is currently not
> possible as the representation (list of chars) is very inefficient.
You know about the PackedString functions, right?
http://www.haskell.org/ghc/docs/
On Mon, Apr 05, 2004 at 01:59:18PM +0200, Henning Thielemann wrote:
> In addition I separated a class VectorSpacePure from the VectorSpace
> class that contains the operations that don't need the scalar type 'a',
> i.e. 'zero' and 'add'.
I called this class 'Additive' in my old proposal to revam
On Sat, Apr 03, 2004 at 01:35:44PM +0200, Henning Thielemann wrote:
> (I like to omit -fallow-undecidable-instances
>before knowing what it means)
There's a nice section in the GHC user's manual on it. I can't add
anything to that.
> > -- a classical linear space
> > class VectorSpace v a
On Mon, Mar 29, 2004 at 06:00:57PM +0200, Henning Thielemann wrote:
> Thus I setup a type constructor VectorSpace
> in the following way:
>
> > module VectorSpace
> >where
> >
> > class VectorSpace v where
> >zero :: v a
> >add :: v a -> v a -> v a
> >scale :: a -> v a -> v a
>
On Fri, Jan 30, 2004 at 09:21:58AM -0700, [EMAIL PROTECTED] wrote:
> Hi,
>
> I'm writing a game in Haskell. The game state includes a lot of closures.
> For example, if a game object wants to trigger an event at a particular
> time, it adds a function (WorldState -> WorldState) to a queue. S
On Mon, Jul 28, 2003 at 03:23:30PM +1000, Andrew J Bromage wrote:
> G'day all.
>
> On Sun, Jul 27, 2003 at 10:36:46PM -0400, Dylan Thurston wrote:
>
> > However, I would be sure to distinguish between an inner product space
> > and a vector space.
>
> That
On Mon, Jul 28, 2003 at 03:42:11PM +0200, Konrad Hinsen wrote:
> On Friday 25 July 2003 21:48, Dylan Thurston wrote:
>
> > Another approach is to make Universe a multi-parameter type class:
> >
> > class (RealFrac a, Floating a) => Universe u a | u -> a where
> &g
On Mon, Jul 28, 2003 at 11:59:48AM +1000, Andrew J Bromage wrote:
> G'day all.
>
> On Fri, Jul 25, 2003 at 03:48:15PM -0400, Dylan Thurston wrote:
>
> > Another approach is to make Universe a multi-parameter type class:
> >
> > class (RealFrac a, Floatin
On Fri, Jul 25, 2003 at 08:31:26AM -0700, Hal Daume wrote:
> However, once we fix this, we can see the real problem. Your Universe
> class has a method, distanceVector, of type:
>
> | distanceVector :: Universe u, Floating a => u -> Vector a -> Vector a
> -> Vector a
>
> And here's the problem.
On Tue, Jul 15, 2003 at 01:07:12AM -0700, Ashley Yakeley wrote:
> In article <[EMAIL PROTECTED]>,
> Marcin 'Qrczak' Kowalczyk <[EMAIL PROTECTED]> wrote:
>
> > It doesn't provide instances of Num for anything which is already an instance
> > of the other classes. And in Haskell 98 they must be de
On Thu, Jul 10, 2003 at 02:33:25PM +0100, Ross Paterson wrote:
> Subclasses in Haskell cover a range of relationships, including this
> sense where things in the subclass automatically belong to the superclass.
> Other examples include Eq => Ord and Functor vs Monad. In such cases it
> would be ha
On Sat, Jun 07, 2003 at 08:24:41PM -0500, Stecher, Jack wrote:
It sounds like you're on the right track...
> > You could get a moderately more efficient implementation by keeping
> > the active list as a heap rather than a list.
>
> I had thought about that, and took the BinomialHeap.hs file from
On Thu, Jun 05, 2003 at 08:09:02AM -0500, Stecher, Jack wrote:
> I have an exceedingly simple problem to address, and am wondering if
> there are relatively straightforward ways to improve the efficiency
> of my solution.
Was there actually a problem with the efficiency of your first code?
> The
s Jerzy Karczmarczuk mentioned, there is really extensive literature on
this. It's beautiful stuff.
Part of my motivation for revising the numeric parts of the Prelude was
to make it possible to implement all this elegantly in Haskell.
--Dylan Thurston
msg02082/pgp0.pgp
Description: PGP signature
On Sat, Sep 21, 2002 at 12:56:13PM -0700, Russell O'Connor wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> [To: [EMAIL PROTECTED]]
>
> Is there a nicer way of writing the following sort of code?
>
> case (number g) of
> Just n -> Just (show n)
> Nothing ->
> case (fraction g) o
On Sat, Jul 13, 2002 at 07:58:19PM +1000, Bernard James POPE wrote:
> ...
> I'm fond of the idea proposed by Marcin 'Qrczak' Kowalczyk:
>
>May I propose an alternative way of specifying an alternative Prelude?
>Instead of having a command line switch, let's say that 3 always means
>Pr
tting too hairy; I think I decided that lists and tuples
were too deeply intertwined into the language to change cleanly.
I'll dig up my old notes and write more, and then maybe write a
complete design document and get someone to implement it.
--Dylan Thurston
msg01674/pgp0.pgp
Description: PGP signature
ation. In this case, there is a very simple
algorithm: work modulo (s-t+1).
scm(n) = (n `rem` (s-t+1)) + s
Warning: some, broken, random number generators do not behave well
when used like this. Also, although this is as uniform as possible,
there is a systematic skew towards the lower
at all.
(Suppose, e.g., that comparing two particular elements yields an
exception.)
It seems to me this is a problem with providing code as specification:
you probably fix the details more than you want.
Best,
Dylan Thurston
msg01575/pgp0.pgp
Description: PGP signature
On Wed, Feb 20, 2002 at 01:15:36PM -0800, Simon Peyton-Jones wrote:
> Another possiblity would be to make the ConCls class look like this
> class ConCls c where
> name :: String
> arity :: Int
> ...etc...
>
> Now we'd have to give an explicit type argument at the ca
in this setup, the CPO
[()->()]
has four elements, in a totally ordered CPO; in increasing order, they
are
undefined
const undefined
id
const ()
Is it really clear the first two ('undefined' and 'const undefined') are
different? Ken says they are observationally equivalent.
--Dylan Thurston
msg01191/pgp0.pgp
Description: PGP signature
> sinh operation, for instance. (Complex will be covered by LIA-3.)
This sounds like a very interesting standard. I am constantly annoyed
by ISO's attempts to hide their standards; one might wonder what the
purpose is of having unavailable "standards". Is the content
available
.
etc. Any program using this library is bound to get confused on
Unicode strings. Even before Unicode, there is much functionality
missing; for instance, I don't see any way to compare strings using
a localized order.
Is anyone working on honest support for Unicode, in the form of a r
kasaki's book.
Best,
Dylan Thurston
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe
GC it away after you are done with it. The downside is that
accessing elements within the window will take time O(window size).
Are the windows large enough that this is a concern?
Best,
Dylan Thurston
___
Haskell-Cafe mailing list
[EMAI
On Sun, May 27, 2001 at 10:46:37PM -0500, Jay Cox wrote:
> >data S m a = Nil | Cons a (m (S m a))
>...
> >instance (Show a, Show (m (S m a))) => Show (S m a) where
> > show Nil = "Nil"
> > show (Cons x y) = "Cons " ++ show x ++ " " ++ show y
...
> >show s
> >s = Cons 3 [Cons 4 [], Cons 5 [Cons
.
Are you proposing that variables still be implicitly quantified in
top-level bindings, but that elsewhere they have pattern-matching
semantics?
Best,
Dylan Thurston
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe
rt' that behaves like this.
This is a good example, which cannot be implemented in
Haskell. "Exception.assert" is built in to the ghc compiler, rather than
being defined within the language. On the other hand, the built in
function gives you the source file and line number rather tha
On Sun, Apr 08, 2001 at 11:34:45AM +, Marcin 'Qrczak' Kowalczyk wrote:
> ...
> I found a way to express map and zipWith, but it's quite ugly. I would
> be happy to have a better way.
>
> class Map c' a' c a | c' -> a', c -> a, c' a -> c, c a' -> c' where
> map :: (a' -> a) -> c' -
rrect? (As
opposed to built-in equality for data constructors and characters.)
--Dylan Thurston
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe
let me know.
>From my cursory glance, it looked quite interesting, but I was
disturbed by the changes required in the TeX source that didn't refer
to Haskell at all. Is there any way to improve that situation?
Best,
Dylan Thurston
___
n't honestly say I would use it much (other than for the
numeric types) in the near future.
Best,
Dylan Thurston
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe
ilers would be able to produce good code in
this case.
But this would have to be changed:
An alternative of the form
pat -> exp where decls
is treated as shorthand for:
pat | True -> exp where decls
Best,
Dylan Thurston
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe
nal and integral exponents, or I want Z/2 torsion? How do I
create a new dimension? Is there some function that creates a
dimension from a string or some such? What is its type? Can I
prevent dimensions from unrelated parts of the program from
interfering?
Best,
Dylan Thurston
h one
> you want for each type; i.e.:
>
>instance Fractional MyFraction where
> (^) = fractionalPow
This is another option. It has the advantage of being explicit and
allowing you to choose easily in cases of ambiguity. It is more
conservative, but possibly less convenient
On Wed, Feb 14, 2001 at 09:53:16PM +, Marcin 'Qrczak' Kowalczyk wrote:
> Tue, 13 Feb 2001 18:32:21 -0500, Dylan Thurston <[EMAIL PROTECTED]> pisze:
> > Here's a revision of the numerical prelude.
> I like it!
I'd like to start using something like this
in which case I'd be very interested to
> know about it.
Incidentally, I went and read your paper just now. Very interesting.
You mentioned one problem came up that sounds interesting: to give a
nice member of the equivalence class of the principal type. This
boils down to picking a nic
Added SmallIntegral, SmallReal
* wrote skeleton VectorSpace, PowerSeries
* Added framework to make it run under hugs. There are some usability issues.
Any comments welcome!
Best,
Dylan Thurston
Revisiting the Numeric Classes
--
The Prelude for Haskell 98 offers a wel
onversion or calling a different function (or
declaring your own instance). Is this acceptable? I think it might
be: after all, you can't multiply a Double by an Integer either...
You then have one instance declaration per type, just as for the other
classes.
Opinions? I'm still not very happy.
Best,
Dylan Thurston
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe
,
> and SDL and UML for control parts. The result is likely to be a mess, in
> particular when these specifications are to be combined into full system
> descriptions.
My hope is that you wouldn't need a special version of Haskell.
Best,
Dylan Thurston
__
of Bool to denote the result of an
> attempted comparison.
I'm still agnostic on the Poset issue, but as an aside, let me mention
that "Maybe Bool" works very well as a trinary logical type. "liftM2
&&" does the correct trinary and, for instance.
> On Sun
On Mon, Feb 12, 2001 at 07:24:31AM +, Marcin 'Qrczak' Kowalczyk wrote:
> Sun, 11 Feb 2001 22:27:53 -0500, Dylan Thurston <[EMAIL PROTECTED]> pisze:
> > Reading this, it occurred to me that you could explictly declare an
> > instance of Powerful Integer Intege
an numeric class system described yet. Can you send me a
pointer to their class system, or just give me a description?
Does each operation really have its own class? That seems slightly
silly. Are the (/) and 'recip' equivalents independent, and
independent of (*) as well?
Be
cannot define, even within the revised Class system, all the
> common and useful operations on these types. This is the same situation
> as with Haskell as it stands. The question is whether the (IMHO)
> marginal increase in flexibility is worth the cost.
I believe that with this structure as base, the other common and
useful operations can easily be added on top.
But I should go ahead and do it.
Best,
Dylan Thurston
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe
> ...and Ord defines a partial order
> (and hence induces Eq) on a type.
I think that "Ord" should define a total ordering; it's certainly what
naive users would expect. I would define another class "Poset" with a
partial ordering.
> (e.g.
> instance Ord a => Eq a where
> x == y = x <= y && y <= x
> )
But to define <= in terms of meet and join you already need Eq!
x <= y === meet x y == y
Best,
Dylan Thurston
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe
nce contexts remain. Convertible a b
should indicate that a can safely be converted to b without losing any
information and maintaining relevant structure; from this point of
view, its use would be strictly limited. (But what's relevant?)
I'm still undecided here.
Best,
Dylan Thurston
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe
I've started writing up a more concrete proposal for what I'd like the
Prelude to look like in terms of numeric classes. Please find it
attached below. It's still a draft and rather incomplete, but please
let me know any comments, questions, or suggestions.
Best,
that the
ordering (from Ord) and the numeric structure (from Num) are
compatible.
Note also that we cannot require Eq to state laws (the '===' above);
consider the laws required for the Monad class to convince yourself.
Best,
Dylan Thurston
__
27;, 'rem', 'div', and 'mod'. For +, -, and * I can guess
what identities they should satisfy, but not for signum and abs.)
(Note that pointwise abs of functions yields a positive function, which
are not ordered but do have a sensible notion of max and min.)
Best,
d
'one', which do obviously fit (they are the additive and
multiplicative units):
fromInteger n | n < 0 = negate (fromInteger (-n))
fromInteger n = foldl (+) zero (repeat n one)
(Of course, one could use the algorithm in integer exponentiation to
make this efficient.)
Best,
Dy
On Fri, Feb 09, 2001 at 12:05:09PM -0500, Dylan Thurston wrote:
> On Thu, Feb 08, 2001 at 04:06:24AM +, Marcin 'Qrczak' Kowalczyk wrote:
> > You can put Num a in some instance's context, but you can't
> > put Convertible Integer a. It's because instan
You make some good arguments. Thanks. Let me ask about a few of them.
On Thu, Feb 08, 2001 at 04:06:24AM +, Marcin 'Qrczak' Kowalczyk wrote:
> Wed, 7 Feb 2001 15:43:59 -0500, Dylan Thurston <[EMAIL PROTECTED]> pisze:
>
> > class Convertible a b where
> >
gh really they should be part of a more general mechanism for
dealing with instances explicitly.
Agreed that they might not be useful enough.
Best,
Dylan Thurston
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe
no textual mention of class Foo in the
instance for Bar? Think about the case of a superclass with no methods;
wouldn't you want to allow automatic instances in this case?
One might even go further and allow a class to declare default methods
for a superclass:
Num class and redefined fromDouble, fromInt, etc.
Can't you just put "default ()" at the top of each module?
I suppose you still have the problem that a numeric literal "5" means
"Prelude.fromInteger 5". Can't you define your types to be instances
of Prelud
On Wed, Feb 07, 2001 at 01:57:41PM -0500, Dylan Thurston wrote:
> ... One point that has not been made: given a class
> setup like
>
> then naive users can continue to use (Num a) in contexts, and the same
> programs will continue to work.
I take that back. Instance declaratio
istorical: map already existed before Haskell
was powerful enough to type fmap, and the decision was not to affect
existing programs too much. Presumably Haskell 2 will have them
merged.
Best,
Dylan Thurston
___
Haskell-Cafe mailing lis
hat all types should by instances of
Eq and Show? Why are numeric types special?
Best,
Dylan Thurston
Footnotes:
[1] Except for the lack of abs and signum, which should be in some
other class. I have to think about their semantics before I can say
where they belong.
___
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe
75 matches
Mail list logo