I am currently learning me a Haskell, so for so good.
I am pretty fluent when it comes to F# and I want to try my hand at pure functional programming.
One of the features I have always liked about F# is that the order of your code matters. You can't call a function that you haven't defined yet. This is useful because it guarantees that earlier code files contain low level functions, and later code contains the bigger picture stuff. It forces a structure that I now consider to be a good thing.
Haskell doesn't seem to care much about code order in the same way. Whilst I can choose to structure my code as such, I am not forced to. So at this early stage of learning Haskell, I would like to know if there is some compiler option that forces this?
As far as I know, the only circumstance in which Haskell enforces the order of declarations within a module is when there are Template Haskell splices. In this case, declarations above a given splice may not reference declarations below. I think this is an unfortunate limitation of template haskell, not a feature per se.
So I think technically you can have GHC enforce the ordering by turning on Template Haskell and adding empty splices to your code.
$(return ). This is a qualified "no" - it can be done, but I've never seen anyone do it, and it's probably annoying to read & write.