<commit_before>-- | An eDSL for GPIO computations.
--
-- To make it easier to use the eDSL in typical scenarios, the eDSL is
-- implemented as a transformer using the 'FreeT' transformer.
--
-- As the acronym implies, GPIO means performing I/O; therefore
-- unexpected errors may occur during program excecution. The 'GpioF'
-- eDSL makes allowances for "expected" failures (e.g., attempting to
-- open a pin may fail). How unxpected failures are handled is a
-- detail left to each particular interpreter. The interpreters
-- included in the 'gpio' package strive to cleanly separate errors
-- which occur in the program itself (semantic errors, e.g., writing
-- to a pin that is configured for input), errors which occur in the
-- interpreter implementation (e.g., reading an unexpected value from
-- a sytem-level GPIO interface), and errors which occur during I/O
-- (e.g., while still in use by the program, a pin is unexpectedly
-- unexported by the system or by another program.)

{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE TemplateHaskell #-}

module System.GPIO.Free
       ( GpioF(..)
       , GpioT
       , Pin(..)
       , PinDirection(..)
       , Value(..)
       , pins
       , openPin
       , closePin
       , getPinDirection
       , setPinDirection
       , readPin
       , writePin
       , withPin
       ) where

import Control.Monad.Trans.Free (FreeT, MonadFree, liftF)
import Control.Monad.Free.TH (makeFreeCon)
import GHC.Generics

-- | A GPIO pin, identified by pin number.
data Pin = Pin Int deriving (Eq, Ord, Show, Generic)
<commit_msg>Minor documentation improvements.<commit_after>-- | An eDSL for GPIO computations.
--
-- To make it easier to use the eDSL in typical scenarios, the eDSL is
-- implemented as a transformer using the 'FreeT' transformer.
--
-- As the acronym implies, GPIO means performing I/O; therefore
-- unexpected errors may occur during program excecution. The 'GpioF'
-- eDSL makes allowances for "expected" failures (e.g., attempting to
-- open a pin may fail). How unxpected failures are handled is a
-- detail left to each particular interpreter. The interpreters
-- included in the 'gpio' package strive to cleanly separate errors
-- which occur in the program itself (semantic errors, e.g., writing
-- to a pin that is configured for input), errors which occur in the
-- interpreter implementation (e.g., reading an unexpected value from
-- a sytem-level GPIO interface), and errors which occur during I/O
-- (e.g., while still in use by the program, a pin is unexpectedly
-- unexported by the system or by another program.)

{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE TemplateHaskell #-}

module System.GPIO.Free
       ( -- * The abstract GPIO eDSL
         GpioF(..)
       , pins
       , openPin
       , closePin
       , getPinDirection
       , setPinDirection
       , readPin
       , writePin
       , withPin
         -- * The GpioT monad transformer
       , GpioT
         -- * GPIO types
       , Pin(..)
       , PinDirection(..)
       , Value(..)
       ) where

import Control.Monad.Trans.Free (FreeT, MonadFree, liftF)
import Control.Monad.Free.TH (makeFreeCon)
import GHC.Generics

-- | A GPIO pin, identified by pin number.
data Pin = Pin Int deriving (Eq, Ord, Show, Generic)

{'fraction_non_alphanumeric': 0.10052295177222545, 'fraction_numerical': 0.0, 'mean_word_length': 2.812846068660022, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4297730', 'n_tokens_mistral': 1032, 'n_tokens_neox': 1009, 'n_words': 408}