{-# OPTIONS_GHC -fno-warn-orphans #-}

module Data.BCP47.PathPieces () where

import Control.Error.Util (hush)
import Data.BCP47 (BCP47, fromText, toText)
import Web.PathPieces (PathPiece(..))

instance PathPiece BCP47 where
  fromPathPiece :: Text -> Maybe BCP47
fromPathPiece = forall a b. Either a b -> Maybe b
hush forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either Text BCP47
fromText
  toPathPiece :: BCP47 -> Text
toPathPiece = BCP47 -> Text
toText