For clarity, one trick that uses unsafePerformIO which you may have
seen posted on this list earlier today is the following way of
creating a globally visible IORef:
import Data.IORef
import System.IO.Unsafe
*** counter = unsafePerformIO $ newIORef 0 ***
next = do
modifyIORef counter
Hi John,
I just stumbled on this issue while trying to compile turbinado with
the haskell platform / ghc 6.10.4. I got past it by manually editing
back in the time definitions, but just wondering if there was an
official resolution. Thanks,
Warren
On Oct 13, 2009, at 6:48 AM, John
Hello michael,
Thursday, October 22, 2009, 4:59:43 AM, you wrote:
return () does the trick if another branch also returns ()
Thanks guys,
I understand what you're telling me, but have some nested IFs and
just want to fall through on one of the ELSES but then I end up with
two ELSES in a
aaa - newIORef ([]::[(Int,Int)])
writeIORef aaa [(1,1),(2,2),(3,3)]
then if i want to change aaa to [(1,1),(2,222),(3,3)] , what's the best way
?
re-write aaa is not permitted.
Sincerely!
--
View this message in context:
2009/10/22 zaxis z_a...@163.com:
aaa - newIORef ([]::[(Int,Int)])
writeIORef aaa [(1,1),(2,2),(3,3)]
then if i want to change aaa to [(1,1),(2,222),(3,3)] , what's the best way
?
re-write aaa is not permitted.
Why do you say that ? You can use again writeIORef of modifyIORef to
change
Hello zaxis,
Thursday, October 22, 2009, 11:28:14 AM, you wrote:
aaa - newIORef ([]::[(Int,Int)])
writeIORef aaa [(1,1),(2,2),(3,3)]
then if i want to change aaa to [(1,1),(2,222),(3,3)] , what's the best way
?
re-write aaa is not permitted.
it's the only way. in Haskell, you have
Bonjour café,
data ExprF r
= Add r r
| Sub r r
| Mul r r
| Div r r
| Num Int
This is a well-known pattern that for example allows nice notation of
morphisms. But what is it called? I've heard fixed-point view, open
datatypes and some others, but I'm curious where
2009/10/21 Gregory Crosswhite gcr...@phys.washington.edu:
And just because this has not been explicitly stated: it's not just for
aesthetic reasons that you couldn't do this with a pure function, but
because it violates the semantics and gets you the wrong result. So for
example, if you
Hello zaxis,
Thursday, October 22, 2009, 11:28:14 AM, you wrote:
then if i want to change aaa to [(1,1),(2,222),(3,3)] , what's the best way
... well, anyway what you are doing isn't very haskellish. it may be
considered as advanced topic but basically, best way to compute
something in Haskell
Hi Martijn,
On Oct 22, 2009, at 9:47 AM, Martijn van Steenbergen wrote:
I've heard fixed-point view, open datatypes and some others, but I'm
curious where this pattern comes up in literature and what it is
called there.
Tim Sheard and Emir Pasalic call this technique two-level types in
I've heard fixed-point view, open datatypes and some others, but I'm
curious where this pattern comes up in literature and what it is called
there.
Tim Sheard and Emir Pasalic call this technique two-level types in their
JFP'04 paper Two-Level Types and Parameterized Modules:
Hello!
I have a very stupid question. Sorry for that!
Is there the eval function like in imperative languages?
I'd like to write an application which has to be compiled to exec file. It is
neccessary to performe some additional procedures which are unknown at the
moment of the compilition.
Waldemar Biernacki wrote:
Is there the eval function like in imperative languages?
You mean like in interpreted languages?
I'd like to write an application which has to be compiled to exec file. It is
neccessary to performe some additional procedures which are unknown at the
moment of the
Hi,
I am trying to use NetSnmp to get some information from my switch.
And I met this problem.
After initialize, I used snmpWalk to get some information, and
dealed with it. Everything is fine. Then I sleep for 5 mins. SnmpWalk
again. But this time, all asnValues were unsupported format, which
value - readIORef aaa
writeIORef aaa (f value)
then aaa will *point to* a new value. The original value will be Garbage
Collected, right ?
BTW,
Is [(1,1),(2,2),(3,3)] been regarded as a hash ? If not, what is the best
way to change it to [(1,1),(2,),(3,3)] in function `f` ?
Bulat
zaxis z_a...@163.com writes:
value - readIORef aaa
writeIORef aaa (f value)
then aaa will *point to* a new value.
Exactly. That's what IORefs are, references pointing to contents that
can be changed in the IO monad.
The original value will be Garbage Collected, right ?
Yes, unless
Hello zaxis,
Thursday, October 22, 2009, 1:03:21 PM, you wrote:
value - readIORef aaa
writeIORef aaa (f value)
then aaa will *point to* a new value. The original value will be Garbage
Collected, right ?
yes, exactly
BTW,
Is [(1,1),(2,2),(3,3)] been regarded as a hash ? If not, what is
f xs = (2,) : filter ((/=2) . fst) xs
It works but not general as `f` still needs to change other value according
to the KEY.
Maybe Data.List will supply what i need.
Ketil Malde-5 wrote:
zaxis z_a...@163.com writes:
value - readIORef aaa
writeIORef aaa (f value)
then aaa will
Hello zaxis,
Thursday, October 22, 2009, 1:03:21 PM, you wrote:
Is [(1,1),(2,2),(3,3)] been regarded as a hash ? If not, what is the best
way to change it to [(1,1),(2,),(3,3)] in function `f` ?
f = map (\x@(a,b) - if a==2 then (a,) else x)
or
f xs = [(a, if a==2 then else b) |
2009/10/22 zaxis z_a...@163.com:
f xs = (2,) : filter ((/=2) . fst) xs
It works but not general as `f` still needs to change other value according
to the KEY.
Maybe Data.List will supply what i need.
I don't think Data.List has what you want as-is. The above code is
generalized simply:
replace k v xs = (k,v) : filter ((/=v) . fst) xs
Great ! thanks you very much
minh thu wrote:
2009/10/22 zaxis z_a...@163.com:
f xs = (2,) : filter ((/=2) . fst) xs
It works but not general as `f` still needs to change other value
according
to the KEY.
Maybe Data.List will supply
2009/10/22 zaxis z_a...@163.com:
replace k v xs = (k,v) : filter ((/=v) . fst) xs
Great ! thanks you very much
I'm not sure why you're so much happy:
Assume some function defined as follow:
foo a b c = e x y z a b c
where x = some constant
y = some other constant
z
I'll see when I can get to fixing it, hopefully it won't be long.
Two fairly easy bugs to fix, darcs repo is updated. It's probably high
time I did another release, stay tuned.
I just can't believe I didn't have a single class declaration in my
test suite to catch the first one! Or that no one
Thank you Martijn!
You mean like in interpreted languages?
Naturally! My mistake.
I'd like to write an application which has to be compiled to exec file. It
is neccessary to performe some additional procedures which are unknown at
the moment of the compilition.
You could use the GHC
Hi,
On Thursday 22 October 2009 09:47:32 Martijn van Steenbergen wrote:
Bonjour café,
data ExprF r
= Add r r
| Sub r r
| Mul r r
| Div r r
| Num Int
This is a well-known pattern that for example allows nice notation of
morphisms. But what is it called?
Conor also calls these functors:
http://strictlypositive.org/slicing-jpgs/
The fixpoint construction builds recursive types (think trees) from
functors by identifying superstructures with substructures: each node
frames its children.
___
Haskell-Cafe
Obviously you are modelling the datatype
-- data Expr = Add Expr Expr | Sub Expr Expr | Mul Expr Expr | Div
Expr Expr | Num Int
You already have ExprF, and now you need to throw in Fix
newtype Fix f = In (f(Fix f))
in order to be able to build Expr like terms.
type Expr' = Fix ExprF
add
Is this on hackage yet, or should we just consult the mecha link on your
home page?
On Wed, Oct 21, 2009 at 11:42 PM, Tom Hawkins tomahawk...@gmail.com wrote:
A few months ago, I started toying with a few alternative pump designs
to power our hydraulic hybrids. After not being able to secure
Hackage link: http://hackage.haskell.org/package/mecha/
2009/10/22 John Van Enk vane...@gmail.com:
Is this on hackage yet, or should we just consult the mecha link on your
home page?
On Wed, Oct 21, 2009 at 11:42 PM, Tom Hawkins tomahawk...@gmail.com wrote:
A few months ago, I started
On Sat, 2009-10-10 at 20:12 +0200, Ben Franksen wrote:
Since 'some' is defined recursively, this creates an infinite production for
numbers that you can neither print nor otherwise analyse in finite time.
Yes, sorry, I should have been more careful there. One has to be careful
to handle EDSLs
On Sun, 2009-10-11 at 21:54 +0200, Ben Franksen wrote:
Ben Franksen wrote:
Next thing I'll try is to transform such a grammar into an actual
parser...
Which I also managed to get working. However, this exposed yet another
problem I am not sure how to solve.
Another option is to not use a
On Tue, 2009-10-13 at 13:28 +0100, Nils Anders Danielsson wrote:
On 2009-10-07 17:29, Robert Atkey wrote:
A deep embedding of a parsing DSL (really a context-sensitive grammar
DSL) would look something like the following. I think I saw something
like this in the Agda2 code somewhere, but I
This question on StackOverflow asked about how to find the largest 100
items in a very long list:
http://stackoverflow.com/questions/1602998/fastest-way-to-obtain-the-largest-x-numbers-from-a-very-large-unsorted-list/1603198#1603198
I replied that you could do it with something like this (but
- Sorry for the late reply on this, I actually sent it last night before I
went to bed but accidentally sent it only to Bulat, re-sending it now for
the entire list -
As Bulat said, it sounds like you're not fully understanding functional
programming. You really should read one of the better
I am trying to use NetSnmp to get some information from my switch.
And I met this problem.
After initialize, I used snmpWalk to get some information, and
dealed with it. Everything is fine. Then I sleep for 5 mins. SnmpWalk
again. But this time, all asnValues were unsupported format,
Thank you for the additional explanation, but it isn't clear that what
you have added is inconsistent with my explanation.
The point I was trying to make is that in an impure/imperative world,
you may assume that a function is called every time that you use it.
However, in a pure world
On 22/10/09 15:31, Paul Johnson wrote:
takeLargest k = take k . sort
Because sort is lazily evaluated this only does enough sorting to
find the first k elements. I guess the complexity is something like
O(n*k*log(k)).
Correction: O(n*log(k))
You may also want to look at Dyre. It does dynamic recompilation of
source files. Depending on your application, hint may not be what you
need. Eg, if you're trying to build something like lambdabot's
interpreter, then Hint is probably on the right track, if you just
want to use
Hi,
Do you think we could have the range of sizes for Int* and Word*
expanded to allow also 128 and 256 bits sizes?
My reason is that I have a long standing issue trying to bind to
C numerical libraries using complex numbers, as those are usually
structs passed by value. See this from GNU GSL:
For clarity, one trick that uses unsafePerformIO which you may have seen
posted on this list earlier today is the following way of creating a
globally visible IORef:
import Data.IORef
import System.IO.Unsafe
*** counter = unsafePerformIO $ newIORef 0 ***
next = do
modifyIORef counter
On Wed, Oct 21, 2009 at 9:44 PM, Wouter Swierstra w...@cs.nott.ac.uk wrote:
The only change with the previous version has been to add irrefutable
patterns to several function definitions. This is rather delicate design
decision: too many irrefutable patterns could result in thunks not being
On Thu, Oct 22, 2009 at 2:23 AM, Gregory Crosswhite
gcr...@phys.washington.edu wrote:
For clarity, one trick that uses unsafePerformIO which you may have seen
posted on this list earlier today is the following way of creating a
globally visible IORef:
import Data.IORef
import
jhc potentially has Word128, but it only has meaning when __int128_t is
defined for a given target. (gcc + x86_64 for instance). What would
something like Word256 mean? As in, the only reason to supply something
like Word128 in the compiler is so FFI calls involving __int128_t will
work, without a
Yes, I was once taught that Every time you use unsafePerformIO, God
kills a kitten, so every time I consider using it I first ask
myself: is this really worth an innocent kitten's life?
Cheers,
Greg
On Oct 22, 2009, at 11:32 AM, David Menendez wrote:
On Thu, Oct 22, 2009 at 2:23 AM,
In any case, I need it fixed before I can work on haskell-mode.
Preferably by migrating haskell-mode over to cvs. :-)
You mean migrating to DaRCS? That would be appreciated, yes.
Um, yes.
I can get the revision history into darcs pretty easily, such as it
is, assuming cvs.haskell.org comes
Well, I apologize for starting this whole thread which involves so many dead
kittens :( I was just trying to help answer a question :)
I guess I assumed too much.. that someone would think to be careful when
using a function with the word 'unsafe' in it...
So, be warned, all Haskellers! Be
Hi,
I just wanted to say that I'd be really happy to see haskell-mode in
code.haskell.org. I think it will make it easier for people to hack on
it.
Thanks,
Johan
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
Paul Johnson p...@cogito.org.uk writes:
takeLargest k = take k . sort
But of equal practical interest is the space complexity. The optimum
algorithm is to take the first k items, sort them, and then iterate
through the remaining items by adding each item to the sorted list and
then
Unless of course you use a GHC RULE to rewrite the RHS into the LHS,
which should always be a valid transformation.
Ketil Malde wrote:
Paul Johnson p...@cogito.org.uk writes:
takeLargest k = take k . sort
But of equal practical interest is the space complexity. The optimum
algorithm is
Gregory == Gregory Crosswhite gcr...@phys.washington.edu writes:
Gregory Yes, I was once taught that Every time you use
Gregory unsafePerformIO, God kills a kitten, so every time I
Gregory consider using it I first ask myself: is this really
Gregory worth an innocent kitten's
Johan Tibell wrote:
I just wanted to say that I'd be really happy to see haskell-mode in
code.haskell.org. I think it will make it easier for people to hack on
it.
Another option is http://patch-tag.com/
Cheers
Ben
___
Haskell-Cafe mailing list
On Thu, Oct 22, 2009 at 9:02 PM, Stefan Monnier
monn...@iro.umontreal.ca wrote:
Can you show me the patches?
Sure, once cvs.haskell.org comes back up. :P
It's mostly newer variants of haskell-indentation.el, with a little
homegrown code. Well, you can see what I'm currently running at
Colin Paul Adams wrote:
Gregory == Gregory Crosswhite gcr...@phys.washington.edu writes:
Gregory Yes, I was once taught that Every time you use
Gregory unsafePerformIO, God kills a kitten, so every time I
Gregory consider using it I first ask myself: is this really
Gregory
On Thu, Oct 22, 2009 at 1:32 PM, David Menendez d...@zednenem.com wrote:
On Thu, Oct 22, 2009 at 2:23 AM, Gregory Crosswhite
gcr...@phys.washington.edu wrote:
For clarity, one trick that uses unsafePerformIO which you may have seen
posted on this list earlier today is the following way of
Hi,
The box is just 32bit with linux. But anyway, I will try out the
update. Thanks.
On Thu, Oct 22, 2009 at 11:35 PM, John Dorsey hask...@colquitt.org wrote:
I am trying to use NetSnmp to get some information from my switch.
And I met this problem.
After initialize, I used snmpWalk to
It works pretty well.
On Fri, Oct 23, 2009 at 7:24 AM, Magicloud Magiclouds
magicloud.magiclo...@gmail.com wrote:
Hi,
The box is just 32bit with linux. But anyway, I will try out the
update. Thanks.
On Thu, Oct 22, 2009 at 11:35 PM, John Dorsey hask...@colquitt.org wrote:
I am trying to
Martijn van Steenbergen wrote:
Bonjour café,
data ExprF r
= Add r r
| Sub r r
| Mul r r
| Div r r
| Num Int
This is a well-known pattern that for example allows nice notation of
morphisms. But what is it called? I've heard fixed-point view, open
datatypes and some
57 matches
Mail list logo