Updated to latest versions #2

Merged
merged 11 commits into from May 2, 2011

Projects

None yet

2 participants

@panesofglass
Collaborator

Updated Cashel to F# 2.0, .NET 4.0, FsUnit 0.9 and adjusted namespaces to Cashel. This is a much less drastic than the previous pull request.

@panesofglass

Creates a list from a given string.

@panesofglass

Creates an array segment from the provided string input.

@panesofglass

Creates a new array segment given a string and an offset. This creates an underlying array from the string with an offset already set.

@panesofglass

Same as line 6, but defaulted to an offset of 1 for single character matches.

@panesofglass

F# generally uses structural comparisons. However, NUnit does not, especially when working with general .NET types like ArraySegment. This operator tests the structural sameness of two array segments. The goal is not to have identical ArraySegment instances or even two instances using the same underlying array, as most tests are recreating the array as well for readability. These will likely be refactored once the ArraySegmentPrimitives are refactored to always use the same underlying buffer.

@panesofglass

These are intended to be used in single-threaded event loop state machines (a mouthful) which share a single, segmented memory buffer. Given the specificity of the intended target, this may best be removed. However, it also serves as an example of how one might extend the core functionality of the cashel Parser monad.

@panesofglass

This should really be of type Parser<ArraySegment<'a> list, ArraySegment<'a>>.

@panesofglass

Again, type should be Parser<ArraySegment<'a> list, unit>.

@panesofglass

Combinators matching more than one value should ideally be typed as Parser<ArraySegment<'a> list, ArraySegment<'a> list>. This begins looking hairy, but it matches the intent: keep the values in the original buffer and provide a way to access them. One might presume that a single ArraySegment<'a> is all that's necessary; however, you quickly lose the ability to skip characters that are not needed, and the combinations further up the parse may not match anymore.

@panesofglass panesofglass Removed ArraySegmentPrimitives and merged CharListPrimitives back int…
…o ListPrimitives. The idea behind ArraySegmentPrimitives proved to be flawed.
c95beda
@panesofglass
Collaborator

I just removed the ArraySegment stuff. Turns out it wasn't helpful in the end, as you surmised when we last spoke. :)

@devhawk
Owner
devhawk commented May 2, 2011

So I finally got around to checking out your latest pull request. I'm not 100% sold on FAKE (and the build script needs some cleanup), but I like most of your changes. Question: why did you add ParserBuilder.ReturnFrom, map, unfold and <*>? As far as I can tell, these aren't used anywhere inthe project and have no tests. I assume you added them for a reason?

@devhawk devhawk merged commit 1762417 into devhawk:master May 2, 2011
@panesofglass
Collaborator

Yikes. I thought I had tests for those at some point. I was using them in one of my projects and thought that was the best place to put them, but I should have double-checked that the tests were there. Apologies for that. I'll try to add them soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment