Generic function definitions in F# signature files and corresponding implementation file -


i'm trying create abstraction lightweight data storage module using f# signature file. here signature file code, let's it's called repository.fsi

namespace datastorage  /// <summary>lightweight repository abstraction</summary> module repository =     /// <summary> insert data repository </summary>    val put: 'a -> unit    /// <summary> fetch data repository </summary>    val fetch: 'a -> 'b    /// <summary> remove data repository </summary>    val remove: 'a -> unit 

here corresponding implementation, let's call repository.fs

namespace datastorage  module repository =       (* put document database collection *)     let put entity = ()      (* select document database collection *)     let fetch key = ("key",5)      (* remove document database collection *)     let remove entity = () 

in visual studio project file have signature file (repository.fsi) above implementation file (repository.fs). put , remove functions being parsed , verified correctly no errors (in implementation file) fetch function keeps giving me red squiggly in visual studio following error message:

module 'datastorage.repository' contains

val fetch: s:string -> string * int 

but signature specifies

val fetch<'a,'b> : 'a -> 'b 

the respective type parameter counts differ

can tell me i'm doing wrong? fetch function value defined wrong in signature file? i'm trying create generic function ('a -> 'b) in signature file , have implementation take 1 type input , return different type output.

one (some limiting) alternative i've tried sort of 1 step away generics seems work scenario. signature file fetch function looks this.

'a -> repositoryrecord 

and implementation of repositoryrecord algebraic datatype.

type repositoryrecord = | someval1 of int * string | someval2 of string 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -