[Haskell-cafe] Ambiguous types for collection keys

2006-04-12 Thread Scott Weeks
Hello everyone, I've been banging my head against my desk a bit so I figured it's time to ask for help :-) I'm writing an application that persists data to disk. The hard stuff is pretty much done (binary serialisation, etc...) The big stumbling block is that I want users to be able to

[Haskell-cafe] coherence when overlapping?

2006-04-12 Thread william kim
Hi All, One important property of type class dictionary translation is coherence which basically says that two typing derivations for the same term at the same type in the same environment must be equivalent. This definition is established with the assumption of non-overlapping. In the GHC

Re: [Haskell-cafe] web servers

2006-04-12 Thread Graham Klyne
I'm interested, but I don't have the time to look right now (or in the next couple of months, as far as I can see). What would really interest me is a system that can provide the functionality of the Python packages I currently use (TurboGears [1], of which the web server/controller component is

Re: [Haskell-cafe] Ambiguous types for collection keys

2006-04-12 Thread ihope
On 4/12/06, Scott Weeks [EMAIL PROTECTED] wrote: Hello everyone, I've been banging my head against my desk a bit so I figured it's time to ask for help :-) When a user queries I have to read the input from IO and then somehow cast the key/index type without angering the type checker. If I

Re: [Haskell-cafe] Counting bits: Sanity Check

2006-04-12 Thread Robert Dockins
On Apr 11, 2006, at 10:09 AM, David F. Place wrote: Hi All, Since it seems that real applications need more than just union, intersection, difference and complement to be fast to make EnumSet useful, I've been looking into the less naive approaches to the other things. In particular,

RE: [Haskell-cafe] coherence when overlapping?

2006-04-12 Thread Simon Peyton-Jones
| In the GHC documentation which describes the extension of overlapping | instances, an example similar to the following is given. | | class C a where |f:a - a | instance C Int where |f=e1 | instance C a where |f=e2 | | let g x = f x | in g 1 | | In this case GHC takes an

Re: [Haskell-cafe] Ambiguous types for collection keys

2006-04-12 Thread Scott Weeks
Well, if you get an ambiguous type variable error, you probably (I think) need to add some type annotations. For example: class Foo a where foo :: a bar :: a - String Evaluating bar foo will result in an error, but bar (foo :: Integer) will work just fine. The

Re: [Haskell-cafe] Ambiguous types for collection keys

2006-04-12 Thread Robert Dockins
On Apr 12, 2006, at 3:18 PM, Scott Weeks wrote: Well, if you get an ambiguous type variable error, you probably (I think) need to add some type annotations. For example: class Foo a where foo :: a bar :: a - String Evaluating bar foo will result in an error, but bar (foo :: Integer)

Re: [Haskell-cafe] Counting bits: Sanity Check

2006-04-12 Thread Daniel McAllansmith
On Wednesday 12 April 2006 02:09, David F. Place wrote: If you'd like to give it a whirl on your fancy modern computers, Averages of user time for three runs on an Athlon64 running 64bit linux: kern0.29700 ones32 0.30733 table32 0.37333 table 0.38400 I ran a whole lot more of kern and

Re: [Haskell-cafe] Ambiguous types for collection keys

2006-04-12 Thread Brandon Moore
Robert Dockins wrote: On Apr 12, 2006, at 3:18 PM, Scott Weeks wrote: Well, if you get an ambiguous type variable error, you probably (I think) need to add some type annotations. For example: class Foo a where foo :: a bar :: a - String Evaluating bar foo will result in an error,

Re: [Haskell-cafe] Ambiguous types for collection keys

2006-04-12 Thread Scott Weeks
Or carry an instance in along with a type parameter, using existentials or GADT. Brandon Moore Do you know of an example that would apply to my situation? I think I neglected to state part of my problem. I am storing the root nodes of btree indexes in a heterogeneous list using Typeable.

Re: [Haskell-cafe] Counting bits: Sanity Check

