Is it possible to force F# to behave like a pure functional language like Haskell? Maybe using some compiler directives?
PS: since I come from a C/C++ background, I want to force myself to learn functional programming without learning Haskell 🙂
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can’t force this behavior in F#, but as Brian said discipline is your best friend. E.g. don’t use
mutable,fororwhileloops,refkeywords, etc. Also stick with purely immutable data structures (discriminated union, list, tuple, map, etc). If you need to do IO at some point, architect your program so that they are separated from your purely functional code.Don’t forget functional programming is all about limiting and isolating side-effects.