Skip to content

Commit

Permalink
Fixing up haddock
Browse files Browse the repository at this point in the history
Detection of haddock has some issues with leading whitespace, which is
the vast majority of the change here.

Adds some missing docs/since annotations along the way.
  • Loading branch information
telser committed Oct 29, 2024
1 parent c294876 commit 2eacb15
Show file tree
Hide file tree
Showing 127 changed files with 1,260 additions and 2,387 deletions.
24 changes: 8 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ import qualified Data.Text as T
import qualified Orville.PostgreSQL as O
import qualified Orville.PostgreSQL.AutoMigration as AutoMigration

{- |
Pet is a plain old Haskell record that will be marshalled to and from the
{- | Pet is a plain old Haskell record that will be marshalled to and from the
@pet@ table.
-}
data Pet =
Expand All @@ -69,39 +68,34 @@ data Pet =
, petName :: T.Text
}

{- |
It's good practice to create newtype specific to each entity to hold its
{- | It's good practice to create newtype specific to each entity to hold its
primary key value
-}
newtype PetId = PetId Int32

{- |
A marshaller must be defined to convert Pet to and from SQL.
{- | A marshaller must be defined to convert Pet to and from SQL.
-}
petMarshaller :: O.SqlMarshaller Pet Pet
petMarshaller =
Pet
<$> O.marshallField petId petIdField
<*> O.marshallField petName nameField

{- |
Defines the @id@ field for the marshaller to marshall the 'petId' record
{- | Defines the @id@ field for the marshaller to marshall the 'petId' record
field to and from.
-}
petIdField :: O.FieldDefinition O.NotNull PetId
petIdField =
O.coerceField (O.integerField "id")

{- |
Defines the @name@ field for the marshaller to marshall the 'petName' record
{- | Defines the @name@ field for the marshaller to marshall the 'petName' record
field to and from.
-}
nameField :: O.FieldDefinition O.NotNull T.Text
nameField =
O.unboundedTextField "name"

{- |
Marshaller above is associated with the @pet@ table. The marshallers fields
{- | Marshaller above is associated with the @pet@ table. The marshallers fields
will define the column of the table.
-}
petTable :: O.TableDefinition (O.HasKey PetId) Pet Pet
Expand All @@ -111,8 +105,7 @@ petTable =
(O.primaryKey petIdField)
petMarshaller

{- |
A simple demo that connects to a database, inserts 2 pets and then finds the
{- | A simple demo that connects to a database, inserts 2 pets and then finds the
pet named "Spot"
-}
main :: IO ()
Expand All @@ -133,8 +126,7 @@ main = do
Nothing -> putStrLn "No Spot Found!"
Just _spot -> putStrLn "Spot found!"

{- |
The Orville monad provides a starter pack for running Orville operations
{- | The Orville monad provides a starter pack for running Orville operations
against a connection pool.
-}
insertAndFindSpot :: O.Orville (Maybe Pet)
Expand Down
24 changes: 8 additions & 16 deletions orville-docsite/samples/hero/src/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import qualified Data.Text as T
import qualified Orville.PostgreSQL as O
import qualified Orville.PostgreSQL.AutoMigration as AutoMigration

{- |
Pet is a plain old Haskell record that will be marshalled to and from the
{- | Pet is a plain old Haskell record that will be marshalled to and from the
@pet@ table.
-}
data Pet =
Expand All @@ -15,39 +14,34 @@ data Pet =
, petName :: T.Text
}

{- |
It's good practice to create newtype specific to each entity to hold its
{- | It's good practice to create newtype specific to each entity to hold its
primary key value
-}
newtype PetId = PetId Int32

{- |
A marshaller must be defined to convert Pet to and from SQL.
{- | A marshaller must be defined to convert Pet to and from SQL.
-}
petMarshaller :: O.SqlMarshaller Pet Pet
petMarshaller =
Pet
<$> O.marshallField petId petIdField
<*> O.marshallField petName nameField

{- |
Defines the @id@ field for the marshaller to marshall the 'petId' record
{- | Defines the @id@ field for the marshaller to marshall the 'petId' record
field to and from.
-}
petIdField :: O.FieldDefinition O.NotNull PetId
petIdField =
O.coerceField (O.integerField "id")

{- |
Defines the @name@ field for the marshaller to marshall the 'petName' record
{- | Defines the @name@ field for the marshaller to marshall the 'petName' record
field to and from.
-}
nameField :: O.FieldDefinition O.NotNull T.Text
nameField =
O.unboundedTextField "name"

{- |
Marshaller above is associated with the @pet@ table. The marshallers fields
{- | Marshaller above is associated with the @pet@ table. The marshallers fields
will define the column of the table.
-}
petTable :: O.TableDefinition (O.HasKey PetId) Pet Pet
Expand All @@ -57,8 +51,7 @@ petTable =
(O.primaryKey petIdField)
petMarshaller

{- |
A simple demo that connects to a database, inserts 2 pets and then finds the
{- | A simple demo that connects to a database, inserts 2 pets and then finds the
pet named "Spot"
-}
main :: IO ()
Expand All @@ -79,8 +72,7 @@ main = do
Nothing -> putStrLn "No Spot Found!"
Just _spot -> putStrLn "Spot found!"

{- |
The Orville monad provides a starter pack for running Orville operations
{- | The Orville monad provides a starter pack for running Orville operations
against a connection pool.
-}
insertAndFindSpot :: O.Orville (Maybe Pet)
Expand Down
3 changes: 1 addition & 2 deletions orville-docsite/site-builder/site.hs
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,7 @@ applyDefaultLayout navContext itemContext item = do
(navContext <> itemContext)
item

{- |
Nav links are generated from a named snapshot of the content items to
{- | Nav links are generated from a named snapshot of the content items to
avoid the dependency cycle introduced by an item needing a nav link to
itself.
-}
Expand Down
2 changes: 1 addition & 1 deletion orville-postgresql/orville-postgresql.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 1.12

-- This file has been generated from package.yaml by hpack version 0.36.0.
-- This file has been generated from package.yaml by hpack version 0.37.0.
--
-- see: https://github.com/sol/hpack

Expand Down
Loading

0 comments on commit 2eacb15

Please sign in to comment.