Last active
December 30, 2015 06:19
-
-
Save SPY/7788533 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
instance GenServerState Command Int CounterState where | |
handle_call Get = gets counter | |
handle_cast Inc = | |
modify $ \st -> st { counter = counter st + 1 } | |
-- another instance for CounterState | |
instance GenServerState Command Float CounterState where | |
handle_call Get = gets (fromIntegral . counter) | |
handle_cast Inc = | |
modify $ \st -> st { counter = counter st + 1 } | |
-- compiler output | |
{- | |
tests/Test/GenServer.hs:22:10: | |
Functional dependencies conflict between instance declarations: | |
instance GenServerState Command Int CounterState | |
-- Defined at tests/Test/GenServer.hs:22:10 | |
instance GenServerState Command Float CounterState | |
-- Defined at tests/Test/GenServer.hs:29:10 | |
-} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment