[Haskell] need some help with type inference

2007-11-15 Thread Hal Daume III
ystem like this before? Anyone want to offer suggestions? I think probably it's most appropriate to reply off-list, since I don't want to bog the list down. Best, - Hal p.s., the language is here: http://www.cs.utah.edu/~hal/HBC -- Hal Daume III --- me AT hal3 DOT name | http

Re: [Haskell] Proposal: Allow "\=" for field update in record update syntax

2005-02-17 Thread Hal Daume III
> -Alex- > > > __ > S. Alexander Jacobson tel:917-770-6565 http://alexjacobson.com > ___ > Haskell mailing list > Haskell@haskell.org > http://www.haskell.org/mailman/

Re: [Haskell] image writing library

2004-08-05 Thread Hal Daume III
image = unlines $ map show $ elems cm > (width,heigth) = snd $ bounds cm > maxval = maximum (elems cm) > > Not *very* beautiful, but seems to do the job for my stuff. I'll try > the PPM library if I need something a tad more

[Haskell] for large x, log (x::Integer) :: Double

2004-06-30 Thread Hal Daume III
t; to do this... - hal -- Hal Daume III | [EMAIL PROTECTED] "Arrest this man, he talks in maths." | www.isi.edu/~hdaume ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell

Re: [Haskell] randomgen for foreign random functions

2004-06-25 Thread Hal Daume III
er. > [Although, in the second approach, I presume that you would need > addtional code for multi-threaded use.] I don't care about multi-threaded use. - Hal -- Hal Daume III | [EMAIL PROTECTED] "Arrest this

[Haskell] randomgen for foreign random functions

2004-06-25 Thread Hal Daume III
be possible. Any thoughts? - Hal -- Hal Daume III | [EMAIL PROTECTED] "Arrest this man, he talks in maths." | www.isi.edu/~hdaume ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell

Re: [Haskell] return?

2004-04-30 Thread Hal Daume III
I can do > >if cond then return 1 else ( > > ...--subsequent actions > > ) > > > > > > However, that syntax does not look very pleasant to me due to this extra > >indentation and the pair of parens. > > > > > >Is this possible at a

Re: [Haskell] insufficiently [EMAIL PROTECTED] -- more counterintuitive stuff

2004-03-30 Thread Hal Daume III
used! Passing [] to > > > the second works just fine. > > > > You can write this as > > > > > foo' list@(~(h:t)) = list > > > > foo' [] will evaluate to []. The H98 report calls it an "irrefutable > > pattern", IIRC. > > >

Re: [Haskell] main::[String]->IO() ?

2004-03-22 Thread Hal Daume III
> any severe theoretical (semantical) problems (main is running in the IO > monad either way)? > > Ciao, > Steffen > ___ > Haskell mailing list > [EMAIL PROTECTED] > http://www.haskell.org/mailman/listinfo/haskell > --

Re: [Haskell] performance tuning Data.FiniteMap

2004-02-24 Thread Hal Daume III
; http://antispam.yahoo.com/tools > > _______ > > Haskell mailing list > > [EMAIL PROTECTED] > > http://www.haskell.org/mailman/listinfo/haskell > > > > ___ > Haskell mailing lis

Re: [Haskell] regular expression syntax - perl ain't got nothin on haskell

2004-02-24 Thread Hal Daume III
te: > Per Larsson wrote: > > > .. I have since long missed some > > typical text processing functionality in haskell. > > it is often the case that people process "text" > only because they have no better (structured and typed) way of >

Re: data label overloading

2004-01-13 Thread Hal Daume III
nt } data Foo2 = Foo2 { foo2_size :: Int } f x y z = let size = foo1_size in (size x) + (size y) + (Foo2..size z) also, this would lead to highly ambiguous parses, i think. - hal -- Hal Daume III | [EMAIL PROTECTED] "Arrest t

Re: getting the path to the executing program

2004-01-09 Thread Hal Daume III
Hi, > If I may suggest, a Haskell implementation may want to give a > programmer a way to obtain the unmangled argv0. If I may second that, ... -- Hal Daume III | [EMAIL PROTECTED] "Arrest this man, he talks in maths." | www

Re: getting the path to the executing program

