Hi,
On 06.06.2007, at 07:00, Phlex wrote:
So here is one more question :
Let's say I want unique System names across the Universe ... that
would mean i need to have a Data.Map in the Universe, with Name
keys and System values. Since all data are values instead of
references, would i end
Christopher Lane Hinson wrote:
Where InsidenessMap a b c represents a relationship where b's are
inside a's, and b's have a state of c. Then, you need to declare a
separate InsidenessMap for each possible relationship, but this
ensures that you'll never put a galaxy inside a solar system.
Phlex wrote:
Christopher Lane Hinson wrote:
Where InsidenessMap a b c represents a relationship where b's are
inside a's, and b's have a state of c. Then, you need to declare a
separate InsidenessMap for each possible relationship, but this
ensures that you'll never put a galaxy inside a
Phlex wrote:
Ketil Malde wrote:
Identity can be emulated by relatively straightforward means: store all
planets in a Map indexed by something that is useful as an identifier
(i.e. stays constant and is unique), and have a Galaxy keep a list of
identifiers.
So basically you guys are
apfelmus wrote:
Phlex wrote:
Ketil Malde wrote:
Is the relational model a better fit than the object model for
functional programming ?
Well, not really. I mean, if the problem is indeed to store all known
planets in the universe, then it's indeed a database in nature and you
Arie Peterson writes:
There are two things one typically wants to do when working with a
substructure of some larger data structure: (1) extract the
substructure; and (2) change the larger structure by acting on the
substructure. A 'Ref cx t' encodes both of these functions (for a
| data Ref cx t
| = Ref
| {
| select :: cx - t
| , update :: (t - t) - cx - cx
| }
|
| A Ref is a bit like a typed and composable incarnation of apfelmus's
| indices, or a wrapper around Tillmann's change* functions, containing
| not only a setter but also the accompanying
David Menendez wrote:
| That's a neat idiom. I wonder how far one could usefully generalize it.
|
| For example,
|
| type Ref cx t = forall f. Functor f = (t - f t) - cx - f cx
|
| newtype Id a = Id { unId :: a }
| instance Functor Id where fmap f = Id . f . unId
|
| newtype K t a
Phlex wrote:
Donald Bruce Stewart wrote:
Imagine updating a node in a tree by just detaching and reattaching a
pointer.
[1] [1]
/ \ / \
[2] [3] update node 5 [2] [3]
/ \ with value 7 / \
[4] [5]
apfelmus:
Phlex wrote:
Donald Bruce Stewart wrote:
Imagine updating a node in a tree by just detaching and reattaching a
pointer.
[1] [1]
/ \ / \
[2] [3] update node 5 [2] [3]
/ \ with value 7 / \
apfelmus wrote:
Phlex wrote:
Donald Bruce Stewart wrote:
Yes and no. The point is that if you can't automate it, you have to code
it by hand anyway which constitutes most of the hairiness. But I know
what you mean and there's a nice way to do that with multi-parameter
type classes.
apfelmus wrote:
{-# OPTIONS_GHC -fglasgow-exts -#}
import Prelude hiding (lookup)
class Map map key a | map key - a where
lookup :: key - map - Maybe a
adjust :: (a - a) - key - map - map
instance (Map m k m', Map m' k' a) = Map m (k,k') a where
Let's say i have a deep nested data structure.
Universe containing galaxies, containing solar systems, containing
planets, containing countries, containing inhabitants, containing
...whatever.
Oh. I had /exactly/ this problem. If you use separate types (i.e. a
newtyped integer, acting
You could also use 'compositional functional references'. These are
introduced in the paper A Functional Programming Technique for Forms in
Graphical User Interfaces by Sander Evers, Peter Achten and Jan Kuper.
=== Introduction ===
There are two things one typically wants to do when working with
(Sorry to break the thread, but mutt somehow managed to eat the message
I'm replying to...)
Arie Peterson:
You could also use 'compositional functional references'. These are
introduced in the paper A Functional Programming Technique for Forms in
Graphical User Interfaces by Sander Evers,
Hi
You could also use 'compositional functional references'. These are
introduced in the paper A Functional Programming Technique for Forms in
Graphical User Interfaces by Sander Evers, Peter Achten and Jan Kuper.
I've written a template haskell function to derive Refs from a data
16 matches
Mail list logo