2006-04-12 Thread David F. Place
On Apr 12, 2006, at 3:30 PM, Daniel McAllansmith wrote: Averages of user time for three runs on an Athlon64 running 64bit linux: kern0.29700 ones32 0.30733 table32 0.37333 table 0.38400 I ran a whole lot more of kern and ones32... kern was consistently faster than ones32.

Re: [Haskell-cafe] Ambiguous types for collection keys

2006-04-12 Thread Robert Dockins
On Apr 12, 2006, at 4:09 PM, Scott Weeks wrote: Or carry an instance in along with a type parameter, using existentials or GADT. Brandon Moore Do you know of an example that would apply to my situation? I think I neglected to state part of my problem. I am storing the root nodes of

Re: [Haskell-cafe] Counting bits: Sanity Check

2006-04-12 Thread Daniel McAllansmith
On Thursday 13 April 2006 08:55, David F. Place wrote: On Apr 12, 2006, at 3:30 PM, Daniel McAllansmith wrote: Averages of user time for three runs on an Athlon64 running 64bit linux: kern0.29700 ones32 0.30733 table32 0.37333 table 0.38400 I ran a whole

Re: [Haskell-cafe] Counting bits: Sanity Check

2006-04-12 Thread David F. Place
On Apr 12, 2006, at 5:21 PM, Daniel McAllansmith wrote: Averages of user time of five runs on an Athlon64 running 64bit linux: 64 0.1974 kern0.2980 ones32 0.3240 table32 0.3754 table 0.3798 64 looks to be a good bit faster. You didn't change anything in the ones32 algorithm did

Re: [Haskell-cafe] Ambiguous types for collection keys

2006-04-12 Thread Scott Weeks
You are trying to assign two distinct types to dynFoo; that's a no-no. You need to move the usage of the polymorphic function out of the let so that the use at each distinct type doesn't get unified. {-# OPTIONS -fglasgow-exts #-} import Data.Dynamic data Foo a = FVal a

Re: [Haskell-cafe] web servers

2006-04-12 Thread Daniel McAllansmith
On Wednesday 12 April 2006 22:52, Graham Klyne wrote: I'm interested, but I don't have the time to look right now (or in the next couple of months, as far as I can see). What would really interest me is a system that can provide the functionality of the Python packages I currently use

[Haskell-cafe] Announcing Halfs, a Haskell Filesystem

2006-04-12 Thread Isaac Jones
Halfs is a filesystem implemented in the functional programming language Haskell. Halfs can be mounted and used like any other Linux filesystem, or used as a library. Halfs is a fork (and a port) of the filesystem developed by Galois Connections. We've created a virtual machine to make using

[Haskell-cafe] Fundeps: I feel dumb

2006-04-12 Thread Creighton Hogg
Hi, So I'm trying the fun-deps example from http://www.haskell.org/hawiki/FunDeps and seeing if I can use it, but I can't really get things to work the way I want. The code follows below, and the error I get if I try to multiply 10 * (vector 10 [0..9]) is No instance for (MatrixProduct a (Vec

RE: [Haskell-cafe] coherence when overlapping?

2006-04-12 Thread william kim
Thank you Simon. But I am still confused by the exact definition of coherence in the case of overlapping. Does the standard coherence theorem apply? If yes, how? If no, is there a theorem? Is there any write-up on this? Thanks. --william From: Simon Peyton-Jones [EMAIL PROTECTED] To:

[Haskell-cafe] Re: Fundeps: I feel dumb

2006-04-12 Thread oleg
Creighton Hogg wrote: No instance for (MatrixProduct a (Vec b) c) arising from use of `*' at interactive:1:3-5 Probable fix: add an instance declaration for (MatrixProduct a (Vec b) c) In the definition of `it': it = 10 * (vector 10 ([0 .. 9])) Let us look at the

[Haskell-cafe] Re: coherence when overlapping?

2006-04-12 Thread oleg
But I am still confused by the exact definition of coherence in the case of overlapping. Does the standard coherence theorem apply? If yes, how? If no, is there a theorem? Yes, the is, by Martin Sulzmann et al, the Theory of overloading (the journal version)