18 lines
406 B
Haskell
18 lines
406 B
Haskell
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
|
|
|
module Data.Scientific.Instances
|
|
(
|
|
) where
|
|
|
|
import ClassyPrelude
|
|
import Data.Scientific
|
|
|
|
import Web.PathPieces
|
|
|
|
import Text.ParserCombinators.ReadP (readP_to_S)
|
|
|
|
|
|
instance PathPiece Scientific where
|
|
toPathPiece = pack . formatScientific Fixed Nothing
|
|
fromPathPiece = fmap fst . listToMaybe . filter (\(_, rStr) -> null rStr) . readP_to_S scientificP . unpack
|