Thank you so much. I was always confused by what exception should I catch.
On Thu, Jan 12, 2012 at 3:49 PM, Gregory Crosswhite
wrote:
> On 01/12/12 16:58, Magicloud Magiclouds wrote:
>> Yes, that is a problem. But consider my PS in original mail, I have no
>> idea what exception should I catch. W
On 01/12/12 16:58, Magicloud Magiclouds wrote:
> Yes, that is a problem. But consider my PS in original mail, I have no
> idea what exception should I catch. Where could I get that
> information?
In my experience, exceptions fall into three categories.
First, when performing IO, some functions th
On 01/12/12 17:23, Gregory Crosswhite wrote:
> Indeed, and in fact this situation is a very natural occurrence whenever
> you are writing code that takes an arbitrary IO action, executes it, and
> then returns either the result or the exception that it threw. The code
> that I last used for this to
On 01/12/12 17:07, Simon Hengel wrote:
> I think there are situation when it is justified to catch almost all
> exceptions. And people do that a lot, which often leads to ctrl-c not
> properly working (e.g. we had this in HUnit before 1.2.4.2).
Indeed, and in fact this situation is a very natura
On 01/12/12 16:49, Ivan Lazar Miljenovic wrote:
> But it is usually recommended that you *don't* do this, as it even
> captures Ctrl-c invocations:
Is that true in all threads, or just in the main thread?
Cheers,
Greg
___
Haskell-Cafe mailing list
Haske
> > Use SomeException for the type, as it is the base of the exception
> > hierarchy.
>
> But it is usually recommended that you *don't* do this, as it even
> captures Ctrl-c invocations:
I think there are situation when it is justified to catch almost all
exceptions. And people do that a lot, w
Yes, that is a problem. But consider my PS in original mail, I have no
idea what exception should I catch. Where could I get that
information?
On Thu, Jan 12, 2012 at 2:49 PM, Ivan Lazar Miljenovic
wrote:
> On 12 January 2012 17:34, Gregory Crosswhite wrote:
>> On 01/12/12 13:03, Magicloud Magic
On 12 January 2012 17:34, Gregory Crosswhite wrote:
> On 01/12/12 13:03, Magicloud Magiclouds wrote:
>> Hi,
>> With Prelude.catch, I could write "catch () $ \_ -> return Nothing".
>> But with Control.Exception.catch, I must specify a type for the "_".
>> What should I do?
>
> Use SomeException f
Hi all,
I have an idea about type classes that I have been experimenting. It
appears to be a generalization to Haskell’s type classes and seems to
be doable. It seems to related the three ideas: type classes, implicit
parameters, and (typed) dynamic scoping. But I don't know whether it
is good or
On 01/12/12 13:03, Magicloud Magiclouds wrote:
> Hi,
> With Prelude.catch, I could write "catch () $ \_ -> return Nothing".
> But with Control.Exception.catch, I must specify a type for the "_".
> What should I do?
Use SomeException for the type, as it is the base of the exception
hierarchy.
(A
Hi,
With Prelude.catch, I could write "catch () $ \_ -> return Nothing".
But with Control.Exception.catch, I must specify a type for the "_".
What should I do?
PS: In Java document, a function declaration would tell us both the
incoming args and outgoing, AND what exceptions would it throw. But
Felipe Almeida Lessa wrote:
> What about inverting which thread gets to do what?
>
> _ <- resourceForkIO $ sourceHandle hsock $$ sinkHandle stdout
> sourceHandle stdin $$ sinkHandle hsock
> release releaseSock
Thats an interesting idea. Unfortunately this doesn't work correctly
in that if
On Wed, Jan 11, 2012 at 10:28 PM, Erik de Castro Lopo
wrote:
>
> Thanks for the input Felipe.
>
> Felipe Almeida Lessa wrote:
>
>> On line 29, instead of
>>
>> liftIO $ do
>> mapM_ ...
>> runResourceT $ do
>
> Well that was because that whole block needs to run in IO.
My point is that t
A new solution that drops two 'runResourceT' calls:
telnet :: String -> Int -> IO ()
telnet host port = runResourceT $ do
(releaseSock, hsock) <- with (connectTo host $ PortNumber $ fromIntegral
port) hClose
liftIO $ mapM_ (\h -> hSetBuffering h LineBuffering) [ stdin, stdout, hsock
]
Thanks for the input Felipe.
Felipe Almeida Lessa wrote:
> On line 29, instead of
>
> liftIO $ do
> mapM_ ...
> runResourceT $ do
Well that was because that whole block needs to run in IO.
> Regarding threads, you should use resourceForkIO [1] which has a quite
> nicer interface.
I
On line 29, instead of
liftIO $ do
mapM_ ...
runResourceT $ do
...
...
why not
liftIO $ mapM_ ...
...
...
?
Regarding threads, you should use resourceForkIO [1] which has a quite
nicer interface. So you telnet would end like:
telnet :: String -> Int -> IO ()
telnet h
On 11/01/2012, at 17:00, Artyom Kazak wrote:
> In fact, I am surprised that Data.Vector doesn't have a Ratio
> instance, but has a Complex instance. Any ideas, why?
Nobody has asked for it so far.
Roman
___
Haskell-Cafe mailing list
Haskell-Cafe@has
Quoth Brandon Allbery ,
...
> terminateProcess passes on the semantics of kill(2); on SVID-compliant (and
> I think POSIX.1-compliant) systems, the negative of the process group
> leader's process ID is used to signal the process group. Note that you may
> need to arrange for your initial child p
On Wed, Jan 11, 2012 at 16:26, André Scholz wrote:
> (on unix) creating a process A which spawns itself a subprocess B and
> terminating process A before it finishes leaves process B as a process on
> its
> own. This is because "terminateProcess" sends the sigterm signal to the
> process only and
Hello,
(on unix) creating a process A which spawns itself a subprocess B and
terminating process A before it finishes leaves process B as a process on its
own. This is because "terminateProcess" sends the sigterm signal to the
process only and not to its process group.
Is there a way to termin
Hi all,
I've written a simple telnet client using Michael Snoyman's Conduit
library and was looking for comments as to whether I'm doing it
right. In particular, is my usage of a ResourceT to track a thread
a good idea, necessary or waste of time.
The code is here:
https://gist.github.com/15
On Wed, Jan 11, 2012 at 14:50, Eugene Kirpichov wrote:
> Do you think that what I originally proposed is still a good thing to have
> before implementing your solution? (it definitely would be for myself, as
> it's easier to do and I'd then quicker become able to build my application
> with split-
Hi Brandon,
Thanks - looks like this would be a modification of the linking stage,
splitting it into two parts: batching objects and then actually linking
them.
Do you think that what I originally proposed is still a good thing to have
before implementing your solution? (it definitely would be fo
On Wed, Jan 11, 2012 at 02:12, Eugene Kirpichov wrote:
> I think a nice fix would be to employ gcc's ability to read options from a
> file - gcc @file - and write overly long option strings into temp files.
What immediately occurs to me is, what if the problem (or another
manifestation of same)
Also, uvector already supports unboxed Ratios:
http://hackage.haskell.org/package/uvector
In fact, I am surprised that Data.Vector doesn't have a Ratio
instance, but has a Complex instance. Any ideas, why?
___
Haskell-Cafe mailing list
Haskell-Cafe@hask
You can use Data.Vector.Unboxed. There isn't an instance for Ratio a, but
it is easy to write one, since it would be very similar to Complex a.
http://hackage.haskell.org/packages/archive/vector/0.9.1/doc/html/Data-Vector-Unboxed.html#t:Unbox
___
Has
I have a program which does a lot of computations with Array's of
rationals. In order to get better performance I'd like to use unboxed
arrays, but, since (Ratio Int) isn't a primitive type this doesn't work.
It occured to me that I could rewrite this using -fglasgow-exts where I
represent a ratio
Based on your stated background, the best start would be the (longer)
paper on the Spineless Tagless G-machine [1]. It describes how graph
reduction is actually implemented efficiently. Since then there have
been two major changes to this basic implementation: Use of eval/apply
(a different calli
Hi Eugene,
I think I did run into this problem before, and had to turn of split-objs
temporarily to work around it. I'd appreciate a fix.
Best,
Ozgur
On 11 January 2012 14:14, Eugene Kirpichov wrote:
> Now my original question remains - is such a change a good idea?
> (I've already found the p
Thanks, looks like I already succeeded by downloading xcode 3.
Now my original question remains - is such a change a good idea?
(I've already found the place in code where the fix has to be made; should
take an hour of work at most)
On Wed, Jan 11, 2012 at 6:07 PM, Hans Aberg wrote:
> On 11 Jan
On 11 Jan 2012, at 13:38, John Lato wrote:
> I used https://github.com/kennethreitz/osx-gcc-installer/downloads to
> get a real gcc on Lion. Biggish download, but it worked. I've also
> seen reports of success by self-compiling gcc, or by installing XCode
> 4 on top of an existing XCode 3 instal
I used https://github.com/kennethreitz/osx-gcc-installer/downloads to
get a real gcc on Lion. Biggish download, but it worked. I've also
seen reports of success by self-compiling gcc, or by installing XCode
4 on top of an existing XCode 3 installation.
John L.
> From: Eugene Kirpichov
>
> Oh w
On Wed, Jan 11, 2012 at 03:23, Conal Elliott wrote:
> Is the standard pair-with-monoid monad instance in some standard place? I
> see the Applicative instance in Control.Applicative, and the
> pair-with-monoid Functor instance in Control.Monad.Instances, and the (->)
> e and Either e monad instanc
33 matches
Mail list logo