The compiler told me to report this. I have no idea what happened
Hi, Here is the error:
ghc: panic! (the 'impossible' happened)
(GHC version 8.0.2 for x86_64-unknown-linux):
initTc: unsolved constraints WC {wc_insol = [W] err_aaeS :: t_aaeR[tau:1] (CHoleCan: err)}
teach :: l ~ S l' => ErrorFunction m -> ErrorFunction o -> LearningRate -> Vector (Example i o) m -> Network i l o -> Either StopCriteria (Either Error Iterations) -> NetowrkArgs i l o -> NetworkArgs i l o
teach totalErr errF learnRate examples stopCriteria network args = teachNetwork network 0
where teachNetwork :: Network i l o -> Iterations -> Network i l o
teachNetwork net i
| not $ shouldStop stopCriteria (networkError net) i = teachNetwork (foldl updateNetworkHelper net examples) (i + 1)
| otherwise = net
networkError :: Network i l o -> Error
networkError = undefined
updateNetworkHelper :: Network i l o -> Example i o -> Network i l o
updateNetworkHelper net@(layer :~~ netTail) example = if example ^. output == runNetwork net (examples ^. input) then net else snd $ updateNetwork layer netTail errF (example ^. inputs) (example ^. outputs)
This function broke the compiler. Here is a link to the git repo with this code (module Network) https://gitlab.com/gleb_dianov/neural-haskell
With this project I wanted to show how cool Haskell is, but now I can only show how GHC crashes :(
UPD. I updated to lts-8.16. Then I commented out the function and compiled the project and when I uncommented it the compiler didn't crash