Chris Stryczynski

Software Developer / Consultant

Haskell thyme format time example

Posted on: 25/08/2018

You’ll need the old-locale library for defaultTimeLocale.

{-# LANGUAGE DeriveGeneric #-}
{-# OPTIONS -Wno-unused-imports #-}
module CommandRecord where

import Data.Text
import Data.Thyme.Clock
import Data.Thyme.Format
import GHC.Generics

import System.Locale
import Data.Binary
import ThymeBinaryInstances


data CommandRecord = CommandRecord {
    command :: Text
  , timedate :: UTCTime
  , path :: Text
  } deriving (Generic)

instance Binary CommandRecord


instance Show CommandRecord
  where show cr = show (command cr) ++ formatTime defaultTimeLocale "%d/%m/%Y %H:%M" (timedate cr) ++ show (path cr)
Comments

No comments, yet!

Submit a comment