Hoogle Search

Within LTS Haskell 24.6 (ghc-9.10.2)

Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.

  1. deriveTextShow2 :: Name -> Q [Dec]

    text-show TextShow.TH

    Generates a TextShow2 instance declaration for the given data type or data family instance. Since: 2

  2. deriveTextShow2Options :: Options -> Name -> Q [Dec]

    text-show TextShow.TH

    Like deriveTextShow2, but takes an Options argument. Since: 3.4

  3. deriveTextShowOptions :: Options -> Name -> Q [Dec]

    text-show TextShow.TH

    Like deriveTextShow, but takes an Options argument. Since: 3.4

  4. derivedLog :: C a => [a] -> [a]

    numeric-prelude MathObj.PowerSeries.Core

    Computes (log x)', that is x'/x

  5. deriveGCompare :: DeriveGCompare t => t -> Q [Dec]

    dependent-sum-template Data.GADT.Compare.TH

    No documentation available.

  6. deriveGEq :: DeriveGEQ t => t -> Q [Dec]

    dependent-sum-template Data.GADT.Compare.TH

    No documentation available.

  7. deriveGShow :: DeriveGShow t => t -> Q [Dec]

    dependent-sum-template Data.GADT.Show.TH

    No documentation available.

  8. deriveEsqueletoRecord :: Name -> Q [Dec]

    esqueleto Database.Esqueleto.Record

    Takes the name of a Haskell record type and creates a variant of that record prefixed with Sql which can be used in esqueleto expressions. This reduces the amount of pattern matching on large tuples required to interact with data extracted with esqueleto. Note that because the input record and the Sql-prefixed record share field names, the {-# LANGUAGE DuplicateRecordFields #-} extension is required in modules that use deriveEsqueletoRecord. Additionally, the {-# LANGUAGE TypeApplications #-} extension is required for some of the generated code. Given the following record:

    data MyRecord = MyRecord
    { myName    :: Text
    , myAge     :: Maybe Int
    , myUser    :: Entity User
    , myAddress :: Maybe (Entity Address)
    }
    
    $(deriveEsqueletoRecord ''MyRecord) will generate roughly the following code:
    data SqlMyRecord =
    SqlMyRecord { myName    :: SqlExpr (Value Text)
    , myAge     :: SqlExpr (Value (Maybe Int))
    , myUser    :: SqlExpr (Entity User)
    , myAddress :: SqlExpr (Maybe (Entity Address))
    }
    
    instance SqlSelect SqlMyRecord MyRecord where
    sqlSelectCols
    identInfo
    SqlMyRecord { myName    = myName
    , myAge     = myAge
    , myUser    = myUser
    , myAddress = myAddress
    } =
    sqlSelectCols identInfo (myName :& myAge :& myUser :& myAddress)
    
    sqlSelectColCount _ =
    sqlSelectColCount
    (Proxy @(   (SqlExpr (Value Text))
    :& (SqlExpr (Value (Maybe Int)))
    :& (SqlExpr (Entity User))
    :& (SqlExpr (Maybe (Entity Address)))))
    
    sqlSelectProcessRow columns =
    first ((fromString "Failed to parse MyRecord: ") <>)
    (evalStateT process columns)
    where
    process = do
    Value myName <- takeColumns @(SqlExpr (Value Text))
    Value myAge  <- takeColumns @(SqlExpr (Value (Maybe Int)))
    myUser       <- takeColumns @(SqlExpr (Entity User))
    myAddress    <- takeColumns @(SqlExpr (Maybe (Entity Address)))
    pure MyRecord { myName = myName
    , myAge = myAge
    , myUser = myUser
    , myAddress = myAddress
    }
    
    Then, we could write a selection function to use the record in queries:
    getMyRecord :: SqlPersistT IO [MyRecord]
    getMyRecord = select myRecordQuery
    
    myRecordQuery :: SqlQuery SqlMyRecord
    myRecordQuery = do
    user :& address <- from $
    table @User
    `leftJoin`
    table @Address
    `on` (do \(user :& address) -> user ^. #address ==. address ?. #id)
    pure
    SqlMyRecord
    { myName = castString $ user ^. #firstName
    , myAge = val 10
    , myUser = user
    , myAddress = address
    }
    

  9. deriveEsqueletoRecordWith :: DeriveEsqueletoRecordSettings -> Name -> Q [Dec]

    esqueleto Database.Esqueleto.Record

    Takes the name of a Haskell record type and creates a variant of that record based on the supplied settings which can be used in esqueleto expressions. This reduces the amount of pattern matching on large tuples required to interact with data extracted with esqueleto. This is a variant of deriveEsqueletoRecord which allows you to avoid the use of {-# LANGUAGE DuplicateRecordFields #-}, by configuring the DeriveEsqueletoRecordSettings used to generate the SQL record.

  10. deriveViaOnLoc :: DynFlags -> SrcSpan

    ghc-lib-parser GHC.Driver.DynFlags

    No documentation available.

Page 18 of many | Previous | Next