Re: [Haskell-cafe] Type trickery

2011-03-16 Thread wren ng thornton
On 3/16/11 9:52 AM, Andrew Coppin wrote: Hmm, yes. That will work, but I wonder if there's some way of doing this that doesn't limit the scope of the container to one single span of code... You can write helper functions which take containers as argument by parameterizing these helper functions

Re: [Haskell-cafe] Type trickery

2011-03-16 Thread Luke Palmer
On Wed, Mar 16, 2011 at 7:52 AM, Andrew Coppin wrote: >>> Hmm, yes. That will work, but I wonder if there's some way of doing this >>> that doesn't limit the scope of the container to one single span of >>> code... >> >> You can write helper functions which take containers as argument by >> parame

Re: [Haskell-cafe] Type trickery

2011-03-16 Thread Lauri Alanko
On Wed, Mar 16, 2011 at 12:05:56PM +, Andrew Coppin wrote: > >withContainer ∷ (∀ s. Container s → α) → α > Hmm, yes. That will work, but I wonder if there's some way of doing > this that doesn't limit the scope of the container to one single > span of code... You can just pack the container i

Re: [Haskell-cafe] Type trickery

2011-03-16 Thread Andrew Coppin
Hmm, yes. That will work, but I wonder if there's some way of doing this that doesn't limit the scope of the container to one single span of code... You can write helper functions which take containers as argument by parameterizing these helper functions over s: takesTwoContainers :: Container

Re: [Haskell-cafe] Type trickery

2011-03-16 Thread Tillmann Rendel
Hi Andrew, Andrew Coppin wrote: You could define a function: withContainer ∷ (∀ s. Container s → α) → α which creates a container, parameterizes it with an 's' that is only scoped over the continuation and applies the continuation to the created container. Hmm, yes. That will work, but I won

Re: [Haskell-cafe] Type trickery

2011-03-16 Thread Miguel Mitrofanov
I fail to see how does it limit the scope. 16.03.2011 15:05, Andrew Coppin пишет: You could define a function: withContainer ∷ (∀ s. Container s → α) → α which creates a container, parameterizes it with an 's' that is only scoped over the continuation and applies the continuation to the creat

Re: [Haskell-cafe] Type trickery

2011-03-16 Thread Andrew Coppin
You could define a function: withContainer ∷ (∀ s. Container s → α) → α which creates a container, parameterizes it with an 's' that is only scoped over the continuation and applies the continuation to the created container. Hmm, yes. That will work, but I wonder if there's some way of doing t

Re: [Haskell-cafe] Type trickery

2011-03-16 Thread Bas van Dijk
On 16 March 2011 11:31, Andrew Coppin wrote: > The well-known ST monad uses an ingenious hack to make it impossible for > distinct ST computations to interact with each other. > > Is there a way to do something similar so that I can create "cursors" that > reference a (mutable) container, and then

[Haskell-cafe] Type trickery

2011-03-16 Thread Andrew Coppin
The well-known ST monad uses an ingenious hack to make it impossible for distinct ST computations to interact with each other. Is there a way to do something similar so that I can create "cursors" that reference a (mutable) container, and then write a function that takes two cursor arguments w

Re: [Haskell-cafe] type trickery

2007-12-20 Thread Luke Palmer
On Dec 20, 2007 9:34 AM, Adrian Neumann <[EMAIL PROTECTED]> wrote: > Hello haskell-cafe! > > After making "data Number = Zero | Succ Number" an instance of > Integral, I wondered how I could do the same with galois fields. So > starting with Z mod p, I figured I'd need something like this > > data

[Haskell-cafe] type trickery

2007-12-20 Thread Adrian Neumann
Hello haskell-cafe! After making "data Number = Zero | Succ Number" an instance of Integral, I wondered how I could do the same with galois fields. So starting with Z mod p, I figured I'd need something like this data GF = GF Integer Integer so that each element of the finite field would r