module BishBosh.Property.ForsythEdwards(
ReadsFEN(..),
ShowsFEN(..),
readFEN,
showFEN
) where
import qualified BishBosh.Property.ExtendedPositionDescription as Property.ExtendedPositionDescription
class Property.ExtendedPositionDescription.ReadsEPD a => ReadsFEN a where
readsFEN :: ReadS a
readsFEN = ReadS a
forall a. ReadsEPD a => ReadS a
Property.ExtendedPositionDescription.readsEPD
class Property.ExtendedPositionDescription.ShowsEPD a => ShowsFEN a where
showsFEN :: a -> ShowS
showsFEN = a -> ShowS
forall a. ShowsEPD a => a -> ShowS
Property.ExtendedPositionDescription.showsEPD
type FEN = String
readFEN :: ReadsFEN a => FEN -> a
readFEN :: FEN -> a
readFEN FEN
fen = case ReadS a
forall a. ReadsFEN a => ReadS a
readsFEN FEN
fen of
[(a
a, FEN
_)] -> a
a
[(a, FEN)]
_ -> FEN -> a
forall a. HasCallStack => FEN -> a
error (FEN -> a) -> ShowS -> FEN -> a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FEN -> ShowS
showString FEN
"BishBosh.Property.ForsythEdwards.readFEN:\tfailed to parse " (FEN -> a) -> FEN -> a
forall a b. (a -> b) -> a -> b
$ FEN -> ShowS
forall a. Show a => a -> ShowS
shows FEN
fen FEN
"."
showFEN :: ShowsFEN a => a -> FEN
showFEN :: a -> FEN
showFEN a
a = a -> ShowS
forall a. ShowsFEN a => a -> ShowS
showsFEN a
a FEN
""