Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Adding more `HasCallStack` s

Cerrado
#494 3 comentarios 0 reacciones 0 asignados Ver en GitHub

@Shimuuar ya está trabajando en esto.

Desde el 4/10/2026.

  • #574 de @Shimuuar — abierto

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
haskell
Área
data

Línea de trabajo

Comienza revisando los módulos de vectores no-Generic, especialmente el ejemplo de VU.(!), y compáralos con Data/Vector/Generic.hs, donde VG.(!) ya incluye HasCallStack. Usa los ejemplos de stack-script proporcionados para comprobar si aparecen frames del caller para las funciones seleccionadas. Se considera terminado cuando haya acuerdo sobre las funciones que deberían incorporar constraints y se confirmen los traces resultantes, incluida la cuestión abierta sobre head.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Haskell
Estrellas
403
Forks
146
Merge medio
1 d 22 h
PR fusionados (30 d)
3

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de haskell/vector

Todos los issues de haskell/vector

Issues similares

Más issues de Haskell

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.