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
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
build-depends:
base >=4.7 && <5
, time
default-language: Haskell2010
executable haskell-clock-exe
@ -45,6 +46,7 @@ executable haskell-clock-exe
build-depends:
base >=4.7 && <5
, haskell-clock
, time
default-language: Haskell2010
test-suite haskell-clock-test
@ -58,4 +60,5 @@ test-suite haskell-clock-test
build-depends:
base >=4.7 && <5
, haskell-clock
, time
default-language: Haskell2010

View File

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

View File

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