Adding more `HasCallStack` s
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
Inizia esaminando i moduli vector non-Generic, in particolare l’esempio VU.(!), e confrontali con Data/Vector/Generic.hs, dove VG.(!) include già HasCallStack. Usa gli esempi di stack-script forniti per verificare se compaiono i frame del chiamante per le funzioni selezionate. Il lavoro è completato quando si raggiunge un accordo sulle funzioni che dovrebbero ricevere i constraints e si confermano i trace risultanti, inclusa la questione aperta riguardo a head.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
I suggest adding more HasCallStack constraints.
1. Missing HasCallStack constraints
Some functions in non- Generic modules are missing HasCallStack constraints.
Example: VU.(!)
VU.(!) does not have HasCallStack constraint and we don't get full trace:
Example
{- stack script --resolver lts-22.24 --package vector -}
import Data.Vector.Unboxed qualified as VU
main :: IO ()
main = do
let !_ = (VU.fromList [0 :: Int]) VU.! 42
return ()
The call stack does not contain VU.(!) call from main:
$ stack example-u.hs
example-u.hs: index out of bounds (42,1)
CallStack (from HasCallStack):
error, called at src/Data/Vector/Internal/Check.hs:103:12 in vector-0.13.1.0-Aqc2YUE1Egs5WmXVMbcJ5T:Data.Vector.Internal.Check
checkError, called at src/Data/Vector/Internal/Check.hs:109:17 in vector-0.13.1.0-Aqc2YUE1Egs5WmXVMbcJ5T:Data.Vector.Internal.Check
check, called at src/Data/Vector/Internal/Check.hs:122:5 in vector-0.13.1.0-Aqc2YUE1Egs5WmXVMbcJ5T:Data.Vector.Internal.Check
checkIndex, called at src/Data/Vector/Generic.hs:235:11 in vector-0.13.1.0-Aqc2YUE1Egs5WmXVMbcJ5T:Data.Vector.Generic
!, called at src/Data/Vector/Unboxed.hs:297:7 in vector-0.13.1.0-Aqc2YUE1Egs5WmXVMbcJ5T:Data.Vector.Unboxed
VG.(!) has HasCallStack constraint and we get a full trace:
Example
{- stack script --resolver lts-22.24 --package vector -}
import Data.Vector.Unboxed qualified as VU
+import Data.Vector.Generic qualified as VG
main :: IO ()
main = do
- let !_ = (VU.fromList [0 :: Int]) VU.! 42
+ let !_ = (VU.fromList [0 :: Int]) VG.! 42
return ()
The call stack contains VG.(!) call from main:
$ stack example-g.hs
example-g.hs: index out of bounds (42,1)
CallStack (from HasCallStack):
error, called at src/Data/Vector/Internal/Check.hs:103:12 in vector-0.13.1.0-Aqc2YUE1Egs5WmXVMbcJ5T:Data.Vector.Internal.Check
checkError, called at src/Data/Vector/Internal/Check.hs:109:17 in vector-0.13.1.0-Aqc2YUE1Egs5WmXVMbcJ5T:Data.Vector.Internal.Check
check, called at src/Data/Vector/Internal/Check.hs:122:5 in vector-0.13.1.0-Aqc2YUE1Egs5WmXVMbcJ5T:Data.Vector.Internal.Check
checkIndex, called at src/Data/Vector/Generic.hs:235:11 in vector-0.13.1.0-Aqc2YUE1Egs5WmXVMbcJ5T:Data.Vector.Generic
!, called at /home/tbm/dev/hs/tmp/example-g.hs:8:37 in main:Main
2. head and more
I personally like to add HasCallStack to anywhere possible.
For example, the head function does not have HasCallStack constraint. But the list's head function in base doesn't have it either. What do you think? Thank you.
- Lingua principale
- Haskell
- Stelle
- 401
- Fork
- 145
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di haskell/vector
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 68/100
-
`Size` can be a newtype. Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
Tutte le issue di haskell/vector
Issue simili
-
docs
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
-
needs triage type: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
doclayout-0.6 Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
commercialhaskell/stackage#8126 ·