From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39395) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4ejC-0001Ds-JO for guix-patches@gnu.org; Tue, 17 Oct 2017 23:09:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e4ejA-0004NO-Uu for guix-patches@gnu.org; Tue, 17 Oct 2017 23:09:06 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:38326) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e4ejA-0004NE-RA for guix-patches@gnu.org; Tue, 17 Oct 2017 23:09:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1e4ejA-0004i2-Jc for guix-patches@gnu.org; Tue, 17 Oct 2017 23:09:04 -0400 Subject: [bug#28884] [PATCH 07/38] gnu: Add ghc-language-haskell-extract. Resent-Message-ID: From: rsiddharth Date: Wed, 18 Oct 2017 03:07:27 +0000 Message-Id: <20171018030758.1211-7-s@ricketyspace.net> In-Reply-To: <20171018030758.1211-1-s@ricketyspace.net> References: <20171018030217.1001-1-s@ricketyspace.net> <20171018030758.1211-1-s@ricketyspace.net> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 28884@debbugs.gnu.org Cc: s@ricketyspace.net * gnu/packages/haskell.scm (ghc-language-haskell-extract): New variable. --- gnu/packages/haskell.scm | 66 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/gnu/packages/haskell.scm b/gnu/packages/haskell.scm index 43a8565f6..2f064e2b2 100644 --- a/gnu/packages/haskell.scm +++ b/gnu/packages/haskell.scm @@ -9171,4 +9171,70 @@ between 2 and 3 times faster than the Mersenne Twister.") (description "This Haskell library algorithms for vector arrays.") (license license:bsd-3))) +(define-public ghc-language-haskell-extract + (package + (name "ghc-language-haskell-extract") + (version "0.2.4") + (source + (origin + (method url-fetch) + (uri (string-append "https://hackage.haskell.org/package/" + "language-haskell-extract-" version "/" + "language-haskell-extract-" version ".tar.gz")) + (sha256 + (base32 + "1nxcs7g8a1sp91bzpy4cj6s31k5pvc3gvig04cbrggv5cvjidnhl")))) + (build-system haskell-build-system) + (inputs + `(("ghc-regex-posix" ,ghc-regex-posix))) + (home-page "https://github.com/finnsson/template-helper") + (synopsis "Haskell module to automatically extract functions from +the local code") + (description "This package contains helper functions on top of +Template Haskell. + +@code{functionExtractor} extracts all functions after a regexp-pattern. + +@verbatim + foo = \"test\" + boo = \"testing\" + bar = $\(functionExtractor \"oo$\") +@end verbatim + +will automagically extract the functions ending with @code{oo} such as + +@verbatim + bar = [\(\"foo\",foo), \(\"boo\",boo)] +@end verbatim + +This can be useful if you wish to extract all functions beginning +with test \(for a test-framework) or all functions beginning with wc +\(for a web service). + +@code{functionExtractorMap} works like @code{functionsExtractor} but +applies a function over all function-pairs. + +This functions is useful if the common return type of the functions is +a type class. + +Example: + +@verbatim + secondTypeclassTest = + do let expected = [\"45\", \"88.8\", \"\\\"hej\\\"\"] + actual = $\(functionExtractorMap \"^tc\" [|\\n f -> show f|] ) + expected @=? actual + + tcInt :: Integer + tcInt = 45 + + tcDouble :: Double + tcDouble = 88.8 + + tcString :: String + tcString = \"hej\" +@end verbatim +") + (license license:bsd-3))) + ;;; haskell.scm ends here -- 2.15.0.rc0