Coming from Haskell, I struggle finding an easy way to look up type definitions in Purescript's REPL. In Haskell, I can do the following inside GHCI:
-- type class
:info Monad
-- shortcut
:i Monad
-- concrete types
:i []
:i (->)
-- type constructors work as well with a minimized output
:i Just
type Monad :: (* -> *) -> Constraint
class Applicative m => Monad m where
(>>=) :: m a -> (a -> m b) -> m b
(>>) :: m a -> m b -> m b
return :: a -> m a
{-# MINIMAL (>>=) #-}
-- Defined in ‘GHC.Base’
instance Monad (Either e) -- Defined in ‘Data.Either’
instance Monad [] -- Defined in ‘GHC.Base’
instance Monad Maybe -- Defined in ‘GHC.Base’
instance Monad IO -- Defined in ‘GHC.Base’
instance Monad ((->) r) -- Defined in ‘GHC.Base’
instance (Monoid a, Monoid b, Monoid c) => Monad ((,,,) a b c)
-- Defined in ‘GHC.Base’
instance (Monoid a, Monoid b) => Monad ((,,) a b)
-- Defined in ‘GHC.Base’
instance Monoid a => Monad ((,) a) -- Defined in ‘GHC.Base’
I can't find anything similar in spago. Is there a way to get this information without searching it online, for instance in Pursuit?
To get the type signatures, use :type
> :type (1 + _)
> Int -> Int
To display the kind of a type, use :kind
> :kind Maybe
> Type -> Type
To See all the functions, types, and type classes that a module exports, you can use browse
> :browse Data.Maybe
data Maybe a
= Nothing
| Just a
fromJust :: forall (a :: Type). Partial => Maybe a -> a
......
......
For more info, you can refer this