Skip to content

Commit

Permalink
Added documentation to the bridge
Browse files Browse the repository at this point in the history
  • Loading branch information
j-mie6 committed Jun 12, 2021
1 parent b2489c1 commit b86104a
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 13 deletions.
2 changes: 1 addition & 1 deletion ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion parsley-garnish.cabal
Original file line number Diff line number Diff line change
@@ -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@.
Expand Down
49 changes: 38 additions & 11 deletions src/Parsley/Internal/Bridge.hs
Original file line number Diff line number Diff line change
@@ -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
{-|
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

0 comments on commit b86104a

Please sign in to comment.