haskell-game / sdl2

Haskell bindings to the SDL2 library
Other
363 stars 87 forks source link

AudioSpec now exports its constructor so you can access sample format #234

Closed evanrinehart closed 2 years ago

evanrinehart commented 2 years ago

The main problem was the audioSpecFormat field has a hidden type variable and the AudioSpec constructor was not exported. This means there was no way to access the audioSpecFormat field. i.e.

• Cannot use record selector ‘audioSpecFormat’ as a function due to escaped type variables Probable fix: use pattern-matching syntax instead (Which requires the constructor to be exported.)

At the same time, the audioSpecSamples field was not exported either. Maybe there was a mix up.

Regardless, without the constructor and audioSpecFormat field we can't pattern match to get the field. And nothing is wrong with the samples field. So now all fields and the constructor for AudioSpec are exported from Audio.hs

dpwiz commented 2 years ago

Well, yeah, the exported fields are useless (tried with GHC 8.10).