mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-25 04:33:45 +03:00
[ base ] Change Reader
to fix search for MonadReader
instance (#2729)
This commit is contained in:
parent
542ebeae97
commit
c906720ee3
@ -34,7 +34,7 @@ runReaderT s action = runReaderT' action s
|
||||
||| This is `ReaderT` applied to `Identity`.
|
||||
public export
|
||||
Reader : (stateType : Type) -> (a : Type) -> Type
|
||||
Reader s a = ReaderT s Identity a
|
||||
Reader s = ReaderT s Identity
|
||||
|
||||
||| Unwrap and apply a Reader monad computation
|
||||
public export %inline
|
||||
|
7
tests/base/control_monad_instances/SearchReader.idr
Normal file
7
tests/base/control_monad_instances/SearchReader.idr
Normal file
@ -0,0 +1,7 @@
|
||||
module SearchReader
|
||||
|
||||
import Control.Monad.Identity
|
||||
import Control.Monad.Reader
|
||||
|
||||
monadReaderInstance : MonadReader a (Reader a)
|
||||
monadReaderInstance = %search
|
6
tests/base/control_monad_instances/SearchState.idr
Normal file
6
tests/base/control_monad_instances/SearchState.idr
Normal file
@ -0,0 +1,6 @@
|
||||
module SearchState
|
||||
|
||||
import Control.Monad.State
|
||||
|
||||
monadWriterInstance : MonadState a (State a)
|
||||
monadWriterInstance = %search
|
7
tests/base/control_monad_instances/SearchWriter.idr
Normal file
7
tests/base/control_monad_instances/SearchWriter.idr
Normal file
@ -0,0 +1,7 @@
|
||||
module SearchWriter
|
||||
|
||||
import Control.Monad.Identity
|
||||
import Control.Monad.Writer
|
||||
|
||||
monadWriterInstance : (Monoid a) => MonadWriter a (Writer a)
|
||||
monadWriterInstance = %search
|
3
tests/base/control_monad_instances/expected
Normal file
3
tests/base/control_monad_instances/expected
Normal file
@ -0,0 +1,3 @@
|
||||
1/1: Building SearchReader (SearchReader.idr)
|
||||
1/1: Building SearchWriter (SearchWriter.idr)
|
||||
1/1: Building SearchState (SearchState.idr)
|
6
tests/base/control_monad_instances/run
Executable file
6
tests/base/control_monad_instances/run
Executable file
@ -0,0 +1,6 @@
|
||||
rm -rf build
|
||||
|
||||
$1 --no-color --console-width 0 --no-banner -c SearchReader.idr
|
||||
$1 --no-color --console-width 0 --no-banner -c SearchWriter.idr
|
||||
$1 --no-color --console-width 0 --no-banner -c SearchState.idr
|
||||
|
Loading…
Reference in New Issue
Block a user