GHC issueshttps://gitlab.haskell.org/ghc/ghc/-/issues2020-02-24T17:59:27Zhttps://gitlab.haskell.org/ghc/ghc/-/issues/17813Mark template-haskell as explicitly Safe / Trustworthy.2020-02-24T17:59:27ZOleg GrenrusMark template-haskell as explicitly Safe / Trustworthy.The template-haskell modules seem to be trustworthy since 2.12.0.0 or so, but not explicitly marked as such. Package in increasing amount depend on `template-haskell` in simple way, e.e.g to
```
deriving instance Lift URI
```
It would...The template-haskell modules seem to be trustworthy since 2.12.0.0 or so, but not explicitly marked as such. Package in increasing amount depend on `template-haskell` in simple way, e.e.g to
```
deriving instance Lift URI
```
It would be great, if `template-haskell` were explicitly `Safe` / `Trustworthy`. E.g. docs for GHC-8.10.1 rc1 are correctly saying that `Language.Haskell.TH` is "just" `SafeHaskell-inferred`: https://downloads.haskell.org/ghc/8.10.1-rc1/docs/html/libraries/template-haskell-2.16.0.0/Language-Haskell-TH.html
And when I compile a package with `-Winferred-safe-imports` I get
```
Network/URI/Static.hs:27:1: warning: [-Winferred-safe-imports]
Importing Safe-Inferred module Language.Haskell.TH.Lib from explicitly Safe module
|
27 | import Language.Haskell.TH.Lib (ExpQ)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Network/URI/Static.hs:28:1: warning: [-Winferred-safe-imports]
Importing Safe-Inferred module Language.Haskell.TH.Quote from explicitly Safe module
|
28 | import Language.Haskell.TH.Quote (QuasiQuoter(..))
|
```
---
EDIT: The patch should be trivial, as `pretty` is explicitly `Safe`, so keeping SafeHaskell invariant shouldn't be a problem.8.10.1https://gitlab.haskell.org/ghc/ghc/-/issues/17489IsList instance for ZipList should debut in base-4.14.0.0, not 4.15.0.02020-02-25T01:03:33ZRyan ScottIsList instance for ZipList should debut in base-4.14.0.0, not 4.15.0.0Commits 1f911de4c73d119be58c7868d0af060055ab447d, e3672f401507fbb0803e97dde2e298552a3cac19, and 3957bdf22ca9b813c6253edbf9743254f706eb15 (sorry for not ensuring that those were squashed!) added an `IsList` instance for `ZipList` and targ...Commits 1f911de4c73d119be58c7868d0af060055ab447d, e3672f401507fbb0803e97dde2e298552a3cac19, and 3957bdf22ca9b813c6253edbf9743254f706eb15 (sorry for not ensuring that those were squashed!) added an `IsList` instance for `ZipList` and targeted its release to be `base-4.15.0.0`. After some discussion with @bgamari in !2137, we agreed that this really ought to be `base-4.14.0.0` instead. To that end, the following must be done:
1. A commit that changes `libraries/base/changelog.md` accordingly in `master`.
2. Backport 1f911de4c73d119be58c7868d0af060055ab447d, e3672f401507fbb0803e97dde2e298552a3cac19, and 3957bdf22ca9b813c6253edbf9743254f706eb15, and the commit from part (1) to the `ghc-8.10` branch.8.10.1https://gitlab.haskell.org/ghc/ghc/-/issues/17435Add instance Data a => Data (ZipList a)2020-02-25T01:04:47ZMarioAdd instance Data a => Data (ZipList a)## Summary
Copntrol.Applicative.ZipList doesn't derive an instance of Data
## Steps to reproduce
See
https://downloads.haskell.org/~ghc/latest/docs/html/libraries/base-4.13.0.0/Control-Applicative.html#t:ZipList
## Environment
* GHC...## Summary
Copntrol.Applicative.ZipList doesn't derive an instance of Data
## Steps to reproduce
See
https://downloads.haskell.org/~ghc/latest/docs/html/libraries/base-4.13.0.0/Control-Applicative.html#t:ZipList
## Environment
* GHC version used: 8.88.10.1https://gitlab.haskell.org/ghc/ghc/-/issues/17383Data.Fixed.mod' sometimes produces nonsensical results2019-10-31T23:03:13ZRoman CheplyakaData.Fixed.mod' sometimes produces nonsensical results## Summary
```
Prelude Data.Fixed> (-3e19) `mod'` 1.4
-4096.0
Prelude Data.Fixed> 4.9098418106168856e20 `mod'` (-43.4678352235136)
65536.0
Prelude Data.Fixed> (-10) `mod'` exp (-43)
-1.7763568394002505e-15
```
## Expected behavior
My ...## Summary
```
Prelude Data.Fixed> (-3e19) `mod'` 1.4
-4096.0
Prelude Data.Fixed> 4.9098418106168856e20 `mod'` (-43.4678352235136)
65536.0
Prelude Data.Fixed> (-10) `mod'` exp (-43)
-1.7763568394002505e-15
```
## Expected behavior
My understanding is that `mod'` should yield a result whose absolute value is smaller than the absolute value of the divisor and which is positive when the divisor is positive.
The fact that some of the above results happen to be powers of 2 is also curious.
## Environment
* GHC version used:
8.6.58.10.1https://gitlab.haskell.org/ghc/ghc/-/issues/17303Rounding always throws an arithmetic underflow exception when used with a rat...2022-02-03T01:23:43ZtaylorfausakRounding always throws an arithmetic underflow exception when used with a ratio of natural numbersI originally reported this in !1878.
Today I was surprised to find that `round` does not work at all for `Ratio Natural` values. For example:
``` hs
>>> round (1 :: Ratio Natural) :: Natural
*** Exception: arithmetic underflow
```
As...I originally reported this in !1878.
Today I was surprised to find that `round` does not work at all for `Ratio Natural` values. For example:
``` hs
>>> round (1 :: Ratio Natural) :: Natural
*** Exception: arithmetic underflow
```
As far as I can tell it's true regardless of the value of the `Ratio Natural` or the result type.
``` hs
>>> round (1.5 :: Ratio Natural) :: Natural
*** Exception: arithmetic underflow
>>> round (1 :: Ratio Natural) :: Integer
*** Exception: arithmetic underflow
```
For comparison, rounding works fine for `Rational`, which is an alias for `Ratio Integer`.
``` hs
>>> round (1 :: Rational) :: Integer
1
>>> round (1.5 :: Rational) :: Integer
2
>>> round (1 :: Rational) :: Natural
1
```8.10.1https://gitlab.haskell.org/ghc/ghc/-/issues/16568Missing newtypes for socklen_t and nfds_t in System.Posix.Types2019-09-24T15:31:40ZAndrew MartinMissing newtypes for socklen_t and nfds_t in System.Posix.Types# Motivation
The POSIX-specified types `nfds_t` and `socklen_t` are missing from `System.Posix.Types`. I've written bindings where I needed `socklen_t` before, but I was able to work around it since `socklen_t` is just a C `int` on ever...# Motivation
The POSIX-specified types `nfds_t` and `socklen_t` are missing from `System.Posix.Types`. I've written bindings where I needed `socklen_t` before, but I was able to work around it since `socklen_t` is just a C `int` on every platform. However, this is not true for `nfds_t`. This type would be helpful for writing cross-platform bindings correctly.
# Proposal
Add `newtype CSocklen` and `newtype CNfds` to `System.Posix.Types` in `base`. I'm happy to do this if others agree with the suggestion.8.10.1https://gitlab.haskell.org/ghc/ghc/-/issues/15812add System.Mem.Address to base2019-07-07T18:02:53ZCarter Schonwaldadd System.Mem.Address to baseper libraries in progress discussion and https://phabricator.haskell.org/D5268
current state is this
```
{-# LANGUAGE MagicHash #-}
Module System.Mem.Address (
-- * Types
Addr(..),
-- * Address arithmetic
nullAddr, plusAddr, m...per libraries in progress discussion and https://phabricator.haskell.org/D5268
current state is this
```
{-# LANGUAGE MagicHash #-}
Module System.Mem.Address (
-- * Types
Addr(..),
-- * Address arithmetic
nullAddr, plusAddr, minusAddr, remAddr,
-- * Conversion
addrToInt, addrToPtr, ptrToAddr
) where
import GHC.Base ( Int(..) )
import GHC.Prim
import GHC.Exts (isTrue#)
import GHC.Ptr
import Foreign.Marshal.Utils
import Data.Typeable ( Typeable )
import Data.Data ( Data(..), mkNoRepType )
-- | A machine address
data Addr = Addr Addr# deriving ( Typeable )
instance Show Addr where
showsPrec _ (Addr a) =
showString "0x" . showHex (fromIntegral (I# (addr2Int# a)) :: Word)
instance Eq Addr where
Addr a# == Addr b# = isTrue# (eqAddr# a# b#)
Addr a# /= Addr b# = isTrue# (neAddr# a# b#)
instance Ord Addr where
Addr a# > Addr b# = isTrue# (gtAddr# a# b#)
Addr a# >= Addr b# = isTrue# (geAddr# a# b#)
Addr a# < Addr b# = isTrue# (ltAddr# a# b#)
Addr a# <= Addr b# = isTrue# (leAddr# a# b#)
instance Data Addr where
toConstr _ = error "toConstr"
gunfold _ _ = error "gunfold"
dataTypeOf _ = mkNoRepType "Data.Primitive.Types.Addr"
-- | The null address
nullAddr :: Addr
nullAddr = Addr nullAddr#
infixl 6 `plusAddr`, `minusAddr`
infixl 7 `remAddr`
-- | Offset an address by the given number of bytes
plusAddr :: Addr -> Int -> Addr
plusAddr (Addr a#) (I# i#) = Addr (plusAddr# a# i#)
-- | Distance in bytes between two addresses. The result is only valid if the
-- difference fits in an 'Int'.
minusAddr :: Addr -> Addr -> Int
minusAddr (Addr a#) (Addr b#) = I# (minusAddr# a# b#)
-- | The remainder of the address and the integer.
remAddr :: Addr -> Int -> Int
remAddr (Addr a#) (I# i#) = I# (remAddr# a# i#)
-- | Convert an 'Addr' to an 'Int'.
addrToInt :: Addr -> Int
{-# INLINE addrToInt #-}
addrToInt (Addr addr#) = I# (addr2Int# addr#)
-- | convert `Addr` to `Ptr a`
addrToPtr :: Addr -> Ptr a
addrToPtr (Addr addr#) = Ptr addr#
-- | convert `Ptr a` to `Addr`
ptrToAddr :: Ptr a -> Addr
ptrToAddr (Ptr p) = Addr p
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ---------------------------------------------- |
| Version | 8.7 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | libraries/base |
| Test case | |
| Differential revisions | [D5268](https://phabricator.haskell.org/D5268) |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"add System.Mem.Address to base","status":"New","operating_system":"","component":"libraries/base","related":[],"milestone":"8.8.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.7","keywords":[],"differentials":[5268],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"per libraries in progress discussion and https://phabricator.haskell.org/D5268\r\n\r\ncurrent state is this \r\n\r\n{{{\r\n\r\n{-# LANGUAGE MagicHash #-}\r\n\r\nModule System.Mem.Address (\r\n -- * Types\r\n Addr(..),\r\n\r\n -- * Address arithmetic\r\n nullAddr, plusAddr, minusAddr, remAddr,\r\n\r\n -- * Conversion\r\n addrToInt, addrToPtr, ptrToAddr\r\n\r\n\r\n\r\n ) where\r\n\r\n\r\n\r\nimport GHC.Base ( Int(..) )\r\nimport GHC.Prim\r\n\r\nimport GHC.Exts (isTrue#)\r\nimport GHC.Ptr\r\nimport Foreign.Marshal.Utils\r\n\r\nimport Data.Typeable ( Typeable )\r\nimport Data.Data ( Data(..), mkNoRepType )\r\n\r\n\r\n-- | A machine address\r\ndata Addr = Addr Addr# deriving ( Typeable )\r\n\r\ninstance Show Addr where\r\n showsPrec _ (Addr a) =\r\n showString \"0x\" . showHex (fromIntegral (I# (addr2Int# a)) :: Word)\r\n\r\ninstance Eq Addr where\r\n Addr a# == Addr b# = isTrue# (eqAddr# a# b#)\r\n Addr a# /= Addr b# = isTrue# (neAddr# a# b#)\r\n\r\ninstance Ord Addr where\r\n Addr a# > Addr b# = isTrue# (gtAddr# a# b#)\r\n Addr a# >= Addr b# = isTrue# (geAddr# a# b#)\r\n Addr a# < Addr b# = isTrue# (ltAddr# a# b#)\r\n Addr a# <= Addr b# = isTrue# (leAddr# a# b#)\r\n\r\ninstance Data Addr where\r\n toConstr _ = error \"toConstr\"\r\n gunfold _ _ = error \"gunfold\"\r\n dataTypeOf _ = mkNoRepType \"Data.Primitive.Types.Addr\"\r\n\r\n-- | The null address\r\nnullAddr :: Addr\r\nnullAddr = Addr nullAddr#\r\n\r\ninfixl 6 `plusAddr`, `minusAddr`\r\ninfixl 7 `remAddr`\r\n\r\n-- | Offset an address by the given number of bytes\r\nplusAddr :: Addr -> Int -> Addr\r\nplusAddr (Addr a#) (I# i#) = Addr (plusAddr# a# i#)\r\n\r\n-- | Distance in bytes between two addresses. The result is only valid if the\r\n-- difference fits in an 'Int'.\r\nminusAddr :: Addr -> Addr -> Int\r\nminusAddr (Addr a#) (Addr b#) = I# (minusAddr# a# b#)\r\n\r\n-- | The remainder of the address and the integer.\r\nremAddr :: Addr -> Int -> Int\r\nremAddr (Addr a#) (I# i#) = I# (remAddr# a# i#)\r\n\r\n-- | Convert an 'Addr' to an 'Int'.\r\naddrToInt :: Addr -> Int\r\n{-# INLINE addrToInt #-}\r\naddrToInt (Addr addr#) = I# (addr2Int# addr#)\r\n\r\n-- | convert `Addr` to `Ptr a`\r\naddrToPtr :: Addr -> Ptr a\r\naddrToPtr (Addr addr#) = Ptr addr#\r\n\r\n-- | convert `Ptr a` to `Addr`\r\nptrToAddr :: Ptr a -> Addr\r\nptrToAddr (Ptr p) = Addr p\r\n\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.10.1