lightweight alternative to mtl?

What are you using instead of mtl? I need simple type for State. The more classy it gets the harder error messages are to understand. I've installed new package. Silently it installed new mtl. And here I'm staring into three lines of code for half an hour trying to understand where I misused the types. Compiler tells me long story about functional dependencies. After downgrade it takes me a second to find the mistake. Ohh type mismatch, forgot to pass an argument. It's class for strict and lazy states. Maybe it's better to take approach of containers (the same interface and different modules)? Anton

Anton Kholomiov
What are you using instead of mtl? I need simple type for State. The more classy it gets the harder error messages are to understand. I've installed new package. Silently it installed new mtl. And here I'm staring into three lines of code for half an hour trying to understand where I misused the types. Compiler tells me long story about functional dependencies. After downgrade it takes me a second to find the mistake. Ohh type mismatch, forgot to pass an argument.
It's class for strict and lazy states. Maybe it's better to take approach of containers (the same interface and different modules)?
If you are looking for a monomorphic approach you can use the 'transformers' library directly, on which mtl (since version 2) is based. This makes error messages better, but is also less flexible. Also 'transformers' is slightly less convenient to use. For totally different approaches to monad transformer libraries you can also have a look at monadLib and contstuff. However, personally I nowadays recommend mtl over all the three other choices. Greets, Ertugrul -- nightmare = unsafePerformIO (getWrongWife >>= sex) http://ertes.de/

* Anton Kholomiov
It's class for strict and lazy states. Maybe it's better to take approach of containers (the same interface and different modules)?
The lazy and strict State monads differ only in their >>= operator. Since you don't have control over importing the Monad instance, those two have to be different types. The reason why put/get/modify are in a class is to allow them to be used not just with State, but also with any monad stack that has a State inside, like `ReaderT e (State s)`. -- Roman I. Cheplyaka :: http://ro-che.info/

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 An other approach is to just write the monad you want your self. If you understand monads it's not very difficult (just a few lines). It gives you exactly the monad you want without all the complicated abstraction. And error messages should be very easy to understand. silvio -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQIcBAEBAgAGBQJP3s9EAAoJEDLsP+zrbatWUBIP/iWp4AUox1T+CkjaqOEi5qa8 YrJxK0STTjOMNtEA2IWBNHTt2WILKBIMUq6KbEL2o5uZBaWgloYobeyYHmQ8L9Tz RkKGwR8+oy8k13xwZm3AQ66b7EPR62LvxYfDTzAsKrg0I0bBS9fCz0u9yS+COGb3 ZMjT2AZpy6S/Acy+vT2AixE0+okQwUgaz64sv0oQw7g/0lOBIVDONQUlpDO6WntI Cbcv5pgr5CsieJvwzr8qU14vHVyFcHm72PWEB+8ZNmIBNWk2l6pA2OoXl2+ILLD1 UnXKJZUWZD/WghibcMZSyFzIs9ID/IObBAF3C3XZBkJb+BukkjE+wyWhuPuYJIcB XqT1GBnhTYmn5wbYVxvH1dIzhVWYODVB6lXoIcX/50bX8ZoXxRa/TnX3L65jhCQZ Rr62i3Z/39jZxa9zLEMc33rr7fB48GTyWjOGUVoJy80G1oUqgqVZGpKOLhzRyZr7 zcyhUc6Q59ooqS/978+Xok1/rIUbi60yhuDQGxjbOlqSbhNfaM1HcSpAQZq9qo/7 uQNvgaw6XQ3oePzO8T5q9Sa5MqixUh6tXJ2/OBIMgiuDlKPyA4d0mWTdHbCVt9am pELdcMaZ5DknjYomQ9gN7tEu7+zggXmoODkVLLPxzDicW4CjOrmCogWiLcLR3Zhq Qq/ja6SNdjS7s1/oQaMX =2mGs -----END PGP SIGNATURE-----
participants (4)
-
Anton Kholomiov
-
Ertugrul Söylemez
-
Roman Cheplyaka
-
Silvio Frischknecht