-
Notifications
You must be signed in to change notification settings - Fork 7
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 #1 from ndmitchell/master
Updated fork
- Loading branch information
Showing
9 changed files
with
210 additions
and
28 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
/dist/ | ||
/stack.yaml | ||
trace.js | ||
trace.html | ||
/output/ | ||
.stack-work/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
-- | Module containing functions required by test code. Not part of the public interface. | ||
module Debug.Util( | ||
-- * Exported for tests only | ||
removeLet, | ||
removeExtraDigits | ||
) where | ||
|
||
import Data.List.Extra | ||
|
||
-- | Discover the function name inside (possibly nested) let expressions | ||
-- Transform strings of the form "let (var tag "f" -> f) = f x in f_1" into "f'" | ||
-- Each level of nesting gets a ' (prime) appeneded to the name | ||
removeLet :: String -> String | ||
removeLet str = loop "" str where | ||
loop suffix s = if "let" `isInfixOf` fst (word1 s) | ||
then case stripInfix " = " s of | ||
Just pair -> loop ('\'' : suffix) (snd pair) | ||
Nothing -> s -- this shouldn't happen... | ||
else fst (word1 s) ++ suffix | ||
|
||
-- | Remove possible _n suffix from discovered function names | ||
removeExtraDigits :: String -> String | ||
removeExtraDigits str = case stripInfixEnd "_" str of | ||
Just s -> fst s | ||
Nothing -> str |
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