{-# LANGUAGE TypeFamilies #-}

module HaskellWorks.Data.Sign
    ( Sign(..)
    ) where

import Data.Int
import Data.Word

class Sign a where
  type SignOf a
  sign :: a -> SignOf a

instance Sign Word where
  type SignOf Word = Int
  sign :: Word -> SignOf Word
sign = Word -> SignOf Word
forall a b. (Integral a, Num b) => a -> b
fromIntegral
  {-# INLINE sign #-}

instance Sign Word8 where
  type SignOf Word8 = Int8
  sign :: Word8 -> SignOf Word8
sign = Word8 -> SignOf Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral
  {-# INLINE sign #-}

instance Sign Word16 where
  type SignOf Word16 = Int16
  sign :: Word16 -> SignOf Word16
sign = Word16 -> SignOf Word16
forall a b. (Integral a, Num b) => a -> b
fromIntegral
  {-# INLINE sign #-}

instance Sign Word32 where
  type SignOf Word32 = Int32
  sign :: Word32 -> SignOf Word32
sign = Word32 -> SignOf Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral
  {-# INLINE sign #-}

instance Sign Word64 where
  type SignOf Word64 = Int64
  sign :: Word64 -> SignOf Word64
sign = Word64 -> SignOf Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral
  {-# INLINE sign #-}

instance Sign Int where
  type SignOf Int = Int
  sign :: Int -> SignOf Int
sign = Int -> SignOf Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral
  {-# INLINE sign #-}

instance Sign Int8 where
  type SignOf Int8 = Int8
  sign :: Int8 -> SignOf Int8
sign = Int8 -> SignOf Int8
forall a b. (Integral a, Num b) => a -> b
fromIntegral
  {-# INLINE sign #-}

instance Sign Int16 where
  type SignOf Int16 = Int16
  sign :: Int16 -> SignOf Int16
sign = Int16 -> SignOf Int16
forall a b. (Integral a, Num b) => a -> b
fromIntegral
  {-# INLINE sign #-}

instance Sign Int32 where
  type SignOf Int32 = Int32
  sign :: Int32 -> SignOf Int32
sign = Int32 -> SignOf Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral
  {-# INLINE sign #-}

instance Sign Int64 where
  type SignOf Int64 = Int64
  sign :: Int64 -> SignOf Int64
sign = Int64 -> SignOf Int64
forall a b. (Integral a, Num b) => a -> b
fromIntegral
  {-# INLINE sign #-}