codesnippets:typesynonyminstances
{-# LANGUAGE TypeSynonymInstances #-}
- allows to use type synonyms as instances
- example:
- compiler error:
app\Main.hs:9:10: error: * Illegal instance declaration for `MyClass Speed' (All instance types must be of the form (T t1 ... tn) where T is not a synonym. Use TypeSynonymInstances if you want to disable this.) * In the instance declaration for `MyClass Speed' | 9 | instance MyClass Speed where | ^^^^^^^^^^^^^
- example, with GHC option:
- compiles, error and warning free, with compiler: GHC 8.10.4, using compiler option -Wall
- executes, with output:
3.8
✎
You could leave a comment if you were logged in.
codesnippets/typesynonyminstances.txt · Last modified: by 127.0.0.1
