Print current time

This commit is contained in:
Greg Shuflin 2023-02-24 02:40:13 -08:00
parent 1afc109d0c
commit 381ffaf8c6
4 changed files with 19 additions and 4 deletions

View File

@ -3,4 +3,9 @@ module Main (main) where
import Lib import Lib
main :: IO () main :: IO ()
main = putStrLn someFunc main = do
putStrLn "haskell-clock"
t <- curTimeString
putStrLn t

View File

@ -33,6 +33,7 @@ library
ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints
build-depends: build-depends:
base >=4.7 && <5 base >=4.7 && <5
, time
default-language: Haskell2010 default-language: Haskell2010
executable haskell-clock-exe executable haskell-clock-exe
@ -45,6 +46,7 @@ executable haskell-clock-exe
build-depends: build-depends:
base >=4.7 && <5 base >=4.7 && <5
, haskell-clock , haskell-clock
, time
default-language: Haskell2010 default-language: Haskell2010
test-suite haskell-clock-test test-suite haskell-clock-test
@ -58,4 +60,5 @@ test-suite haskell-clock-test
build-depends: build-depends:
base >=4.7 && <5 base >=4.7 && <5
, haskell-clock , haskell-clock
, time
default-language: Haskell2010 default-language: Haskell2010

View File

@ -21,6 +21,7 @@ description: Please see the README on GitHub at <https://github.com/gith
dependencies: dependencies:
- base >= 4.7 && < 5 - base >= 4.7 && < 5
- time
ghc-options: ghc-options:
- -Wall - -Wall

View File

@ -1,6 +1,12 @@
module Lib module Lib
( someFunc (
curTimeString
) where ) where
someFunc :: String import Data.Time.Clock
someFunc = "someFunc"
curTimeString :: IO String
curTimeString = do
t <- getCurrentTime
return $ show $ t