Support `OsString`

Aberta
#252 8 comentários 6 reações 0 responsáveis Ver no GitHub

@mmhat já está trabalhando nisso.

Desde 9/10/2026.

  • #383 de @mmhat — aberto

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
42/100
Tipo de issue
Funcionalidade
Clareza
Razoavelmente clara
Status de atividade
Pouca atividade
Stack de tecnologia
haskell

Direção de pesquisa

Comece revisando a documentação de System.OsPath e as APIs de migração filepath, unix e Win32 referenciadas; em seguida, acompanhe como process trata caminhos em cada plataforma. Considera-se concluído quando process oferecer suporte consistente a OsString em todas as plataformas compatíveis, depois que essas dependências forem atualizadas e sincronizadas.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

Motivation

The next filepath release will add support for a new API, which fixes subtle encoding issues and improves cross platform code and memory residence.

You can read about the state of the newly added API here: https://github.com/haskellfoundation/tech-proposals/issues/35

Release is here: https://hackage.haskell.org/package/filepath-1.4.100.0

Demonstration about unsoundness of base with exotic encodings and how the new API fixes them is here: https://gist.github.com/hasufell/c600d318bdbe010a7841cc351c835f92

Migrations

Migrations can happen once the filepath, unix and Win32 packages are updated and in sync. A migration would usually involve using the new types from System.OsPath and the new API variants from unix/Win32.

When writing low-level cross platform code manually (shouldn't generally be necessary), the usual strategy is this:

#if defined(mingw32_HOST_OS) || defined(__MINGW32__)
import qualified System.OsPath.Data.ByteString.Short.Word16 as SBS
import qualified System.OsPath.Windows as PFP
#else
import qualified System.OsPath.Data.ByteString.Short as SBS
import qualified System.OsPath.Posix as PFP
#endif

crossPlatformFunction :: OsPath -> IO ()
#if defined(mingw32_HOST_OS) || defined(__MINGW32__)
crossPlatformFunction (OsString pfp@(WS ba)) = do
    -- use filepath functions for windows specific operating system strings
    let ext = PFP.takeExtension pfp
    -- operate directly on the underlying bytestring (which is a wide character bytestring, so uses Word16)
    let foo = SBS.takeWhile
    ...
#else
crossPlatformFunction (OsString pfp@(PS ba)) = do
    -- use filepath functions for posix specific operating system strings
    let ext = PFP.takeExtension pfp
    -- operate directly on the underlying bytestring (which is just Word8 bytestring)
    let foo = SBS.takeWhile
    ...
#endif

Platform specific code can be written using PosixPath/WindowsPath types.

If you have further questions, please let me know. I'm going to write a blog post outlining the affairs and more in-depth intro and migration strategies close after the release. This is a heads up.

Linguagem predominante
Haskell
Estrelas
91
Forks
93
Métricas de merge de PRs
Nenhum PR com merge em 30d

Preparar o ambiente

Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de haskell/process

Todas as issues de haskell/process

Issues semelhantes

Mais issues de Haskell

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.