quickpull- Generate Main module with QuickCheck tests

Safe HaskellSafe-Inferred




concatDirs :: FilePath -> [FilePath] -> FilePathSource

Takes a stack of directories and a directory where reading was started; returns a single path to the relevant directory.



:: [FilePath]

Stack of directories. When descending through a tree, add new directories to the head of this list.

-> FilePath

Reading was started in this directory

-> IO [ModDesc] 

Pulls all modules from a given directory.



:: FilePath

Start reading at this directory. This must be a directory; otherwise a runtime error will occur.

-> IO [ModDesc] 

Pulls all modules from the given directory. A module is any file that begins with a capital letter and ends in .hs.



:: ModDesc 
-> String

Module text

-> [(Meta, Qual)] 

Pulls all properties from the text of a file. Properties that are Testable must begin with prop_. Properties that are a TestTree must begin with proptree_.

Steps in this computation:

  • Split text into lines
  • Add line numbers
  • Extract all lines that have a word in the first column; keep only this first word and discard the rest of the line
  • Sort list by this first word, then reverse the list so that the second occurrence of the word is earlier in the list. This way, if there is a type signature followed by a definition, the type signature is discarded in the next step.
  • use nubBy to remove duplicate words, such as type signatures
  • sort words by line number order, so they're in original order again
  • Create Qinfo; here, words that do not start with prop_ or proptree_ are discarded

readAndParse :: ModDesc -> IO [(Meta, Qual)]Source

Given a ModDesc, reads the module from disk and parses it.