2004-01-08 Thread Hal Daume III
True. Replace "the" with "a" and "?" with ", if it exists?". On Thu, 8 Jan 2004, Lennart Augustsson wrote: > Hal Daume III wrote: > > is there a function, related to getProgName, which returns the (absolute) > > path to the current pro

Re: getting the path to the executing program

2004-01-08 Thread Hal Daume III
ble File: _ On Thu, 8 Jan 2004, Christopher Milton wrote: > The environmental var "_" in $ENV{"_"} (pardon my Perlish) holds > the full path name of the command currently executing (itself), at > least on RedHat Linux and HP-UX, so you should be able to use >

getting the path to the executing program

2004-01-08 Thread Hal Daume III
is there a function, related to getProgName, which returns the (absolute) path to the current program? basically, i want to be able to read a file which i know will be in the same directory as the current program, but not necessarily in the same directory that we're running it from. --

Re: safe array freezing?

2003-12-31 Thread Hal Daume III
d runSTUArray need not be > considered unsafe? if so, perhaps we should add these (or some better > generalization that someone comes up with) to the standard libraries, as > it would be nice to be able to use this idiom without resorting to > trickery. (well, user visible trickery at lea

Re: How to make reading an array from disk more efficient

2003-12-24 Thread Hal Daume III
ery speedy reply and thanks to whoever maintains the > list archive for updating the archive for each message (I'm pretty sure it > used to be made daily, which was a nuisance if you wanted to forward URLs > to interesting discussions). > > Hal Daume III said: > > (1

Re: How to make reading an array from disk more efficient

2003-12-24 Thread Hal Daume III
e pixel stream so that the image is > subsampled (see "everyN" in the code) > - the possibility to filter the pixel strean so that a subsection of the > image is selected. > > All that is possible in the code I have now, but it's slow. > > Thanks, > Andrew >

Re: let-where difference

2003-12-22 Thread Hal Daume III
ank you in advance for the explanation. > Copy, please, the answer to [EMAIL PROTECTED] > > - > Serge Mechveliani > [EMAIL PROTECTED] > > > > > _______ > Haskell mailing list > [EMAIL PROTECTED] > http://www.haske

Re: Why are strings linked lists?

2003-11-28 Thread Hal Daume III
r plain 8bit ascii as you see fit. -- Hal Daume III | [EMAIL PROTECTED] "Arrest this man, he talks in maths." | www.isi.edu/~hdaume ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell

Re: Why are strings linked lists?

2003-11-28 Thread Hal Daume III
your own using getting characters and concatenating them (AFAIK). Either way, you're going to get performance hits for going through [Char]s. As a minor quibble, I don't like the naming scheme with packString and unpackPS...seems very unbalanced to me :). my 2 c

Announce: SVMseq learning program

2003-11-20 Thread Hal Daume III
ction and better control over memory usage. More information and documentation is available at: http://www.isi.edu/~hdaume/SVMseq/ Best, - Hal -- Hal Daume III | [EMAIL PROTECTED] "Arrest this man, he talks in maths." | www.

set representation question

2003-11-11 Thread Hal Daume III
e up front cost for creating a data structure that could do this more quickly (i.e., in logarithmic time). is such a thing possible? "does anyone have a haskell implementation of" such a thing? :P thanks! - hal -- Hal Daume III | [EMAIL PR

Re: Number conversions, like floats to doubles

2003-11-08 Thread Hal Daume III
gt; convertIntegral :: (Integral a, Integral b) => a -> b > > > -- Hal Daume III | [EMAIL PROTECTED] "Arrest this man, he talks in maths." | www.isi.edu/~hdaume ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell

Re: Doing weird things with types.

2003-11-06 Thread Hal Daume III
Matrix ((e,f),(g,h))) > = > Matrix ((a-e,b-f),(c-g,d-h)) > > hvVecMult (HVec a b) (VVec c d) = a*c + b*d > > scalHVecMult :: Float -> HVec -> HVec > scalHVecMult i (HVec a b ) = HVec (i*a) (i*b) > > Thanks, > > David J. Sankel > > ___

RE: access to fields in nested records

2003-11-05 Thread Hal Daume III
ere? > > > Actually mutators of the general form > > t_f1' :: (X->X) -> T -> T > t_f1_ f t = t{t_f1=f (t_f1 t)} > > _______ > Haskell mailing list > [EMAIL PROTECTED] > http://www

Re: access to fields in nested records

2003-11-05 Thread Hal Daume III
or a Haskell user program? > > Thank you in advance for the respond. > > Please, add [EMAIL PROTECTED] > to the reply list. > > -- > Serge Mechhveliani > [EMAIL PROTECTED] > > >

Re: Boilerplate revisited

2003-11-04 Thread Hal Daume III
ers' tpa ia n [] > = "data TypeWrapper = StandInForEasierAutomaticGeneration\n" > ++ tpa ++ "\n\n" ++ ia > > generateTypeWrappers' tpa ia n (x:xs) > = generateTypeWrappers' (tpa ++ wrap n x) (ia ++ inst n x) (n + 1) xs > > > -- make one wrap > wrap n x = " | T" ++ show n ++ " " ++ x ++ "\n" > > > -- make one instance > inst n x = "instance MyTypeable " ++ x ++ " where\n" >++ " typeOf _ = " ++ show n ++ "\n" >++ " toDyn = T" ++ show n ++ "\n" >++ " fromDyn (T" ++ show n ++ " x) = Just x\n" >++ " fromDyn _ = Nothing\n\n\n" > ___ > Haskell mailing list > [EMAIL PROTECTED] > http://www.haskell.org/mailman/listinfo/haskell > -- Hal Daume III | [EMAIL PROTECTED] "Arrest this man, he talks in maths." | www.isi.edu/~hdaume ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell

[Caml-list] IBM funding for OCaml on Eclipse? (fwd)

2003-10-26 Thread Hal Daume III
Perhaps someone one this list might find this interesting... -- Hal Daume III | [EMAIL PROTECTED] "Arrest this man, he talks in maths." | www.isi.edu/~hdaume -- Forwarded message -- Date: Sat, 25 Oct 2003 22:18:59 -0700 Fr

Re: Enum on Float/Double

2003-10-22 Thread Hal Daume III
might not. :) > > -- Lennart > > Hal Daume III wrote: > >>>My preference would be for succ (+-0) to return the smallest positive > >>>real, since then you could define succ x to be the unique y with > >>>x < y and forall z . z < y => not (x

Re: Enum on Float/Double

2003-10-21 Thread Hal Daume III
> > My preference would be for succ (+-0) to return the smallest positive > > real, since then you could define succ x to be the unique y with > > x < y and forall z . z < y => not (x < z), where such a y exists, and > > I'm not sure if the Haskell standard knows about signed zeros. > > Is this re

Re: how to do lazy IO like getContents?

2003-10-18 Thread Hal Daume III
> I don't understand the details of your example (for instance, what > does "evaluate" do? I found a reference to it in the GHC manual under > Debug.QuickCheck, but couldn't figure out what it.), but get the > general point. evaluate is from Control.Exception; basically it's: evaluate :: a -> IO

