Re:What are potential disadvantages of functional programming?
by gizmo686 on Thursday July 27, 2017 @07:50PM
(#14870813)
>Yes, but, say, in Haskell, that's not an option.
Haskell does have the ST monad, which lets you encapsulate a non-pure algorithm (as in, one that relies on mutable state) within a pure function.
In fact, any monad will let you write imperative looking code (whose behavior is determined by the semantics of the particular monad), the standard library even provides for and while loops as functions.
You can also look at OCaml, which is very clearly a functional language, but has 1st class support for side effects and loops.
Haskell does have the ST monad, which lets you encapsulate a non-pure algorithm (as in, one that relies on mutable state) within a pure function.
In fact, any monad will let you write imperative looking code (whose behavior is determined by the semantics of the particular monad), the standard library even provides for and while loops as functions.
You can also look at OCaml, which is very clearly a functional language, but has 1st class support for side effects and loops.