Skip to content

Commit

Permalink
ondim-generic stub
Browse files Browse the repository at this point in the history
  • Loading branch information
soficshift committed Apr 30, 2024
1 parent 828193b commit 5c65f85
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
1 change: 1 addition & 0 deletions ondim-generic/src/Ondim/Expansible/Combinators.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module Ondim.Internal.Generic.Combinators where
39 changes: 39 additions & 0 deletions ondim-generic/src/Ondim/Expansible/Generic.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{-# LANGUAGE AllowAmbiguousTypes #-}

module Ondim.Expansible.Generic where

import Control.MultiWalk.HasSub (AllMods, GSubTag)
import Control.MultiWalk.HasSub qualified as HS
import Ondim (Ondim)
import Ondim.Advanced (Carrier, Expansible (..), Substructure (..))

Check failure on line 8 in ondim-generic/src/Ondim/Expansible/Generic.hs

View workflow job for this annotation

GitHub Actions / Build - GHC 9.4 on ubuntu-latest

Module ‘Ondim.Advanced’ does not export ‘Carrier’

Check failure on line 8 in ondim-generic/src/Ondim/Expansible/Generic.hs

View workflow job for this annotation

GitHub Actions / Build - GHC 9.4 on ubuntu-latest

Module ‘Ondim.Advanced’ does not export ‘Substructure(..)’

Check failure on line 8 in ondim-generic/src/Ondim/Expansible/Generic.hs

View workflow job for this annotation

GitHub Actions / Build - GHC 9.6 on ubuntu-latest

Module ‘Ondim.Advanced’ does not export ‘Carrier’

Check failure on line 8 in ondim-generic/src/Ondim/Expansible/Generic.hs

View workflow job for this annotation

GitHub Actions / Build - GHC 9.6 on ubuntu-latest

Module ‘Ondim.Advanced’ does not export ‘Substructure(..)’

Check failure on line 8 in ondim-generic/src/Ondim/Expansible/Generic.hs

View workflow job for this annotation

GitHub Actions / Build - GHC 9.4 on macOS-latest

Module ‘Ondim.Advanced’ does not export ‘Carrier’

Check failure on line 8 in ondim-generic/src/Ondim/Expansible/Generic.hs

View workflow job for this annotation

GitHub Actions / Build - GHC 9.4 on macOS-latest

Module ‘Ondim.Advanced’ does not export ‘Substructure(..)’

Check failure on line 8 in ondim-generic/src/Ondim/Expansible/Generic.hs

View workflow job for this annotation

GitHub Actions / Build - GHC 9.6 on macOS-latest

Module ‘Ondim.Advanced’ does not export ‘Carrier’

Check failure on line 8 in ondim-generic/src/Ondim/Expansible/Generic.hs

View workflow job for this annotation

GitHub Actions / Build - GHC 9.6 on macOS-latest

Module ‘Ondim.Advanced’ does not export ‘Substructure(..)’

-- * Combinators

data OCTag

type HasSub tag ls t = HS.HasSub OCTag tag ls t
type ToSpec a = HS.ToSpec OCTag a
type ToSpecSel s a = HS.ToSpecSel OCTag s a
type instance HS.Carrier OCTag a = Carrier a

-- | Expand a list of nodes according to a spec list.
expandSpecList ::
forall ls t s.
( HasSub GSubTag ls t,
AllMods Expansible ls
) =>
t ->
Ondim s t
expandSpecList = HS.modSub @OCTag @GSubTag @ls @t (Proxy @Expansible) (\(_ :: Proxy r) -> expandSpec @r)
{-# INLINEABLE expandSpecList #-}

-- * Structure functions

getSubstructure ::
forall a ls t.
( HasSub GSubTag ls t,
AllMods (Substructure a) ls
) =>
t ->
[a]
getSubstructure = HS.getSub @OCTag @GSubTag @ls @t (Proxy @(Substructure a)) (\(_ :: Proxy j) -> getSub @a @j)

0 comments on commit 5c65f85

Please sign in to comment.