Re: how to do lazy IO like getContents?

2003-10-18 Thread Hal Daume III
is 'return . head', you might get a 'head:: empty list' error, while if 'f' is 'evaluate . head', you won't. -- Hal Daume III | [EMAIL PROTECTED] "Arrest this man, he talks in maths." | www.isi

Re: lexer puzzle

2003-09-25 Thread Hal Daume III
Hi, > But I'm just writing this to let you guys know (surely you know this > already) that anyone from a C/C++/Java/Delphi background is going to > completely misunderstand the meaning of A.anything in Haskell... it's > completely nonintuitive to people with my background. Surely this is no wor

Re: From enumerators to cursors: turning the left fold inside out

2003-09-24 Thread Hal Daume III
rn into the Iteratee. - Hal > > hfold_left:: FileName -> Title > > -> Iteratee seed > > -> seed -- the initial seed > > -> IO seed > > type FileName = String > > type Titl

Re: File reading question

2003-09-12 Thread Hal Daume III
nts. > > > > Gordon James Miller Promisemark, Inc. Senior Computer Scientist > [EMAIL PROTECTED] (571)330-9012 The box said "Requires Windows 95 > or better." So I installed LINUX > > ___ > Haskell

Re: GHC code generation

2003-09-10 Thread Hal Daume III
llation?). Can anyone shed any light or pointers? > > Thanks. > > #g > > > > Graham Klyne > [EMAIL PROTECTED] > > ___ > Haskell mailing list > [EMAIL PROTECTED] > http://www.haskell.org/ma

