From 6d0a5e36e0493d1d1155a8e26d773359d5f84811 Mon Sep 17 00:00:00 2001 From: Keagan McClelland Date: Wed, 15 Jan 2020 15:23:56 -0700 Subject: [PATCH] changes parsing rules around empty extensions --- src/Lib/Registry.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Lib/Registry.hs b/src/Lib/Registry.hs index 32e550d..caa810b 100644 --- a/src/Lib/Registry.hs +++ b/src/Lib/Registry.hs @@ -79,10 +79,11 @@ instance KnownSymbol a => Show (Extension a) where show e@(Extension file) = file <.> extension e instance KnownSymbol a => Read (Extension a) where - readsPrec _ s = [(Extension fileName, "") | ("" <.> fileExt) == ("" <.> ext')] + readsPrec _ s = case (symbolVal $ Proxy @a) of + "" -> [(Extension s, "")] + other -> [(Extension file, "") | ext' == "" <.> other] where - (fileName, fileExt) = splitExtension s - ext' = extension (def :: Extension a) + (file, ext') = splitExtension s withPeriod :: String -> String withPeriod word@(a:_) = case a of