This file contains hidden or 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
| newtype Degree = Degree Float | |
| newtype Radian = Radian Float | |
| toRad :: Degree -> Radian | |
| toRad (Degree deg) = Radian (deg * pi / 180) | |
| -- this works | |
| new1 = toRad (Degree 90.0) | |
| -- this doesn't work |
This file contains hidden or 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
| public bool Execute() | |
| { | |
| int line, col; | |
| view.GetCaretPos(out line, out col); | |
| indenter.SetIndentationForNextLine(line); | |
| return false; | |
| } |
This file contains hidden or 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
| string diffContent = File.ReadAllText("MyDiffFile.diff"); | |
| Diff diff = Diff.CreateFrom(diffContent); |
This file contains hidden or 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
| @@ -1,3 +1,6 @@ | |
| This is a small text file | |
| +that I quite like, | |
| with a few lines of text | |
| -inside, nothing much. |
This file contains hidden or 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
| public class BooViewFilter : ViewFilter | |
| { | |
| public BooViewFilter(CodeWindowManager mgr, IVsTextView view) : base(mgr, view) | |
| {} | |
| } |
This file contains hidden or 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
| public void RebuildGitNumstatParser() | |
| { | |
| var contents = File.ReadAllText(@"..\..\..\SharpDiff\Parsers\GitNumstatParser.ometacs"); | |
| var result = Grammars.ParseGrammarThenOptimizeThenTranslate | |
| <OMetaParser, OMetaOptimizer, OMetaTranslator> | |
| (contents, | |
| p => p.Grammar, | |
| o => o.OptimizeGrammar, | |
| t => t.Trans); | |
This file contains hidden or 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
| [Test] | |
| public void ParsesNumber() | |
| { | |
| var result = Parse<int>("1", x => x.Number); | |
| Assert.That(result, Is.EqualTo(1)); | |
| } |
This file contains hidden or 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
| [Test] | |
| public void ParsesAdditionsAndSubtractionValues() | |
| { | |
| var result = Parse<FileStats>("3\t8\tmyFile.txt\r\n", x => x.Number); | |
| Assert.That(result.Additions, Is.EqualTo(3)); | |
| Assert.That(result.Subtractions, Is.EqualTo(8)); | |
| } |
This file contains hidden or 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
| public class FileStats | |
| { | |
| public FileStats(int additions, int subtractions) | |
| { | |
| Additions = additions; | |
| Subtractions = subtractions; | |
| } | |
| public int Additions { get; private set; } | |
| public int Subtractions { get; private set; } |
This file contains hidden or 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
| using SharpDiff.FileStructure.Numstat; | |
| using OMetaSharp; | |
| ometa GitNumstatParser : Parser { | |
| FileStats = Number:adds '\t' Number:subs -> { new FileStats(adds.As<int>(), subs.As<int>()) } | |
| } |
OlderNewer