{-# OPTIONS_GHC -Wno-orphans #-}
module Util.Instances () where
import Data.Default (Default(..))
import Fmt (Buildable(..))
instance Default Natural where
def :: Natural
def = 0
instance Buildable Natural where
build :: Natural -> Builder
build = Buildable Integer => Integer -> Builder
forall p. Buildable p => p -> Builder
build @Integer (Integer -> Builder) -> (Natural -> Integer) -> Natural -> Builder
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Natural -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral
instance Buildable a => (Buildable (Identity a)) where
build :: Identity a -> Builder
build (Identity x :: a
x) = a -> Builder
forall p. Buildable p => p -> Builder
build a
x