-
Notifications
You must be signed in to change notification settings - Fork 10
Source organisation
sandersn edited this page Nov 8, 2010
·
5 revisions
Caveat: although I am fairly happy with module organisation, all modules expose far too many of their internal details. That’s largely because it’s not a problem yet, and because I haven’t figured out a way to test private functions.
- Fing/ contains the code.
- FingTest/ contains the tests.
- FingTest/Tester.fs contains all of the tests so far. So far each module has a type dedicated to testing it, but all the types are in the same file. This should change some time in the future.
- FingTest/Script.fsx contains a script that loads Fing for interactive use. This should move somewhere more prominent, probably the root.
- fparsec/ contains a compatible version of FParsec (0.8 currently).
- Fing/ contains the code:
- Types.fs contains the basic types, plus output and canonicalisation (via a process similar to de Bruijn indexing)
- First is an embarrassing list of hard-coded type aliases for the standard .NET types, eg
obj => System.Object
. -
Typar
represents type variables:'a, ^a, _ and ('a or 'b or 'c)
. -
Property
represents thewith get,set
syntax available for structural typing of properties. -
Typ
represents types: arrows, tuples, type variables, identifiers, etc. -
When
represnts type constraints: nullable, value type, reference type, structural typing, etc. -
fold
folds aTyp
to some other type. -
map
maps aTyp
to some otherTyp
of a similar shape. -
format
returns an F#-syntax string forTyp
objects. -
index
renames type variables in aTyp
such that variables start from'a, 'b, 'c ...
.
- First is an embarrassing list of hard-coded type aliases for the standard .NET types, eg
- ParsedTypes.fs contains functions that manipulate
Typ
objects obtained from user input.-
dealias
converts F# abbreviations likeint
andobj
to their standard .NET types. Using a hard-coded map, which is Fairly Stupid.
-
- FSharpTypes.fs contains functions that manipulate
Typ
objects obtained from FSharp.PowerPack.Metadata.-
debinarize
flattens binary-nested arrows to flat, n-ary ones. Internally, the Metadata powerpack represents arrows as('a -> ('b -> ('c -> 'd)))
even though this is equivalent to('a -> 'b -> 'c -> 'd)
. In order to search for incorrect argument orders, I standardised on n-ary arrows rather than binary nested ones. -
cvt
(and supporting functionsisArray, dimensions, tryFindConstraint and optionsum
) convertsFSharp.Powerpack.Metadata.FSharpType
objects toTyp
objects. This code works for types without constraints, but the constraint conversion code (inconvertParam
andwhenify
) is not finished.
-
- CSharpTypes.fs contains functions that manipulate
Typ
objects obtained from System.Reflection.- CSharpTypes.fs is empty! It will contain code in the future.
- Search.cs contains the search code.
-
variants
generates all variants of aTyp
. For example, tuples and arrows (up to length 5) will search all orders of their arguments. -
matches
determines whether two @Typ@s match.
-
- Fing.fs contains the public interface.
-
Result
is a search result, with theTyp
as well as the matching MetadataFSharpMemberOrVal
and its containingFSharpEntity
. -
formatResult
formats aResult
for console-based output. -
assemblies
is a Set of assemblies to search. -
types
is the list of all types that can be searched for. -
addReferences
adds assembly references toassemblies
and callsupdateReferences
. -
updateReferences
throws away the existingtypes
and refreshes it, including new assembly references. -
typeFind
filterstypes
thatmatch
the type passed as a string. -
nameFind
filterstypes
whoseDisplayName
equals the passed string. -
search
callstypeFind
if the passed string contains"->"
, otherwisenameFind
. -
textSearch
formats the sequence returned bysearch
and prints it to standard output.
-
- Opt.cs parses command line options.
- There is, apparently, no standard library for this in .NET?
-
parse
parses command line options.
- Program.cs contains the command line interface code.
-
main
is the entry point.
- Types.fs contains the basic types, plus output and canonicalisation (via a process similar to de Bruijn indexing)