Git Product home page Git Product logo

fparsec-pipes's People

Contributors

kkm000 avatar mrakgr avatar rspeele avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

fparsec-pipes's Issues

What is the technique used to accumulate function arguments?

You probably know what I mean:

let num: Parser<int,unit> =
    %% +.digits 1 -- +.digits 2 -- +.digits 3 -- +.digits 4 -- +.digits 5 -- +.digits 6 -- +.digits 7
    -%> fun a b c d e f g -> f

I've been studying the library for a while now and though I'd ask how is it possible to get that precise -%> fun a b c d e f g -> f dependent on the parsers used previously without pattern matching on tuples like in Fparsec?

Actually, I was sure being able to take the correct number of arguments at the end as if accumulating them would be something impossible in F#, but you proved me wrong. Of course, I've been studying the code, but it is not really obvious what is happening there and I am not sure how to come up with a minimalist example. I would not mind if you gave me a pointer. Thanks!

Edit: Actually, what the linkBeyond5 example does just dawned on me. It is similar to this:

let a = "asd"
let b = 2
let c = 'a'

let w = a |> (fun a b c -> c)
let e = b |> w
let r = c |> e

But still, the Pipes library takes all the arguments at the end, not at the start. How is that possible?

Edit2: I figured this out too. I asked because I thought I would not be able to do it, but I guess I did.

let a = "asd"
let b = 2
let c = 'a'

let w f = a |> f
let e f = b |> w f
let r f = c |> e f

r (fun a b c -> c)

You just pass in an argument acting as an accumulator. This does not explain everything, but now I understand what Pipes is doing. I feel like I have a firm basis now. Thanks for the novel idea. I'll definitely be using Pipes to write the parser I am about to do.

Support .NET Framework

Yes, a deliberate pun on the #7's title :)

I am wondering why support for the framework had to go with the commits de52172 and 69fd979. FParsec itself still targets as low as net40 (I think F# 4.1 may generate code only for net45 and above, though). It also seems that these changes did not require any APIs beyond 1.6, if I am not mistaken, so 2.0 seems too high for a library.

One of these commits did away with the README.md and LICENSE files by the way. It's not clear if that was intentional.

Type annotation required for first intro example

I was having issues with the intro code in VSCode on Windows with the Ionide plugin.

Specifically:
// Parses count digits and returns the result as an integer. let digits (count : int) = %% +.(qty.[count] * digit) -%> (String >> Int32.Parse)
was complaining about the (String >> Int32.Parse) construct needing a type annotation to allow the String constructor to be resolved.

I ended up (after some assistance on fsharp slack) going with:
let digits (count : int) = %% +.(qty.[count] * digit) -%> (fun (chars:char[]) -> String(chars) |> Int32.Parse )

which worked for me

Parsers using this library compile very slowly

The included example project, Examples.SQLite, takes 25 seconds to compile on my PC. Most F# projects compile in 1-2 seconds.

This also makes Intellisense extremely sluggish. Finally, third party tools using F# compiler services, such as the F# Power Tools extension for Visual Studio, take ages to perform simple tasks.

Exception from HRESULT: 0x80131044

I am so sorry to raise an issue. I can't, for the life me me, get even the most basic code to work. I have a horrible feeling that this has nothing to do with your code.

#I @"../packages/fparsec/lib/netstandard1.6"
#r @"fparseccs.dll"
#r @"fparsec.dll"
#I @"../packages/fparsec-pipes/lib/netstandard1.6"
#r @"fparsec-pipes.dll"

open FParsec
open FParsec.Pipes
open System

// Parses `count` digits and returns the result as an integer.
let digits (count : int) =
    %% +.(qty.[count] * digit)
    -|> (String >> Int32.Parse)

and I get this output when I run it in FSI

error FS0193: Could not load file or assembly 'FParsecCS, Version=1.0.3.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.