On Sun, 24 May 2009 10:33:13 +0200, Rolf Haynberg
<rolf.haynb...@student.kit.edu> wrote:

> Hello wxhaskell users,
>
> I'm new to wxhaskell and I can't solve the following problem on my own
> (tried to find a solution online for hours).
>
> What I'm trying to do is simple: I want to display the time from now
> until a time in the future. For which I read the  current time with
> getClockTime, do some calculations and then paint the time. The
> following compiles but quits immediately when I run the app (no error).
>
> ...
> demo :: IO ()
> demo = do f           <- frameFixed [text := "Countdown"]
>            currenttime <- getClockTime
>            p           <- panel f  [on paint := (writeTimeDiff
> currenttime) ]
>            set f [layout := fill $ container p $ margin 10 $ column 5
> []]
>
> writeTimeDiff :: ClockTime -> DC a -> Rect -> IO ()
> writeTimeDiff currenttime dc _ = drawText dc (getTimeDiff currenttime)
> (Point 2 2) []
>
> getTimeDiff :: ClockTime -> String
> getTimeDiff = calendarTimeToString . toUTCTime . timeDiffToClockTime .
> (diffClockTimes eta)
>                       where eta = toClockTime (CalendarTime 2010 January 1 16 
> 45 0 0
> Thursday 0 "CEST" 0 False)
> ...
>
> Don't worry about how I calculate the time difference. Imho the
> problem has something to do with
> currenttime <- getClockTime
>
> I hope anyone sees a problem in the code. I have the feeling that I'm
> missing something fundamental here.
>
> Thanks in advance,
>   Rolf
>

Use the GHCi debugger [1] to see where the crash occurs.



[1]
http://www.haskell.org/ghc/docs/latest/html/users_guide/ghci-debugger.html


-- 
Regards,
Henk-Jan van Tuyl


--
http://functor.bamikanarie.com
http://Van.Tuyl.eu/
--


------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com 
_______________________________________________
wxhaskell-users mailing list
wxhaskell-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxhaskell-users

Reply via email to