**Packages**- is:exact
- base
- extra
- nri-prelude
- dejafu
- Cabal
- hedgehog
- base-compat
- protolude
- base-prelude
- haskell-gi-base
- rio
- classy-prelude
- numeric-prelude
- basic-prelude
- relude
- foundation
- universum
- basement
- dimensional
- ghc
- ghc-lib-parser
- prelude-compat
- clash-prelude
- llvm-hs-pure
- rebase
- xmonad-contrib
- numhask
- LambdaHack
- mixed-types-num
- loc
- yesod-paginator
- distribution-opensuse
- faktory
- hledger-web
- arithmoi
- combinatorial
- ghc-prim
- type-map
- unsafe
- singleton-bool
- opaleye

Specialised numeric conversion, type restricted version of
fromIntegral.

Convert an integer into a float. Useful when mixing `Int` and
`Float` values like this:

halfOf :: Int -> Float halfOf number = toFloat number / 2

Helper function for constructing IDs of any sort.

base Prelude GHC.Enum, Cabal Distribution.Compat.Prelude.Internal, hedgehog Hedgehog.Internal.Prelude, base-compat Prelude.Compat, protolude Protolude Protolude.Base, base-prelude BasePrelude, haskell-gi-base Data.GI.Base.ShortPrelude, rio RIO.Partial, classy-prelude ClassyPrelude, numeric-prelude NumericPrelude NumericPrelude.Base, basic-prelude CorePrelude, relude Relude.Enum, foundation Foundation, universum Universum.Base, basement Basement.Compat.Base Basement.Imports, dimensional Numeric.Units.Dimensional.Prelude, ghc GhcPrelude, ghc-lib-parser GHC.Prelude, prelude-compat Prelude2010, clash-prelude Clash.HaskellPrelude, llvm-hs-pure LLVM.Prelude, rebase Rebase.Prelude, xmonad-contrib XMonad.Config.Prime, numhask NumHask.Prelude, LambdaHack Game.LambdaHack.Core.Prelude, mixed-types-num Numeric.MixedTypes.PreludeHiding, loc Data.Loc.Internal.Prelude, yesod-paginator Yesod.Paginator.Prelude, distribution-opensuse OpenSuse.Prelude, faktory Faktory.Prelude, hledger-web Hledger.Web.Import

Convert from an Int.

Coerce a value from one type to another, bypassing the type-checker.
There are several legitimate ways to use unsafeCoerce:
`unsafeCoerce HRefl` is safe, because the two
types really are the same -- but the proof of that relies on the
complex, trusted implementation of `Typeable`.

- To coerce e.g.
`Int`to`HValue`, put it in a list of`HValue`, and then later coerce it back to`Int`before using it. - To produce e.g.
`(a+b) :~: (b+a)`from`unsafeCoerce Refl`. Here the two sides really are the same type -- so nothing unsafe is happening -- but GHC is not clever enough to see it. - In
`Data.Typeable`we have

eqTypeRep :: forall k1 k2 (a :: k1) (b :: k2). TypeRep a -> TypeRep b -> Maybe (a :~~: b) eqTypeRep a b | sameTypeRep a b = Just (unsafeCoerce HRefl) | otherwise = NothingHere again, the

- The "reflection trick", which takes advantanage of the fact that
in
`class C a where { op :: ty }`, we can safely coerce between`C a`and`ty`(which have different kinds!) because it's really just a newtype. Note: there is*no guarantee, at all*that this behavior will be supported into perpetuity.

unsafeCoerce# :: forall (r1 :: RuntimeRep) (r2 :: RuntimeRep) (a :: TYPE r1) (b :: TYPE r2) . a -> b

Highly, terribly dangerous coercion from one representation type to
another. Misuse of this function can invite the garbage collector to
trounce upon your data and then laugh in your face. You don't want
this function. Really.

The function `unsafeCoerce#` allows you to side-step the
typechecker entirely. That is, it allows you to coerce any type into
any other type. If you use this function, you had better get it right,
otherwise segmentation faults await. It is generally used when you
want to write a program that you know is well-typed, but where
Haskell's type system is not expressive enough to prove that it is
well typed.
The following uses of `unsafeCoerce#` are supposed to work
(i.e. not lead to spurious compile-time or run-time crashes):
`unsafeCoerce#` are undefined. In particular, you
should not use `unsafeCoerce#` to cast a T to an algebraic data
type D, unless T is also an algebraic data type. For example, do not
cast `Int->Int` to `Bool`, even if you later cast
that `Bool` back to `Int->Int` before applying it.
The reasons have to do with GHC's internal representation details (for
the cognoscenti, data values can be entered but function closures
cannot). If you want a safe type to cast things to, use `Any`,
which is not an algebraic data type.
*Warning:* this can fail with an unchecked exception.

- Casting any lifted type to
`Any` - Casting
`Any`back to the real type - Casting an unboxed type to another unboxed type of the same size.
(Casting between floating-point and integral types does not work. See
the
`GHC.Float`module for functions to do work.) - Casting between two types that have the same runtime
representation. One case is when the two types differ only in
"phantom" type parameters, for example
`Ptr Int`to`Ptr Float`, or`[Int]`to`[Float]`when the list is known to be empty. Also, a`newtype`of a type`T`has the same representation at runtime as`T`.

unsafeCoerce# :: forall (k0 :: RuntimeRep) (k1 :: RuntimeRep) (a :: TYPE k0) (b :: TYPE k1) . a -> b

The function `unsafeCoerce#` allows you to side-step the
typechecker entirely. That is, it allows you to coerce any type into
any other type. If you use this function, you had better get it right,
otherwise segmentation faults await. It is generally used when you
want to write a program that you know is well-typed, but where
Haskell's type system is not expressive enough to prove that it is
well typed.
The following uses of `unsafeCoerce#` are supposed to work
(i.e. not lead to spurious compile-time or run-time crashes):
`unsafeCoerce#` are undefined. In particular, you
should not use `unsafeCoerce#` to cast a T to an algebraic data
type D, unless T is also an algebraic data type. For example, do not
cast `Int->Int` to `Bool`, even if you later cast
that `Bool` back to `Int->Int` before applying it.
The reasons have to do with GHC's internal representation details (for
the cognoscenti, data values can be entered but function closures
cannot). If you want a safe type to cast things to, use `Any`,
which is not an algebraic data type.
*Warning:* this can fail with an unchecked exception.

- Casting any lifted type to
`Any` - Casting
`Any`back to the real type - Casting an unboxed type to another unboxed type of the same size.
(Casting between floating-point and integral types does not work. See
the
`GHC.Float`module for functions to do work.) - Casting between two types that have the same runtime
representation. One case is when the two types differ only in
"phantom" type parameters, for example
`Ptr Int`to`Ptr Float`, or`[Int]`to`[Float]`when the list is known to be empty. Also, a`newtype`of a type`T`has the same representation at runtime as`T`.

toFields provides a convenient typeclass wrapper around the
Field_ creation functions in Opaleye.SqlTypes. Besides
convenience it doesn't provide any additional functionality.
It can be used with functions like runInsert to insert custom
Haskell types into the database. The following is an example of a
function for inserting custom types.
`ToFields` for your custom
types.

customInsert :: ( DefaultIn order to use this function with your custom types, you need to define an instance of DefaultToFieldshaskells fields ) => Connection -> Table fields fields' -> [haskells] -> IO Int64 customInsert conn table haskells = runInsert_ conn Insert { iTable = table , iRows = map toFields haskells , iReturning = rCount , iOnConflict = Nothing }

Version of toFields with better type inference