word2Tag :: Word16 -> Tag
word2Tag rawWord =
  case rawWord of
    -- Tags relating to image data structure
    0x0100 -> TImageWidth
    0x0101 -> TImageLength
    0x0102 -> TBitsPerSample
    0x0103 -> TCompression
    0x0106 -> TPhotometricInterpretation
    0x0112 -> TOrientation
    0x0115 -> TSamplesPerPixel
    0x011C -> TPlanarConfiguration
    0x0212 -> TYCbCrSubSampling
    0x0213 -> TYCbCrPositioning
    0x011A -> TXResolution
    0x011B -> TYResolution
    0x0128 -> TResolutionUnit
    -- Tags relating to recording offset
    0x0111 -> TStripOffsets
    0x0116 -> TRowsPerStrip
    0x0117 -> TStripByteCount
    0x0201 -> TJPEGInterchangeFormat
    0x0202 -> TJPEGInterchangeFormatLength
    -- Tags relating to image data characteristics
    0x012D -> TTransferFunction
    0x013E -> TWhitePoint
    0x013F -> TPrimaryChromaticities
    0x0211 -> TYCbCrCoefficients
    0x0214 -> TReferenceBlackWhite
    -- Other tags
    0x0132 -> TDateTime
    0x010E -> TImageDescription
    0x010F -> TMake
    0x0110 -> TModel
    0x0131 -> TSoftware
    0x013B -> TArtist
    0x8298 -> TCopyright
    -- Tags relating to Exif
    0x8769 -> TExifIFDPointer
    0x8825 -> TGPS
    0xA005 -> TInteroperability
    -- Handle unknow and private tags
    _  ->
      if rawWord >= 32768
        then TUnknownPrivateTag rawWord
        else TUnknownTag rawWord
word2Tag :: Word16 -> Tag
word2Tag rawWord =
  case rawWord of
    -- Tags relating to image data structure
    0x0100 -> TImageWidth
    0x0101 -> TImageLength
    0x0102 -> TBitsPerSample
    0x0103 -> TCompression
    0x0106 -> TPhotometricInterpretation
    0x0112 -> TOrientation
    0x0115 -> TSamplesPerPixel
    0x011C -> TPlanarConfiguration
    0x0212 -> TYCbCrSubSampling
    0x0213 -> TYCbCrPositioning
    0x011A -> TXResolution
    0x011B -> TYResolution
    0x0128 -> TResolutionUnit
    -- Tags relating to recording offset
    0x0111 -> TStripOffsets
    0x0116 -> TRowsPerStrip
    0x0117 -> TStripByteCount
    0x0201 -> TJPEGInterchangeFormat
    0x0202 -> TJPEGInterchangeFormatLength
    -- Tags relating to image data characteristics
    0x012D -> TTransferFunction
    0x013E -> TWhitePoint
    0x013F -> TPrimaryChromaticities
    0x0211 -> TYCbCrCoefficients
    0x0214 -> TReferenceBlackWhite
    -- Other tags
    0x0132 -> TDateTime
    0x010E -> TImageDescription
    0x010F -> TMake
    0x0110 -> TModel
    0x0131 -> TSoftware
    0x013B -> TArtist
    0x8298 -> TCopyright
    -- Tags relating to Exif
    0x8769 -> TExifIFDPointer
    0x8825 -> TGPS
    0xA005 -> TInteroperability
    -- Handle unknow and private tags
    _  ->
      if rawWord >= 32768
        then TUnknownPrivateTag rawWord
        else TUnknownTag rawWord
word2Tag rawWord =
  case rawWord of
    -- Tags relating to image data structure
    0x0100 -> TImageWidth
    0x0101 -> TImageLength
    0x0102 -> TBitsPerSample
    0x0103 -> TCompression
    0x0106 -> TPhotometricInterpretation
    0x0112 -> TOrientation
    0x0115 -> TSamplesPerPixel
    0x011C -> TPlanarConfiguration
    0x0212 -> TYCbCrSubSampling
    0x0213 -> TYCbCrPositioning
    0x011A -> TXResolution
    0x011B -> TYResolution
    0x0128 -> TResolutionUnit
    -- Tags relating to recording offset
    0x0111 -> TStripOffsets
    0x0116 -> TRowsPerStrip
    0x0117 -> TStripByteCount
    0x0201 -> TJPEGInterchangeFormat
    0x0202 -> TJPEGInterchangeFormatLength
    -- Tags relating to image data characteristics
    0x012D -> TTransferFunction
    0x013E -> TWhitePoint
    0x013F -> TPrimaryChromaticities
    0x0211 -> TYCbCrCoefficients
    0x0214 -> TReferenceBlackWhite
    -- Other tags
    0x0132 -> TDateTime
    0x010E -> TImageDescription
    0x010F -> TMake
    0x0110 -> TModel
    0x0131 -> TSoftware
    0x013B -> TArtist
    0x8298 -> TCopyright
    -- Tags relating to Exif
    0x8769 -> TExifIFDPointer
    0x8825 -> TGPS
    0xA005 -> TInteroperability
    -- Handle unknow and private tags
    _  ->
      if rawWord >= 32768
        then TUnknownPrivateTag rawWord
        else TUnknownTag rawWord