Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2486 from input-output-hk/tidy-web-common
A little bit of web-common code tidying.
- Loading branch information
Showing
13 changed files
with
48 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
web-common/src/Chain/Eval.purs → web-common/src/Chain/State.purs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
module Gists.Types | ||
( GistAction(..) | ||
, parseGistUrl | ||
) where | ||
|
||
import Data.Array.NonEmpty as NonEmptyArray | ||
import Data.Either (Either, note) | ||
import Data.String.Regex (Regex, match, regex) | ||
import Data.String.Regex.Flags (ignoreCase) | ||
import Gist (GistId(..)) | ||
import Prelude (bind, ($), (<$>)) | ||
|
||
data GistAction | ||
= PublishGist | ||
| SetGistUrl String | ||
| LoadGist | ||
|
||
gistIdInLinkRegex :: Either String Regex | ||
gistIdInLinkRegex = regex "^(.*/)?([0-9a-f]{32})$" ignoreCase | ||
|
||
parseGistUrl :: String -> Either String GistId | ||
parseGistUrl str = do | ||
gistIdInLink <- gistIdInLinkRegex | ||
note "Could not parse Gist Url" | ||
$ do | ||
matches <- match gistIdInLink str | ||
match <- NonEmptyArray.index matches 2 | ||
GistId <$> match |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters