How does pattern matching work with HList?
I would like to pass a HList to a function and only match if a
certain field had a certain value.
On Jan 6, 2006, at 7:14 AM, [EMAIL PROTECTED] wrote:
*Test :t accessor
accessor :: (HasField l r v) = r - l - v
--
Joel Reymont wrote:
How does pattern matching work with HList?
I would like to pass a HList to a function and only match if a
certain field had a certain value.
The code below defines the function foo that accepts a record and
yields one value if the field PtX of the record has the value 0.
This change solves the problem that different records in a single
namespace cannot share field names in a simple manner.
As mentioned elsewhere, you'd also need to remove the functional update
feature to fix this namespace problem.
In order to allow the writing of records code with is both
David Roundy wrote:
The only solution I can imagine
would be to implement a class for each field name. i.e. the only reasonble
type of f I can imagine is something like
f :: Integral i, RecordHasField_foo i r = r - r
But that's a very complicated solution, and once one implemented that
On Jan 4, 2006, at 2:25 AM, Dylan Thurston wrote:
On Tue, Jan 03, 2006 at 02:41:40PM -0800, Ashley Yakeley wrote:
David Roundy wrote:
On Mon, Jan 02, 2006 at 04:23:32PM -0800, Ashley Yakeley wrote:
One open question (in my mind) would be whether we'd allow
data Foo = FooInt { foo :: Int }
On Wed, Jan 04, 2006 at 11:53:59AM +0100, Ulf Norell wrote:
On Jan 4, 2006, at 2:25 AM, Dylan Thurston wrote:
On Tue, Jan 03, 2006 at 02:41:40PM -0800, Ashley Yakeley wrote:
David Roundy wrote:
On Mon, Jan 02, 2006 at 04:23:32PM -0800, Ashley Yakeley wrote:
One open question (in my mind)
On 2006-01-02, David Roundy [EMAIL PROTECTED] wrote:
My proposal is simply to remove the automatic declaration of accessor
functions. In Haskell 98,
data FooBar = Foo { foo :: Int } | FooBar = { foo :: Int, bar :: Int }
I would find this to be incredibly annoying. The fact that these
On Wed, Jan 04, 2006 at 02:17:27PM +, John Goerzen wrote:
On 2006-01-02, David Roundy [EMAIL PROTECTED] wrote:
My proposal is simply to remove the automatic declaration of accessor
functions. In Haskell 98,
data FooBar = Foo { foo :: Int } | FooBar = { foo :: Int, bar :: Int }
I
On 2006-01-04, David Roundy [EMAIL PROTECTED] wrote:
On Wed, Jan 04, 2006 at 02:17:27PM +, John Goerzen wrote:
Haskell 98 already requires you to code up set* functions (provided you
want them), so I'd only be doubling the amount of work you need to do. If
you can get by with the existing
Hello,
On 1/4/06, David Roundy [EMAIL PROTECTED] wrote:
What happens to record updates?
setFoo x r = r { foo = x }
Or is the proposal to remove updates as well?
Ah, good point, I hadn't thought about that. My proposal was to keep
record updates which would indeed mean that we'd need
On Wed, Jan 04, 2006 at 08:55:39AM -0500, David Roundy wrote:
Ah, good point, I hadn't thought about that. My proposal was to keep
record updates which would indeed mean that we'd need to require that all
foos in a given data type have the same type. Which I don't think is a
bad thing
David Roundy wrote:
On Mon, Jan 02, 2006 at 04:23:32PM -0800, Ashley Yakeley wrote:
One open question (in my mind) would be whether we'd allow
data Foo = FooInt { foo :: Int } | FooChar { foo :: Char }
In the new system, there's no reason this need be illegal.
How would this behave?
data
On Tue, Jan 03, 2006 at 02:41:40PM -0800, Ashley Yakeley wrote:
David Roundy wrote:
On Mon, Jan 02, 2006 at 04:23:32PM -0800, Ashley Yakeley wrote:
One open question (in my mind) would be whether we'd allow
data Foo = FooInt { foo :: Int } | FooChar { foo :: Char }
In the new system,
In article [EMAIL PROTECTED],
David Roundy [EMAIL PROTECTED] wrote:
One open question (in my mind) would be whether we'd allow
data Foo = FooInt { foo :: Int } | FooChar { foo :: Char }
In the new system, there's no reason this need be illegal.
How would this behave?
data Foo a b =
14 matches
Mail list logo