Re: Syntax extensions (was: RE: The Future of Haskell discussion at the Haskell Workshop)

2003-09-10 Thread Hal Daume III
___ > Haskell mailing list > [EMAIL PROTECTED] > http://www.haskell.org/mailman/listinfo/haskell -- -- Hal Daume III | [EMAIL PROTECTED] "Arrest this man, he talks in maths." | www.isi.edu/~hdaume ___

Re: Circular Instance Declarations

2003-09-07 Thread Hal Daume III
m use of `==' at CircularInsts.hs:16 > > `Eq (D C)' arising from use of `==' at CircularInsts.hs:16 > > > > Would it be reasonable for the compiler to check back through the stack > > and allow the circularity? It will just create an ordinary recursive > > function. > > > > --

Haskell for non-Haskell's sake

2003-08-30 Thread Hal Daume III
ll compilers/interpreters - developing libraries for Haskell - writing Haskell debuggers, tracers, profilers or other tools - more or less anything with matches /.*Haskell.*/, other than /in Haskell$/ :) Thanks, - Hal -- Hal Daume III |

RE: unsafeInterleaveIO ordering

2003-08-29 Thread Hal Daume
> In your example it's more or less guaranteed that putting "b" > and "c" will > never happen, because the result of the combinated IO action > isn't demanded. well yes, it was a bad example. i got another answer basically saying that threading could screw it up (i'm not using thread) as could,

unsafeInterleaveIO ordering

2003-08-29 Thread Hal Daume
"b" >> putStrLn "c") is unspecified, is it the case that the whole thing will be done at once? -- Hal Daume III | [EMAIL PROTECTED] "Arrest this man, he talks in maths." | www.isi.edu/~hdaume

RE: Need some help please.

2003-08-27 Thread Hal Daume
There's a small problem with this solution, namely that it requires you to have an Eq instance for the elements in the list. You can fix this by using 'null' from the Prelude. -- Hal Daume III | [EMAIL PROTECTED] "Arrest this ma

RE: container for different types, avoiding boiler plate

2003-08-21 Thread Hal Daume
Yes, this is essentially what DynamicMap isThe url i posted before was wrong...it should have been: www.isi.edu/~hdaume/haskell/DynamicMap.hs -- Hal Daume III | [EMAIL PROTECTED] "Arrest this man, he talks in maths." | www.isi.e

RE: container for different types, avoiding boiler plate

2003-08-20 Thread Hal Daume
econd" _ -> "either i don't know or is third" of course 'deriving Typeable' means you need GHC6; otherwise you can write the instances by hand. -- Hal Daume III | [EMAIL PROTECTED] "Arrest this man, he talk

Announce: HWordNet - A Haskell Interface to WordNet

2003-08-19 Thread Hal Daume III
n. Also, it does use implicit parameters, so you've got to have GHC or Hugs or some other compiler that supports those. - Hal -- Hal Daume III | [EMAIL PROTECTED] "Arrest this man, he talks in maths.&qu

more unsafePerformIO questions (is it safe to use with ReadMode Handles)?

2003-08-18 Thread Hal Daume
ngs up like that -- if you have to be in a monad anyway, there's no reason to pass the WordNetEnv around everywhere. But still, if possible, it would be nice for these to be pure. - Hal -- Hal Daume III | [EMAIL PROTECTED] "Arrest thi

RE: Help with Exceptions on I/O

2003-08-14 Thread Hal Daume
Buffering stdout NoBuffering hSetBuffering stdin NoBuffering you'll need to import System.IO to get these. -- Hal Daume III | [EMAIL PROTECTED] "Arrest this man, he talks in maths." | www.isi.edu/~hdaume -Original Message- From: [

RE: overlapping instances and functional dependencies

2003-08-14 Thread Hal Daume
understanding -- someone might correct me) - Hal -- Hal Daume III | [EMAIL PROTECTED] "Arrest this man, he talks in maths." | www.isi.edu/~hdaume > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On

