Hoogle Search

Within LTS Haskell 24.6 (ghc-9.10.2)

Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.

  1. concatMap :: forall a (m :: Nat) b (n :: Nat) . (a -> Vec m b) -> Vec n a -> Vec (n * m) b

    clash-prelude Clash.Explicit.Prelude

    Map a function over all the elements of a vector and concatentate the resulting vectors.

    >>> concatMap (replicate d3) (1:>2:>3:>Nil)
    1 :> 1 :> 1 :> 2 :> 2 :> 2 :> 3 :> 3 :> 3 :> Nil
    

  2. imap :: forall (n :: Nat) a b . KnownNat n => (Index n -> a -> b) -> Vec n a -> Vec n b

    clash-prelude Clash.Explicit.Prelude

    Apply a function of every element of a vector and its index.

    >>> :t imap (+) (2 :> 2 :> 2 :> 2 :> Nil)
    imap (+) (2 :> 2 :> 2 :> 2 :> Nil) :: Vec 4 (Index 4)
    
    >>> imap (+) (2 :> 2 :> 2 :> 2 :> Nil)
    2 :> 3 :> *** Exception: X: Clash.Sized.Index: result 4 is out of bounds: [0..3]
    ...
    
    >>> imap (\i a -> extend (bitCoerce i) + a) (2 :> 2 :> 2 :> 2 :> Nil) :: Vec 4 (Unsigned 8)
    2 :> 3 :> 4 :> 5 :> Nil
    
    "imap f xs" corresponds to the following circuit layout:

  3. smap :: forall (k :: Nat) a b . KnownNat k => (forall (l :: Nat) . () => SNat l -> a -> b) -> Vec k a -> Vec k b

    clash-prelude Clash.Explicit.Prelude

    Apply a function to every element of a vector and the element's position (as an SNat value) in the vector.

    >>> let rotateMatrix = smap (flip rotateRightS)
    
    >>> let xss = (1:>2:>3:>Nil):>(1:>2:>3:>Nil):>(1:>2:>3:>Nil):>Nil
    
    >>> xss
    (1 :> 2 :> 3 :> Nil) :> (1 :> 2 :> 3 :> Nil) :> (1 :> 2 :> 3 :> Nil) :> Nil
    
    >>> rotateMatrix xss
    (1 :> 2 :> 3 :> Nil) :> (3 :> 1 :> 2 :> Nil) :> (2 :> 3 :> 1 :> Nil) :> Nil
    

  4. concatMap :: forall a (m :: Nat) b (n :: Nat) . (a -> Vec m b) -> Vec n a -> Vec (n * m) b

    clash-prelude Clash.Explicit.Prelude.Safe

    Map a function over all the elements of a vector and concatentate the resulting vectors.

    >>> concatMap (replicate d3) (1:>2:>3:>Nil)
    1 :> 1 :> 1 :> 2 :> 2 :> 2 :> 3 :> 3 :> 3 :> Nil
    

  5. imap :: forall (n :: Nat) a b . KnownNat n => (Index n -> a -> b) -> Vec n a -> Vec n b

    clash-prelude Clash.Explicit.Prelude.Safe

    Apply a function of every element of a vector and its index.

    >>> :t imap (+) (2 :> 2 :> 2 :> 2 :> Nil)
    imap (+) (2 :> 2 :> 2 :> 2 :> Nil) :: Vec 4 (Index 4)
    
    >>> imap (+) (2 :> 2 :> 2 :> 2 :> Nil)
    2 :> 3 :> *** Exception: X: Clash.Sized.Index: result 4 is out of bounds: [0..3]
    ...
    
    >>> imap (\i a -> extend (bitCoerce i) + a) (2 :> 2 :> 2 :> 2 :> Nil) :: Vec 4 (Unsigned 8)
    2 :> 3 :> 4 :> 5 :> Nil
    
    "imap f xs" corresponds to the following circuit layout:

  6. smap :: forall (k :: Nat) a b . KnownNat k => (forall (l :: Nat) . () => SNat l -> a -> b) -> Vec k a -> Vec k b

    clash-prelude Clash.Explicit.Prelude.Safe

    Apply a function to every element of a vector and the element's position (as an SNat value) in the vector.

    >>> let rotateMatrix = smap (flip rotateRightS)
    
    >>> let xss = (1:>2:>3:>Nil):>(1:>2:>3:>Nil):>(1:>2:>3:>Nil):>Nil
    
    >>> xss
    (1 :> 2 :> 3 :> Nil) :> (1 :> 2 :> 3 :> Nil) :> (1 :> 2 :> 3 :> Nil) :> Nil
    
    >>> rotateMatrix xss
    (1 :> 2 :> 3 :> Nil) :> (3 :> 1 :> 2 :> Nil) :> (2 :> 3 :> 1 :> Nil) :> Nil
    

  7. concatMap :: forall a (m :: Nat) b (n :: Nat) . (a -> Vec m b) -> Vec n a -> Vec (n * m) b

    clash-prelude Clash.Prelude

    Map a function over all the elements of a vector and concatentate the resulting vectors.

    >>> concatMap (replicate d3) (1:>2:>3:>Nil)
    1 :> 1 :> 1 :> 2 :> 2 :> 2 :> 3 :> 3 :> 3 :> Nil
    

  8. imap :: forall (n :: Nat) a b . KnownNat n => (Index n -> a -> b) -> Vec n a -> Vec n b

    clash-prelude Clash.Prelude

    Apply a function of every element of a vector and its index.

    >>> :t imap (+) (2 :> 2 :> 2 :> 2 :> Nil)
    imap (+) (2 :> 2 :> 2 :> 2 :> Nil) :: Vec 4 (Index 4)
    
    >>> imap (+) (2 :> 2 :> 2 :> 2 :> Nil)
    2 :> 3 :> *** Exception: X: Clash.Sized.Index: result 4 is out of bounds: [0..3]
    ...
    
    >>> imap (\i a -> extend (bitCoerce i) + a) (2 :> 2 :> 2 :> 2 :> Nil) :: Vec 4 (Unsigned 8)
    2 :> 3 :> 4 :> 5 :> Nil
    
    "imap f xs" corresponds to the following circuit layout:

  9. smap :: forall (k :: Nat) a b . KnownNat k => (forall (l :: Nat) . () => SNat l -> a -> b) -> Vec k a -> Vec k b

    clash-prelude Clash.Prelude

    Apply a function to every element of a vector and the element's position (as an SNat value) in the vector.

    >>> let rotateMatrix = smap (flip rotateRightS)
    
    >>> let xss = (1:>2:>3:>Nil):>(1:>2:>3:>Nil):>(1:>2:>3:>Nil):>Nil
    
    >>> xss
    (1 :> 2 :> 3 :> Nil) :> (1 :> 2 :> 3 :> Nil) :> (1 :> 2 :> 3 :> Nil) :> Nil
    
    >>> rotateMatrix xss
    (1 :> 2 :> 3 :> Nil) :> (3 :> 1 :> 2 :> Nil) :> (2 :> 3 :> 1 :> Nil) :> Nil
    

  10. concatMap :: forall a (m :: Nat) b (n :: Nat) . (a -> Vec m b) -> Vec n a -> Vec (n * m) b

    clash-prelude Clash.Prelude.Safe

    Map a function over all the elements of a vector and concatentate the resulting vectors.

    >>> concatMap (replicate d3) (1:>2:>3:>Nil)
    1 :> 1 :> 1 :> 2 :> 2 :> 2 :> 3 :> 3 :> 3 :> Nil
    

Page 30 of many | Previous | Next