From b86104ac9288c4b921c1c27abec8ca658af5cf7c Mon Sep 17 00:00:00 2001 From: Jamie Willis Date: Sat, 12 Jun 2021 15:47:17 +0100 Subject: [PATCH] Added documentation to the bridge --- ChangeLog.md | 2 +- parsley-garnish.cabal | 2 +- src/Parsley/Internal/Bridge.hs | 49 ++++++++++++++++++++++++++-------- 3 files changed, 40 insertions(+), 13 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index cf3eb34..4b5e81f 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -8,7 +8,7 @@ * Support for GHC 9.0 in place. -## 0.1.1.0 -- 2021-06-12 +## 1.0.0.0 -- 2021-06-12 * Switched to support `parsley-core` as the base * Introduced the `Parsley.Internal.Bridge` module to provide functions for the plugin to latch onto \ No newline at end of file diff --git a/parsley-garnish.cabal b/parsley-garnish.cabal index 050d6d2..88f33b8 100644 --- a/parsley-garnish.cabal +++ b/parsley-garnish.cabal @@ -1,5 +1,5 @@ name: parsley-garnish -version: 0.1.1.0 +version: 1.0.0.0 synopsis: A collection of GHC plugins to work with parsley description: This package contains a collection (for now one) to help remove boilerplate when writing parsers using @parsley@. diff --git a/src/Parsley/Internal/Bridge.hs b/src/Parsley/Internal/Bridge.hs index db2df4f..0b24c55 100644 --- a/src/Parsley/Internal/Bridge.hs +++ b/src/Parsley/Internal/Bridge.hs @@ -1,18 +1,45 @@ +{-| +Module : Parsley.Internal.Bridge +Description : Stable and package independent names for portions of the @parsley-core@ API +License : BSD-3-CLAUSE +Maintainer : Jamie Willis +Stability : stable + +The plugins in this package depend on internals defined in @parsley-core@. This +is fine, but we'd prefer our users to not have to explicitly depend on @parsley-core@ +to use the plugins. This module is used to provide stable names for the plugins +to latch onto. It should not be imported by users of the plugins! +-} module Parsley.Internal.Bridge (_code, _val, makeQ, mkVal, mkCode) where -import qualified Parsley.Internal.Common.Utils as Parsley (Quapplicative(..), Code) +import qualified Parsley.Internal (Quapplicative(..), Code) -_code :: Parsley.Quapplicative q => q a -> Parsley.Code a -_code = Parsley._code +{-| +Re-export of `Parsley.Internal._code` +-} +_code :: Parsley.Internal.Quapplicative q => q a -> Parsley.Internal.Code a +_code = Parsley.Internal._code -_val :: Parsley.Quapplicative q => q a -> a -_val = Parsley._val +{-| +Re-export of `Parsley.Internal._val` +-} +_val :: Parsley.Internal.Quapplicative q => q a -> a +_val = Parsley.Internal._val -makeQ :: Parsley.Quapplicative q => a -> Parsley.Code a -> q a -makeQ = Parsley.makeQ +{-| +Re-export of `Parsley.Internal.makeQ` +-} +makeQ :: Parsley.Internal.Quapplicative q => a -> Parsley.Internal.Code a -> q a +makeQ = Parsley.Internal.makeQ -mkVal :: Parsley.Quapplicative q => a -> q a -mkVal x = Parsley.makeQ x undefined +{-| +Produces `Parsley.Internal.Quapplicative` values without code (unsafe!) +-} +mkVal :: Parsley.Internal.Quapplicative q => a -> q a +mkVal x = Parsley.Internal.makeQ x undefined -mkCode :: Parsley.Quapplicative q => Parsley.Code a -> q a -mkCode qx = Parsley.makeQ undefined qx \ No newline at end of file +{-| +Produces `Parsley.Internal.Quapplicative` values without values (unsafe!) +-} +mkCode :: Parsley.Internal.Quapplicative q => Parsley.Internal.Code a -> q a +mkCode qx = Parsley.Internal.makeQ undefined qx \ No newline at end of file