RE: Text I/O library proposal, first draft

2003-08-05 Thread Hal Daume
x27;d like to take advantage of this new infrastructure, if possible... -- Hal Daume III | [EMAIL PROTECTED] "Arrest this man, he talks in maths." | www.isi.edu/~hdaume > -Original Message- > From: [EMAIL PROTECTED] >

RE: Text I/O library proposal, first draft

2003-07-31 Thread Hal Daume
Hi Ben, > Bad things: > > * There's no way to implement fgetpos/fsetpos type functionality, > because coders don't expose their internal state. (In fact, there > would need to be a way to explicitly copy the state, since it may > well include IORefs, Ptrs, etc.) Is this a serious pr

RE: a breaking monad

2003-07-31 Thread Hal Daume
> This looks like a bizarre rendition of the Error/Exception monad. Yes, of course. *Hal slaps himself* Thanks. > Also, your motivating example is ambiguous. I think you mainly care > about the case where the test is testing for some "exceptional" > condition. I personally wouldn't want to us

a breaking monad

2003-07-31 Thread Hal Daume
hIsEOF h `breaksTo` [] > lift $ do > l <- hGetLine h > rest <- test3 h > return (l:rest) where passThrough and repeatM are: > repeatM :: Monad m => m () -> m () > repeatM x = x >> repeatM x > > passThrough :: Monad m => (a -> m b

RE: Ann: HAllInOne bug fix release

2003-07-30 Thread Hal Daume
with ghc: real0m27.167s user0m9.991s sys 0m1.304s nhc all-in-one: real0m31.411s user0m10.007s sys 0m1.299s i am completely unable to explain this. someone want to hazard a guess? - hal, who is a bit disappointed now :( -- Hal Daume III

Ann: HAllInOne bug fix release

2003-07-30 Thread Hal Daume III
Hi Fellow Haskellers, I normally wouldn't send out bug fix notifications, but there has been an update to HAllInOne (http://www.isi.edu/~hdaume/HAllInOne/), which fixes two major bugs: - recursive modules now work correctly - proper separation of type and value environments The reason I'm p

RE: Existentials...

2003-07-28 Thread Hal Daume
7;) True *PushF> Maybe.isJust (getInner fs "hello") True *PushF> Maybe.isJust (getInner fs True) True *PushF> Maybe.isJust (getInner fs (1::Int)) True *PushF> Maybe.isJust (getInner fs (1::Float)) False *PushF> Maybe.isJust (getInner fs ()) False hope this helps. - hal

System.Directory (was RE: Proposal for a new I/O library design)

2003-07-28 Thread Hal Daume
Hi guys, I'm not replying to anything in the message, but... > Is the idea > to abstract away from the syntax of pathnames on the platform (eg. > directory separator characters)? If so, I'm not sure it's worthwhile. > There are lots of differences between pathname conventions: case > sensitivity

RE: dynamics on polymorphic datatype

2003-07-26 Thread Hal Daume
default" case. however, if you try something you haven't written an instance of, you do get this default case: *Foo> typeOf (undefined :: Foo Double) Foo a so, it kind of depends on what you want. probably you want exactly what didn't work; perhaps someone else has a more ingeniou

RE: referring to deeply embedded definitions

2003-07-18 Thread Hal Daume
Please ignore my stupid question :) -- Hal Daume III | [EMAIL PROTECTED] "Arrest this man, he talks in maths." | www.isi.edu/~hdaume > -Original Message----- > From: Hal Daume > Sent: Friday, July 18, 2003 10:23 AM >

referring to deeply embedded definitions

2003-07-18 Thread Hal Daume
M1.foo else 'b' but neither of these is valid. Is there any way to get at the definition from M3? - Hal -- Hal Daume III | [EMAIL PROTECTED] "Arrest this man, he talks in maths." | www.isi.edu/~hdaume

Re: Announce: Haskell All-In-One

2003-07-17 Thread Hal Daume III
n two test cases, but if someone wants to stress test this and submit bugs, that would be great. A new version is up on the web page now. - Hal -- Hal Daume III | [EMAIL PROTECTED] "Arrest this man, he talks in maths." | www.isi.edu/

Announce: Haskell All-In-One

