I am trying to separate a F# file in multiple files, although I am currently stuck. I have tried passing the following lines from my original Main.fs to an Ast.fs. In Ast.fs I've put:
...
type StartPosition = Position
type EndPosition = Position
type TokenPosition = TokenPosition of StartPosition * EndPosition
...
I've then added an
open Ast
to my Main.fs. When trying to build, I am now getting the following error
This expression was expected to have type     StartPosition    but here has type     Position
over sp and ep:
let parse_token token = pipe3 getPosition token getPosition (fun sp t ep -> (t, TokenPosition(sp, ep)))
Which doesn't make a lot of sense, I guess, as StartPosition and EndPosition are no more 开发者_如何学Pythonthan "typedefs" of Position. What's wrong here?
You shouldn't be getting this error message if StartPosition was just an alias of Position, so there must be something else that went wrong. It is hard to tell without more complete sample, but here are a few things to check:
- Are you referring to the right - Positiontype? (You can check full information about the type by looking at the tool tip that you get when you place mouse pointer over the type name)
- Is the - Positiontype defined in just a single file? (If another file re-defined it, then you'd have two different types named- Position)
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论