Giter VIP home page Giter VIP logo

Comments (22)

Hexirp avatar Hexirp commented on July 28, 2024

fromList のドキュメントに注意書きがあるけど、そもそも version を Pattern に混ぜんなよという感がする。

from hexirp-hakyll.

Hexirp avatar Hexirp commented on July 28, 2024

躊躇なく新しい設計を組み立てようとする。具体的には PatternIdentifier -> Bool の newtype にする。ここで問題になるのは Pattern が Binary である必要があるのかどうか。

from hexirp-hakyll.

Hexirp avatar Hexirp commented on July 28, 2024

jaspervdj/hakyll@d2aaf33jaspervdj/hakyll@86ede74 が関わっているみたい?

from hexirp-hakyll.

Hexirp avatar Hexirp commented on July 28, 2024

Dependencies を扱うために必要なそうで。具体的には https://github.com/Hexirp/hexirp-hakyll/blob/a1dd75a18c5b3a55c2684326d93896c4c1e1d672/hexyll-core/src/Hexyll/Core/Dependencies.hs の所。

from hexirp-hakyll.

Hexirp avatar Hexirp commented on July 28, 2024

--------------------------------------------------------------------------------
type DependencyM a = RWS [Identifier] [String] DependencyState a

あっ。

from hexirp-hakyll.

Hexirp avatar Hexirp commented on July 28, 2024

対策するためには、別々の型にするとかかな?

from hexirp-hakyll.

Hexirp avatar Hexirp commented on July 28, 2024

regex-applicative を使うのはやめておこう。 Eq でも Show でもなくなるから。

from hexirp-hakyll.

Hexirp avatar Hexirp commented on July 28, 2024

あー、でも、直接 Pattern に変換すればいいのか?

from hexirp-hakyll.

Hexirp avatar Hexirp commented on July 28, 2024

まあ、ここがあかんのだよね。

mOldFacts <- Store.get store factsKey

from hexirp-hakyll.

Hexirp avatar Hexirp commented on July 28, 2024

ここもあかん。

Store.set store factsKey $ runtimeFacts s

その原因は

, runtimeFacts :: DependencyFacts

from hexirp-hakyll.

Hexirp avatar Hexirp commented on July 28, 2024

なんで普通に列挙しないでパターンも許しているの?

from hexirp-hakyll.

Hexirp avatar Hexirp commented on July 28, 2024

OldPattern の中で代替できなさそうなのは capture 関連か。ここの意味がよくわからない。

from hexirp-hakyll.

Hexirp avatar Hexirp commented on July 28, 2024

「型を合わせる」とは coerce で済む作業である。

from hexirp-hakyll.

Hexirp avatar Hexirp commented on July 28, 2024

capture は使われていないので消す。

from hexirp-hakyll.

Hexirp avatar Hexirp commented on July 28, 2024

capture はこんな感じのようだ。つまりワイルドカードにマッチした箇所をリストにして返す。マッチしなかったら Nothing になる。

--------------------------------------------------------------------------------
captureTests :: [TestTree]
captureTests = fromAssertions "capture"
[ Just ["bar"] @=? capture "foo/**" "foo/bar"
, Just ["foo/bar"] @=? capture "**" "foo/bar"
, Nothing @=? capture "*" "foo/bar"
, Just [] @=? capture "foo" "foo"
, Just ["foo"] @=? capture "*/bar" "foo/bar"
, Just ["foo/bar"] @=? capture "**/qux" "foo/bar/qux"
, Just ["foo/bar", "qux"] @=? capture "**/*" "foo/bar/qux"
, Just ["foo", "bar/qux"] @=? capture "*/**" "foo/bar/qux"
, Just ["foo"] @=? capture "*.html" "foo.html"
, Nothing @=? capture "*.html" "foo/bar.html"
, Just ["foo/bar"] @=? capture "**.html" "foo/bar.html"
, Just ["foo/bar", "wut"] @=? capture "**/qux/*" "foo/bar/qux/wut"
, Just ["lol", "fun/large"] @=? capture "*cat/**.jpg" "lolcat/fun/large.jpg"
, Just [] @=? capture "\\*.jpg" "*.jpg"
, Nothing @=? capture "\\*.jpg" "foo.jpg"
, Just ["xyz","42"] @=? capture (fromRegex "cat-([a-z]+)/foo([0-9]+).jpg") "cat-xyz/foo42.jpg"
]

そして fromCapture は * とか ** の穴を与えられた値で埋めていく。

-- Example:
--
-- > fromCapture (fromGlob "tags/*") "foo"
--
-- Result:
--
-- > "tags/foo"

from hexirp-hakyll.

Hexirp avatar Hexirp commented on July 28, 2024

てゆーか、これ regex-applicative を使えば行ける話じゃん。

from hexirp-hakyll.

Hexirp avatar Hexirp commented on July 28, 2024

PatternData と Pattern の Monoid 構造は compile により準同型になっている。

from hexirp-hakyll.

Hexirp avatar Hexirp commented on July 28, 2024

ドキュメントを追加したけど、なんか見づらいような気がする。

from hexirp-hakyll.

Hexirp avatar Hexirp commented on July 28, 2024

こことか

--------------------------------------------------------------------------------
match :: Pattern -> Rules () -> Rules ()
match pattern = matchInternal pattern $ getMatches pattern

ここで

--------------------------------------------------------------------------------
-- | Apply the route if the identifier matches the given pattern, fail
-- otherwise
matchRoute :: Pattern -> Routes -> Routes
matchRoute pattern (Routes route) = Routes $ \p id' ->
if matches pattern id' then route p id' else return (Nothing, False)

古い Pattern が使われている。

from hexirp-hakyll.

Hexirp avatar Hexirp commented on July 28, 2024

うーん、 (.||.) とかは Regex とかでできるから捨てちゃう?

from hexirp-hakyll.

Hexirp avatar Hexirp commented on July 28, 2024

そもそも現実的には Glob しか使わない?

from hexirp-hakyll.

Hexirp avatar Hexirp commented on July 28, 2024

なぜ Old.PatternBinary のインスタンスを持っていなければならないのか?

from hexirp-hakyll.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.