Skip to content

Instantly share code, notes, and snippets.

@fragamus
Created March 8, 2018 06:53
Show Gist options
  • Save fragamus/4d793df549a14fd9db9445562627a34b to your computer and use it in GitHub Desktop.
Save fragamus/4d793df549a14fd9db9445562627a34b to your computer and use it in GitHub Desktop.
Compiling neural's Data.FixedSize.Vector Couldn't match type ‘n + 1’ with ‘1 + n’
[12 of 22] Compiling Data.FixedSize.Vector ( src/Data/FixedSize/Vector.hs, .stack-work/dist/x86_64-osx/Cabal-2.0.1.0/build/Data/FixedSize/Vector.o )
/private/var/folders/rl/lpwgmdlj6ld9pljmv6_gj4hh0000gn/T/stack56339/neural-0.3.0.1/src/Data/FixedSize/Vector.hs:104:22: error:
• Couldn't match type ‘n + 1’ with ‘1 + n’
Expected type: Vector (n + 1) a
Actual type: Vector (1 + n) a
NB: ‘+’ is a type function, and may not be injective
• In the expression: Vector $ VS.cons x xs
In an equation for ‘cons’:
cons x (Vector xs) = Vector $ VS.cons x xs
• Relevant bindings include
xs :: VS.Vector n a (bound at src/Data/FixedSize/Vector.hs:104:16)
cons :: a -> Vector n a -> Vector (n + 1) a
(bound at src/Data/FixedSize/Vector.hs:104:1)
|
104 | cons x (Vector xs) = Vector $ VS.cons x xs
| ^^^^^^^^^^^^^^^^^^^^^
/private/var/folders/rl/lpwgmdlj6ld9pljmv6_gj4hh0000gn/T/stack56339/neural-0.3.0.1/src/Data/FixedSize/Vector.hs:112:28: error:
• Couldn't match type ‘n + 1’ with ‘1 + n0’
Expected type: VS.Vector (1 + n0) a
Actual type: VS.Vector (n + 1) a
NB: ‘+’ is a type function, and may not be injective
The type variable ‘n0’ is ambiguous
• In the first argument of ‘VS.head’, namely ‘v’
In the expression: VS.head v
In an equation for ‘vhead’: vhead (Vector v) = VS.head v
• Relevant bindings include
v :: VS.Vector (n + 1) a
(bound at src/Data/FixedSize/Vector.hs:112:15)
vhead :: Vector (n + 1) a -> a
(bound at src/Data/FixedSize/Vector.hs:112:1)
|
112 | vhead (Vector v) = VS.head v
| ^
/private/var/folders/rl/lpwgmdlj6ld9pljmv6_gj4hh0000gn/T/stack56339/neural-0.3.0.1/src/Data/FixedSize/Vector.hs:120:37: error:
• Couldn't match type ‘n + 1’ with ‘1 + n’
Expected type: VS.Vector (1 + n) a
Actual type: VS.Vector (n + 1) a
NB: ‘+’ is a type function, and may not be injective
• In the first argument of ‘VS.tail’, namely ‘v’
In the second argument of ‘($)’, namely ‘VS.tail v’
In the expression: Vector $ VS.tail v
• Relevant bindings include
v :: VS.Vector (n + 1) a
(bound at src/Data/FixedSize/Vector.hs:120:15)
vtail :: Vector (n + 1) a -> Vector n a
(bound at src/Data/FixedSize/Vector.hs:120:1)
|
120 | vtail (Vector v) = Vector $ VS.tail v
| ^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment