changes parsing rules around empty extensions

This commit is contained in:
Keagan McClelland
2020-01-15 15:23:56 -07:00
parent bd5ee1eb50
commit bed96def2e

View File

@@ -79,10 +79,11 @@ instance KnownSymbol a => Show (Extension a) where
show e@(Extension file) = file <.> extension e show e@(Extension file) = file <.> extension e
instance KnownSymbol a => Read (Extension a) where 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 where
(fileName, fileExt) = splitExtension s (file, ext') = splitExtension s
ext' = extension (def :: Extension a)
withPeriod :: String -> String withPeriod :: String -> String
withPeriod word@(a:_) = case a of withPeriod word@(a:_) = case a of