2003-07-13 Thread Hal Daume III
y the code such that System.IO no longer imports 'bracket' and uncomment the 'cast' function in the GMap library. - Hal -- Hal Daume III | [EMAIL PROTECTED] "Arrest this man, he talks in maths." | www.isi.edu/~hdaume

RE: How overload operator in Haskell?

2003-07-09 Thread Hal Daume
Quite right :). I agree whole-heartedly. There's nothing wrong with overloading (+) and (-) in this case, but the rest really don't make much sense. Probably best to leave them undefined and just not use them. Then you could define your own dot product function and the like. --

RE: How overload operator in Haskell?

2003-07-09 Thread Hal Daume
fromInteger :: Integer->Vector is a little harder. Perhaps just 'fromInteger i = [fromInteger i]' would be acceptable. Or you could leave these undefined. -- Hal Daume III | [EMAIL PROTECTED] "Arrest this man, he talks in maths."

RE: Reading/Writing Binary Data in Haskell

2003-07-09 Thread Hal Daume
could become standard. This is available at: http://www.isi.edu/~hdaume/haskell/NewBinary/ and allows both bit-based and byte-based writing styles. -- Hal Daume III | [EMAIL PROTECTED] "Arrest this man, he talks in maths." | www.

Re: Ledit (was Re: [Caml-list] how to use a module) (fwd)

2003-07-01 Thread Hal Daume III
There was some discussion about something like this a while ago...would this solve our problems? -- Hal Daume III | [EMAIL PROTECTED] "Arrest this man, he talks in maths." | www.isi.edu/~hdaume -- Forwarded message -- Date:

RE: foldr in terms of map

2003-07-01 Thread Hal Daume
Hi, quick reply :)...i've reordered some of what you've said (i hope you don't mind!) > However the monad is defined, sequence_ has to process the entire list > before anything can be determined about the result. The entire result > of (>>) depends upon both arguments, whereas you can deduce the h

foldr in terms of map

2003-06-30 Thread Hal Daume
ucture and doesn't modify (just "runs") elements. is there some sor tof theory that talks about this relationship? and why is it that when put together, these things are strong enough (plus refs) to subsume primitive recursiveness? - Hal p.s., responses delayed until after ICFP a

RE: Language extension proposal

2003-06-25 Thread Hal Daume
demand on its argument (quite the opposite, in fact). Of course, the powers that be can weight in on this, and I'm sure that you're aware of the phantom type solution, but I figured I'd post anyway so that others can get a look at types like this for their own benefit... --

RE: stack space overflow

2003-06-20 Thread Hal Daume
or me on large input like: *Main> ind 1 "foo" $ listArray (1,1) (concat $ repeat "abcfoodefgfooa") even in ghci. -- Hal Daume III | [EMAIL PROTECTED] "Arrest this man, he talks in maths." | www.isi.edu/~hdaume

RE: Array + memory usage

2003-06-19 Thread Hal Daume
uld use a more informed coding tree based on letter distributions, but this is probably overkill. -- Hal Daume III | [EMAIL PROTECTED] "Arrest this man, he talks in maths." | www.isi.edu/~hdaume > -Original Message- > From: [EMAI

Re: main modules in GHC, deriving differences between GHC and Hugs

2003-06-13 Thread Hal Daume III
pile any module with a 'main :: IO a' function as an executable without having to call it Main. You can probably find a message from me to this extent in the archives, as well as some response. - Hal -- Hal Daume III | [EMAIL PROTECTED] "Arre

Re: Threads

2003-06-13 Thread Hal Daume III
Presumably you need a call to yield or threadDelay or something like that. -- Hal Daume III | [EMAIL PROTECTED] "Arrest this man, he talks in maths." | www.isi.edu/~hdaume On Fri, 13 Jun 2003, Filip wrote: > Hi, > > I have fu

Re: problems with working with Handles

2003-06-12 Thread Hal Daume III
tit extra2" to be the text in the output file. I'm guessing this has something to do with buffering. When you open the files, try 'hSetBuffering h? NoBuffering' and see if that fixes it. -- Hal Daume III | [EMAIL PROTECTED] "

Re: Stupid wuestion about Monads :)

2003-06-11 Thread Hal Daume III
Look through the mailing list archives/wiki/haskell tutorials. But basically you can't, except by combining it with another action, as in: suppose 'baz :: Int -> IO Bool', then: foo = do bar <- baz 5 if bar then ... else ... for instance.

Re: LOOPS

2003-06-11 Thread Hal Daume III
if the condition is 'true' at the start, it will never be 'false'). Moreover, there isn't usually a return value associated with a while statement. -- Hal Daume III | [EMAIL PROTECTED] "Arrest this man, he talks in maths."

