Send Beginners mailing list submissions to beginners@haskell.org To subscribe or unsubscribe via the World Wide Web, visit http://www.haskell.org/mailman/listinfo/beginners or, via email, send a message with subject or body 'help' to beginners-requ...@haskell.org
You can reach the person managing the list at beginners-ow...@haskell.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Beginners digest..." Today's Topics: 1. Re: haskell for FPGAS (Edward Z. Yang) 2. How to structure a "speaking" fuzzy clock? (Kamil Stachowski) 3. Re: haskell for FPGAS (Benedict Eastaugh) 4. Re: How to structure a "speaking" fuzzy clock? (Daniel Fischer) 5. Re: How to structure a "speaking" fuzzy clock? (Kamil Stachowski) ---------------------------------------------------------------------- Message: 1 Date: Sun, 16 Jan 2011 09:08:49 -0500 From: "Edward Z. Yang" <ezy...@mit.edu> Subject: Re: [Haskell-beginners] haskell for FPGAS To: David Blubaugh <davidblubaugh2...@yahoo.com> Cc: beginners <beginners@haskell.org> Message-ID: <1295186844-sup-6779@ezyang> Content-Type: text/plain; charset=UTF-8 Not quite "Haskell for FPGAs", but rather a DSL for embedded development: http://hackage.haskell.org/package/atom http://blog.sw17ch.com/wordpress/?p=84 Cheers, Edward ------------------------------ Message: 2 Date: Sun, 16 Jan 2011 15:16:46 +0100 From: Kamil Stachowski <kamil.stachow...@gmail.com> Subject: [Haskell-beginners] How to structure a "speaking" fuzzy clock? To: beginners@haskell.org Message-ID: <AANLkTikVBt=65rtsgpoowkadek6gbh8j5gwmpsowk...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" Hello, I am writing a program, the main purpose of which is to print fuzzy time in a casual manner, e.g. "ten to eleven" rather than "10:52". Considering my (lack of) programming experience, I got pretty far with it with the help of D. Fischer and B. Yorgey; you can take a look at the results at https://github.com/caminoix/fuzzytime. However, I also have another purpose, and that is to better learn Haskell. I can't help the feeling that my solution might perhaps work, but is nevertheless ugly, naive or just un-Haskell. Therefore, I would like to ask you how you would structure such a program. I'm not asking for an implementation, just a general idea, such as "a datatype to keep the fuzzy time, deriving Show with a set of separate functions for different languages". Thanks in advance! -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://www.haskell.org/pipermail/beginners/attachments/20110116/4ee8960b/attachment-0001.htm> ------------------------------ Message: 3 Date: Sun, 16 Jan 2011 14:23:29 +0000 From: Benedict Eastaugh <ionf...@gmail.com> Subject: Re: [Haskell-beginners] haskell for FPGAS To: David Blubaugh <davidblubaugh2...@yahoo.com> Cc: beginners@haskell.org Message-ID: <aanlktimv5jwbx2x+vde-xk-1wapolnkyks1tw5aww...@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1 On 16 January 2011 06:44, David Blubaugh <davidblubaugh2...@yahoo.com> wrote: > Has anyone developed HASKELL FOR FPGA development ?? It's probably not exactly what you want, but you could have a look at the Reduceron. http://www.cs.york.ac.uk/fp/reduceron/ Benedict. ------------------------------ Message: 4 Date: Sun, 16 Jan 2011 16:14:04 +0100 From: Daniel Fischer <daniel.is.fisc...@googlemail.com> Subject: Re: [Haskell-beginners] How to structure a "speaking" fuzzy clock? To: beginners@haskell.org Message-ID: <201101161614.05019.daniel.is.fisc...@googlemail.com> Content-Type: text/plain; charset="utf-8" On Sunday 16 January 2011 15:16:46, Kamil Stachowski wrote: > Hello, > > I am writing a program, the main purpose of which is to print fuzzy time > in a casual manner, e.g. "ten to eleven" rather than "10:52". > Considering my (lack of) programming experience, I got pretty far with > it with the help of D. Fischer and B. Yorgey; you can take a look at the > results at https://github.com/caminoix/fuzzytime. > > However, I also have another purpose, and that is to better learn > Haskell. I can't help the feeling that my solution might perhaps work, > but is nevertheless ugly, naive or just un-Haskell. >From a quick glance: not too ugly. In checkFTConf, you have a couple of guards | not (thing `elem` list) which would read better using notElem, | thing `notElem` list checkTimeOk isn't good, better checkTimeOk = case break (== ':') time of (hh, _:mm) -> let h = read hh m = read mm in 0 <= h && h < 24 && 0 <= m && m < 60 _ -> False and to further guard against malformed input, you could also test - not (null hh || null mm) - all isDigit hh && all isDigit mm -- requires import Data,Char The message for precision out of range should contain '<=' instead of '<'. Are you sure you mean humane and not human? In FuzzyTime, maybe it would be better to have the field fzLang be a new datatype Lang instead of a String. In toFuzzyTime, get hour and min(ute) via break (and not per reverse . takeWhile (/= ':') . reverse), like in checkTimeOk > > Therefore, I would like to ask you how you would structure such a > program. Hmm, I would need to think about that. What I can say without thinking: I'd use a new datatype for style and lang, and instead of checking the validity of the FuzzyTimeConf before converting to FuzzyTime, I'd write a conversion foo :: FuzzyTimeConf -> Either ErrorMessage FuzzyTime and do the checks during the conversion to not repeat work. > I'm not asking for an implementation, just a general idea, such > as "a datatype to keep the fuzzy time, deriving Show with a set of > separate functions for different languages". > > Thanks in advance! ------------------------------ Message: 5 Date: Sun, 16 Jan 2011 19:46:30 +0100 From: Kamil Stachowski <kamil.stachow...@gmail.com> Subject: Re: [Haskell-beginners] How to structure a "speaking" fuzzy clock? To: Daniel Fischer <daniel.is.fisc...@googlemail.com> Cc: beginners@haskell.org Message-ID: <AANLkTi=movp6phcvgj1tbxqxpl_esswknbhnfgyvy...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" Oh dear, I didn't actually mean to make you read the whole thing! Thank you the more! I'm very happy that you don't think the structure is completely wrong. I was quite worried about it. But if you say it's not too ugly, I will be able to sleep at night again :) Thanks a lot for the tips! On 16 January 2011 16:14, Daniel Fischer <daniel.is.fisc...@googlemail.com>wrote: > On Sunday 16 January 2011 15:16:46, Kamil Stachowski wrote: > > Hello, > > > > I am writing a program, the main purpose of which is to print fuzzy time > > in a casual manner, e.g. "ten to eleven" rather than "10:52". > > Considering my (lack of) programming experience, I got pretty far with > > it with the help of D. Fischer and B. Yorgey; you can take a look at the > > results at https://github.com/caminoix/fuzzytime. > > > > However, I also have another purpose, and that is to better learn > > Haskell. I can't help the feeling that my solution might perhaps work, > > but is nevertheless ugly, naive or just un-Haskell. > > From a quick glance: not too ugly. > > In checkFTConf, you have a couple of guards > > | not (thing `elem` list) > > which would read better using notElem, > > | thing `notElem` list > > checkTimeOk isn't good, better > > checkTimeOk > = case break (== ':') time of > (hh, _:mm) -> let h = read hh > m = read mm > in 0 <= h && h < 24 && 0 <= m && m < 60 > _ -> False > > and to further guard against malformed input, you could also test > - not (null hh || null mm) > - all isDigit hh && all isDigit mm -- requires import Data,Char > > The message for precision out of range should contain '<=' instead of '<'. > > Are you sure you mean humane and not human? > > In FuzzyTime, maybe it would be better to have the field fzLang be a new > datatype Lang instead of a String. > > In toFuzzyTime, get hour and min(ute) via break (and not per reverse . > takeWhile (/= ':') . reverse), like in checkTimeOk > > > > > Therefore, I would like to ask you how you would structure such a > > program. > > Hmm, I would need to think about that. What I can say without thinking: > > I'd use a new datatype for style and lang, and instead of checking the > validity of the FuzzyTimeConf before converting to FuzzyTime, I'd write a > conversion > > foo :: FuzzyTimeConf -> Either ErrorMessage FuzzyTime > > and do the checks during the conversion to not repeat work. > > > I'm not asking for an implementation, just a general idea, such > > as "a datatype to keep the fuzzy time, deriving Show with a set of > > separate functions for different languages". > > > > Thanks in advance! > > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://www.haskell.org/pipermail/beginners/attachments/20110116/33176268/attachment-0001.htm> ------------------------------ _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners End of Beginners Digest, Vol 31, Issue 16 *****************************************