Browse Source

refactor: validatePathInput (#27)

- changed into a guard function instead of if expression.
master
piq9117 2 years ago
committed by Gitea
parent
commit
59c1b58d14
1 changed files with 3 additions and 4 deletions
  1. +3
    -4
      src/UmuReactBasic/Types.hs

+ 3
- 4
src/UmuReactBasic/Types.hs View File

@@ -28,10 +28,9 @@ fromPathInput :: PathInput -> Text
fromPathInput ( PathInput txt ) = txt

validatePathInput :: Text -> Either PathInputError PathInput
validatePathInput txt =
if FP.isValid $ T.unpack txt
then Right $ PathInput txt
else Left PathInputError
validatePathInput txt
| FP.isValid $ T.unpack txt = Right $ PathInput txt
| otherwise = Left PathInputError

newtype ComponentName = ComponentName Text
deriving ( Eq, Show )


Loading…
Cancel
Save