Re: Collecting values from Functors?

2003-06-05 Thread Hal Daume III
No, you need a fold to do that. -- Hal Daume III | [EMAIL PROTECTED] "Arrest this man, he talks in maths." | www.isi.edu/~hdaume On Wed, 4 Jun 2003, Graham Klyne wrote: > I'm trying to figure if there's any way I can use

Re: labelled fields

2003-06-04 Thread Hal Daume III
ny rules to keep track of something with a combination of multiple named fields and multiple unnamed fields. I don't know though... You can always give them names like "_foo1" etc., in which case ghc probably won't warn about them, as is the case with methods whose names begin

Re: Implementing RefMonads in Haskell without ST,IO

2003-05-30 Thread Hal Daume III
> But how can one implement RefMonad to support references of all possible > types simultaneously? ...you could use Dynamics... but other than that, I think you're stuck... > - Original Message - > From: "Derek Elkins" <[EMAIL PROTECTED]> > To: "Tim Sweeney" <[EMAIL PROTECTED]> > Cc: <[E

Re: Performance Timing

2003-03-27 Thread Hal Daume III
nt time evaluate (f a) t2 <- get current time return (different in t2 and t1) where evaluate is from Control.Exception. could someone tell me how evaluate compares to seq and deepSeq? -- Hal Daume III | [EMAIL PROTECTED] "Arrest this man, he tal

Re: Polishing the boilerplate: a dis-unsafely safe cast

2003-03-24 Thread Hal Daume III
get unsafePerformIO with which we can write unsafeCoerce. Using simply String ids as in the referenced paper would make this sort-of-safe, provided users don't give bogus instances of Typeable. -- Hal Daume III | [EMAIL PROTECTED] "Arrest this man, he talks in ma

RE: simulating dynamic dispatch

2003-03-21 Thread Hal Daume III
e requires around class contexts? i've always found this odd... -- Hal Daume III | [EMAIL PROTECTED] "Arrest this man, he talks in maths." | www.isi.edu/~hdaume On Fri, 21 Mar 2003, Simon Peyton-Jones wrote: > You might also find the &

Re: simulating dynamic dispatch

2003-03-20 Thread Hal Daume III
> -- *Main> test $ MkFoo (0::Int) > -- Just True > -- *Main> test $ MkFoo (10::Int) > -- Just False > -- *Main> test $ MkBar 'a' > -- Just True > -- *Main> test $ MkBar 'b' > -- Just False ah, yes. i was aware that would work. i forgot to mention the constraint that i don't want the user t

simulating dynamic dispatch

2003-03-20 Thread Hal Daume III
= Nothing instance Foo a => FooBar a where wasFoo a = Just (MkFoo a) instance Bar a => FooBar a where wasBar a = Just (MkBar a) but this complains about duplicate instance declarations (for obvious reasons). i'm hoping one of the type class gurus out there can help me

Re: Question about scope of 'let' and 'where'

2003-03-17 Thread Hal Daume III
Hi, > f x = let ... >in > ... > where > ... > > Assuming that all the ...s are legal, is this OK? Should it be? It > really makes the 'where' clause look like it's inside the 'let', when > in fact it can't be. Ah, sorry. Yes, this is legal. However, if

Re: Question about scope of 'let' and 'where'

2003-03-17 Thread Hal Daume III
g -> ... > Just (y,z) -> let Just q = z >in b > where b = g q does it really make sense to let the where clause look that deep into an expression to pull out a variable? And what if you use the name 'q' multiple times in the expression? -- Hal Daume III

Re: Question about scope of 'let' and 'where'

2003-03-16 Thread Hal Daume III
lause. -- Hal Daume III | [EMAIL PROTECTED] "Arrest this man, he talks in maths." | www.isi.edu/~hdaume On Sun, 16 Mar 2003, Graham Klyne wrote: > In the function body (rhs): > > let > { a = (e1) } > in

RE: big lambda in class declarations

2003-03-14 Thread Hal Daume III
It seems that the inability to have (\x . x) as a type in the Theimann et al approach is a severe limitation. I don't think that having to help the typechecker along, as in boundless rank polymorphism, is a bad thing at all. -- Hal Daume III | [EMAIL PROT

Re: Recursion with do??

2003-03-14 Thread Hal Daume III
ast this with do notation, where you a let is a statement (just like "x <- foo" is a statement) and doesn't have a corresponding "in". -- Hal Daume III | [EMAIL PROTECTED] "Arrest this man, he talks in maths."

Re: How to search for a string sequence in a file a rewrite it???

2003-03-12 Thread Hal Daume III
Right. *Recurse* down the list. Somethign like: foo orig_str new_str xl@(x:xs) | orig_str `isPrefixOf` xl = | otherwise= x : -- Hal Daume III | [EMAIL PROTECTED] "Arrest this man, he talks in maths." | www.isi.edu/~

Re: How to search for a string sequence in a file a rewrite it???

2003-03-12 Thread Hal Daume III
3 lines of code. -- Hal Daume III | [EMAIL PROTECTED] "Arrest this man, he talks in maths." | www.isi.edu/~hdaume On Thu, 13 Mar 2003, Alexandre Weffort Thenorio wrote: > OK Guys. First I would like to say thanks for all the help given b

Re: data vs. newtype, abstractly

2003-03-09 Thread Hal Daume III
well, yes, but if you export: mkN :: Int -> N mkD :: Int -> D or something like that, then they'll still bea ble to tell the difference, right? -- Hal Daume III | [EMAIL PROTECTED] "Arrest this man, he talks in maths." | www.is

Re: data vs. newtype, abstractly

2003-03-08 Thread Hal Daume III
yes. > data D = D Int > newtype N = N Int there is a difference between (N undefined) `seq` () and (D undefined) `seq` () there has been a lot of discussion about this on the mailing list, probably under a title of something like "difference between data and newtype". -

Re: Persistant (as in on disk) data

2003-03-07 Thread Hal Daume III
I'd not been following this discussion, but now it seems it's gotten to instances of the Binary module. I figured I'd chime in briefly: > thanks for your replies. i browsed thrugh the discussion on the > libraries list, but it mainly seems to discuss if one should use bits or > bytes in the bi

big lambda in class declarations

2003-03-04 Thread Hal Daume III
da). Could some one help my intuition a bit here and explain to me how you could use big lambdas in class declarations to write programs? Thanks! - Hal -- Hal Daume III | [EMAIL PROTECTED] "Arrest this man, he talks in maths.

RE: fundeps for extended Monad definition

2003-03-03 Thread Hal Daume III
> | entirely so, since the result of it is not of type 'forall b. b', but > | rather of 'forall b. C Int b => b'. Thus, if the C class has a > function > | which takes a 'b' as an argument, then this value does have use. > > I disagree. Can you give an example of its use? I believe somethin

Re: How to catch and error message and how to make it create unix files instead of dos files??

2003-03-02 Thread Hal Daume III
main = do v <- try $ readFile "foo" case v of Left _ -> putStrLn "an error occurred" Right t -> putStrLn t should work -- Hal Daume III | [EMAIL PROTECTED] "Arrest this man, he talks in maths." |

Re: How to catch and error message and how to make it create unix files instead of dos files??

2003-03-01 Thread Hal Daume III
Look at the functions try catch and bracket. -- Hal Daume III | [EMAIL PROTECTED] "Arrest this man, he talks in maths." | www.isi.edu/~hdaume On Sat, 1 Mar 2003, Alexandre Weffort Thenorio wrote: > I am trying to write a small software

RE: fundeps for extended Monad definition

2003-02-28 Thread Hal Daume III
> The reason, which is thoroughly explained in Simon Peyton-Jones' > message, is that the given type signature is wrong: it should read > f1 :: (exists b. (C Int b) => Int -> b) Right. Simon pointed out that this is a pretty useless function, but not entirely so, since the result of it is n

  1   2   3   >